:root {
  --top: #3c8dbc;
  --top-dark: #367fa9;
  --side: #1aa35a;
  --side-dark: #148a4b;
  --side-deep: #2e7d55;
  --content: #ecf0f5;
  --ink: #1f2d3d;
  --muted: #6b7785;
  --yellow: #f39c12; --green: #00a65a; --red: #dd4b39; --blue: #0073b7; --aqua: #00c0ef; --purple: #605ca8; --teal: #0f9488;
  --sidebar-w: 250px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif; background: var(--content); color: var(--ink); font-size: 15px; }
a { text-decoration: none; }

/* ---------- layout ---------- */
.app-top { position: fixed; top: 0; left: 0; right: 0; height: 56px; display: flex; z-index: 1030; background: var(--top); color: #fff; }
.app-brand { width: var(--sidebar-w); background: var(--top-dark); display: flex; align-items: center; gap: 10px; padding: 0 16px; color: #fff; font-weight: 700; font-size: 20px; flex-shrink: 0; transition: width .2s; overflow: hidden; white-space: nowrap; }
.app-brand img { height: 34px; }
.app-brand .brand-mark { font-weight: 800; letter-spacing: .5px; }
.app-brand .brand-mark small { display: block; font-size: 10px; font-weight: 400; font-style: italic; opacity: .85; margin-top: -4px; }
.app-brand .sep { opacity: .4; }
.app-topbar { flex: 1; display: flex; align-items: center; padding: 0 12px; gap: 8px; min-width: 0; }
.app-topbar .btn-icon { color: #fff; font-size: 22px; background: none; border: 0; padding: 6px 10px; border-radius: 6px; }
.app-topbar .btn-icon:hover { background: rgba(255,255,255,.12); }
.top-search { max-width: 340px; flex: 1; }
.top-search input { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 20px; padding-left: 36px; }
.top-search input::placeholder { color: rgba(255,255,255,.75); }
.top-search input:focus { background: #fff; color: var(--ink); box-shadow: none; }
.top-search .bi { position: absolute; left: 12px; top: 8px; color: rgba(255,255,255,.8); }
.top-search:focus-within .bi { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--top); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.app-top .dropdown-toggle { color: #fff; }

.app-side { position: fixed; top: 56px; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--side); color: #fff; overflow-y: auto; z-index: 1020; transition: transform .2s, width .2s; }
.app-side::-webkit-scrollbar { width: 6px; } .app-side::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
.user-panel { background: var(--side-deep); padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.user-panel .avatar { width: 44px; height: 44px; color: var(--side-deep); font-size: 18px; }
.user-panel .name { font-weight: 600; }
.user-panel .online { font-size: 12px; } .user-panel .online::before { content: ""; display: inline-block; width: 8px; height: 8px; background: #3c3; border-radius: 50%; margin-right: 5px; }
.side-nav { list-style: none; padding: 0; margin: 0; }
.side-nav a, .side-nav .grp { display: flex; align-items: center; gap: 12px; padding: 11px 18px; color: #fff; font-weight: 600; border-left: 3px solid transparent; cursor: pointer; }
.side-nav a:hover, .side-nav .grp:hover { background: var(--side-dark); }
.side-nav a.active { background: var(--side-dark); border-left-color: #fff; }
.side-nav .grp .chev { margin-left: auto; transition: transform .2s; font-size: 12px; }
.side-nav .grp[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.side-nav .sub { background: rgba(0,0,0,.08); }
.side-nav .sub a { padding: 8px 18px 8px 40px; font-weight: 400; font-size: 14px; }
.side-nav .badge { margin-left: auto; }
.side-nav .bi { width: 20px; text-align: center; font-size: 17px; }

.app-main { margin-left: var(--sidebar-w); padding: 72px 22px 30px; min-height: 100vh; transition: margin .2s; }
body.side-collapsed .app-side { transform: translateX(-100%); }
body.side-collapsed .app-main { margin-left: 0; }
body.side-collapsed .app-brand { width: 70px; }
body.side-collapsed .app-brand .full { display: none; }
@media (max-width: 991px) {
  .app-side { transform: translateX(-100%); }
  body.side-open .app-side { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .app-main { margin-left: 0; padding: 70px 12px 24px; }
  .app-brand { width: auto; } .app-brand .full { display: none; }
  .top-search { display: none; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; font-weight: 400; margin: 0; }
.page-head h1 small { font-size: 16px; color: var(--muted); margin-left: 6px; }
.crumb { font-size: 14px; color: var(--muted); } .crumb a { color: var(--ink); }

/* ---------- widgets ---------- */
.card { border: 0; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card-top { border-top: 3px solid var(--green); }
.card-top.blue { border-top-color: var(--top); } .card-top.yellow { border-top-color: var(--yellow); } .card-top.red { border-top-color: var(--red); }
.card-header { background: #fff; border-bottom: 1px solid #f0f0f0; font-weight: 600; font-size: 17px; padding: 12px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-header .ms-auto { font-weight: 400; }

.small-box { position: relative; border-radius: 3px; color: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.12); display: block; margin-bottom: 18px; }
.small-box .inner { padding: 14px 16px 10px; position: relative; z-index: 1; }
.small-box h3 { font-size: 34px; font-weight: 700; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small-box p { font-size: 17px; margin: 0; }
.small-box .icon { position: absolute; right: 14px; top: 6px; font-size: 76px; color: rgba(0,0,0,.15); transition: transform .3s; }
.small-box:hover .icon { transform: scale(1.08); }
.small-box .foot { display: block; background: rgba(0,0,0,.1); color: rgba(255,255,255,.95); text-align: center; padding: 5px 0; font-size: 15px; position: relative; z-index: 1; }
.small-box .foot:hover { background: rgba(0,0,0,.18); color: #fff; }
.bg-yellow { background: var(--yellow) !important; } .bg-green { background: var(--green) !important; } .bg-red { background: var(--red) !important; }
.bg-blue { background: var(--blue) !important; } .bg-aqua { background: var(--aqua) !important; } .bg-purple { background: var(--purple) !important; } .bg-teal { background: var(--teal) !important; }

.info-box { display: flex; background: #fff; min-height: 96px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.08); margin-bottom: 18px; overflow: hidden; }
.info-box .ib-icon { width: 96px; display: flex; align-items: center; justify-content: center; font-size: 42px; color: #fff; flex-shrink: 0; }
.info-box .ib-body { padding: 10px 16px; min-width: 0; }
.info-box .ib-text { text-transform: uppercase; font-size: 14px; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-box .ib-num { font-size: 24px; font-weight: 700; }
.info-box .ib-sub { font-size: 13px; color: var(--muted); }

.table { font-size: 14.5px; margin-bottom: 0; }
.table thead th { background: #f7f9fb; font-weight: 600; white-space: nowrap; color: #4a5560; border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td, .table tfoot th { font-weight: 700; background: #f7f9fb; }
.neg { color: var(--red); }
.status-pill { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 20px; }
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 400; } .kv dd { margin: 0; font-weight: 600; word-break: break-word; }

.form-label { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.form-control, .form-select { font-size: 14.5px; }
.req::after { content: " *"; color: var(--red); }
.line-table td { padding: 6px 4px; }
.line-table .form-control, .line-table .form-select { min-width: 90px; }
.line-table td.del { width: 40px; text-align: center; }
.line-table .ts-wrapper { min-width: 220px; }
.line-meta { font-size: 12px; color: var(--muted); }
.calc-box { background: #f6fbf8; border: 1px dashed #9fd8b7; border-radius: 6px; padding: 12px 14px; }
.calc-box .row > div { margin-bottom: 6px; }
.calc-box .v { font-size: 20px; font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid #dfe6ec; margin-left: 6px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--top); }
.timeline li:last-child { border-left-color: transparent; }

.btn { font-size: 14.5px; }
.btn-green { background: linear-gradient(90deg, #0aa457, #0f8f7b); color: #fff; border: 0; }
.btn-green:hover { color: #fff; filter: brightness(1.05); }

.qr-box svg { width: 100%; height: 100%; display: block; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.empty .bi { font-size: 40px; display: block; margin-bottom: 8px; opacity: .5; }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .app-top, .app-side, .no-print, .page-head .btn, .messages { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .print-only { display: block; }
  .table { font-size: 11.5px; }
  a { color: inherit; }
}
.print-header { border-bottom: 2px solid #222; padding-bottom: 8px; margin-bottom: 12px; justify-content: space-between; align-items: center; }
@media print { .print-header { display: flex !important; } }
.print-header h2 { margin: 0; font-size: 20px; font-weight: 700; }

/* ---------- labels ---------- */
.label-sheet { display: flex; flex-wrap: wrap; gap: 4mm; }
.label { border: 1px dashed #999; border-radius: 2mm; padding: 2mm; display: flex; gap: 2mm; align-items: center; background: #fff; page-break-inside: avoid; overflow: hidden; }
.label.sm { width: 50mm; height: 30mm; } .label.md { width: 70mm; height: 40mm; } .label.lg { width: 100mm; height: 60mm; }
.label .lq { flex-shrink: 0; } .label.sm .lq { width: 24mm; height: 24mm; } .label.md .lq { width: 34mm; height: 34mm; } .label.lg .lq { width: 52mm; height: 52mm; }
.label .lt { font-weight: 700; line-height: 1.15; font-size: 10pt; } .label.sm .lt { font-size: 7.5pt; }
.label .lc { font-family: monospace; font-size: 8pt; } .label .lp { font-weight: 800; font-size: 11pt; }
@media print { .label { border-color: #ccc; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; }
.login-hero { flex: 1.15; position: relative; overflow: hidden; color: #fff; padding: 44px 48px; display: flex; flex-direction: column;
  background: linear-gradient(160deg, #16a34a 0%, #079373 45%, #126e7e 75%, #2b6c9e 100%); }
.login-hero::after { content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%; right: -140px; bottom: -220px; background: rgba(255,255,255,.08); }
.login-hero::before { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; right: -60px; bottom: -130px; border: 40px solid rgba(255,255,255,.05); }
.login-brand { display: flex; align-items: center; gap: 16px; }
.login-brand .brand-mark { font-size: 40px; font-weight: 800; line-height: 1; }
.login-brand .brand-mark small { display: block; font-size: 17px; font-weight: 400; font-style: italic; }
.login-brand .divider { width: 1px; height: 40px; background: rgba(255,255,255,.4); }
.login-brand .app { font-size: 24px; font-weight: 700; }
.login-hero h1 { font-size: clamp(30px, 3.6vw, 48px); font-weight: 700; line-height: 1.2; margin: auto 0 22px; max-width: 640px; }
.login-hero h1 .hl { color: #b8f5cf; }
.login-hero .sub { font-size: 19px; max-width: 640px; opacity: .95; }
.login-hero ul { list-style: none; padding: 0; margin: 22px 0 auto; font-size: 18px; }
.login-hero li { margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.login-hero li .bi { color: #c6f6d5; font-size: 20px; }
.login-panel { flex: 1; background: #f1f5f9; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; }
.login-card { background: #fff; width: 100%; max-width: 560px; border-radius: 18px; padding: 40px 46px; box-shadow: 0 10px 40px rgba(15,23,42,.08); }
.login-chip { display: inline-flex; gap: 8px; align-items: center; background: #e7f6ec; color: #0b7a3e; font-weight: 700; padding: 8px 16px; border-radius: 20px; font-size: 15px; }
.login-card h2 { font-size: 34px; font-weight: 800; margin: 20px 0 8px; }
.login-card .lead { color: var(--muted); font-size: 18px; }
.login-card .input-icon { position: relative; }
.login-card .input-icon > .bi { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 18px; }
.login-card .input-icon input { padding: 14px 48px; font-size: 17px; border-radius: 10px; border: 1.5px solid #d6dde6; }
.login-card .input-icon .eye { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #475569; font-size: 19px; }
.login-card .btn-login { width: 100%; padding: 14px; font-size: 19px; font-weight: 700; border-radius: 10px; background: linear-gradient(90deg, #07a35a, #0b8f7d); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(7,163,90,.3); }
.login-card .btn-login:hover { filter: brightness(1.06); }
.login-foot { color: var(--muted); margin-top: 18px; font-size: 14px; }
@media (max-width: 900px) { .login-hero { display: none; } .login-card { padding: 30px 22px; } }
