/* ==========================================================================
   Amazhub Inventory — shadcn/ui design system
   Neutral zinc palette, blue accent, thin borders, minimal shadows.
   ========================================================================== */
:root{
  --background:#f8fafc;
  --foreground:#0f172a;
  --card:#ffffff;
  --card-foreground:#0f172a;
  --muted:#f1f5f9;
  --muted-foreground:#64748b;
  --border:#e2e8f0;
  --input:#e2e8f0;
  --primary:#0f172a;          /* near-black primary buttons */
  --primary-foreground:#ffffff;
  --accent:#2563eb;           /* blue: selected states / focus / key actions */
  --accent-foreground:#ffffff;
  --accent-soft:#eff6ff;
  --nav-active:#1e40af;
  --ring:#93c5fd;
  --success:#16a34a;
  --warning:#f59e0b;
  --danger:#ef4444;
  --purple:#7c3aed;
  --radius:12px;
  --sidebar-w:248px;
  --sidebar-bg:#111827;
  --sidebar-bg2:#0f172a;
  --sidebar-fg:#cbd5e1;
  --sidebar-muted:#64748b;
  --header-h:60px;
}
*{box-sizing:border-box;margin:0;padding:0}
html{font-size:14px}
body{font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--background);color:var(--foreground);line-height:1.5;
  -webkit-font-smoothing:antialiased}
.num,.kpi-value,.pv-stats .v,.progress .val,td.num{font-variant-numeric:tabular-nums}
h1,h2,h3,h4{color:var(--foreground);font-weight:700;letter-spacing:-0.02em}
a{color:inherit;text-decoration:none}
code{font-size:.85em;background:var(--muted);padding:1px 5px;border-radius:4px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
::selection{background:var(--accent-soft)}

/* ---------- layout ---------- */
.sidebar{position:fixed;left:0;top:0;bottom:0;width:var(--sidebar-w);background:var(--sidebar-bg);
  display:flex;flex-direction:column;z-index:40;
  transition:transform .2s ease,width .2s ease}
.sidebar .brand{display:flex;align-items:center;gap:10px;padding:10px 16px;
  border-bottom:1px solid rgba(148,163,184,.12);min-height:var(--header-h)}
.brand-mark{width:32px;height:32px;border-radius:8px;background:var(--accent);color:#fff;
  display:grid;place-items:center;font-weight:700;font-size:14px;flex:none}
img.brand-mark{object-fit:cover;display:none}
.brand-logo{display:block;height:44px;width:auto;max-width:100%;border-radius:10px;background:#fff;padding:4px 10px;box-sizing:content-box}
body.collapsed .brand-logo{display:none}
body.collapsed img.brand-mark{display:block}
.brand-name{font-weight:700;font-size:14.5px;color:#f8fafc;white-space:nowrap;overflow:hidden}
.brand-sub{font-size:11px;color:var(--sidebar-muted);white-space:nowrap}
.sidebar nav{flex:1;overflow-y:auto;padding:14px 10px}
.nav-group{margin-bottom:20px}
.nav-group-label{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;
  color:var(--sidebar-muted);padding:0 10px 7px}
.sidebar nav a{display:flex;align-items:center;gap:11px;padding:8px 10px;border-radius:8px;
  color:var(--sidebar-fg);font-size:14px;font-weight:500;margin-bottom:1px;
  transition:background .15s ease,color .15s ease}
.sidebar nav a:hover{background:rgba(148,163,184,.12);color:#f8fafc}
.sidebar nav a.active{background:var(--nav-active);color:#fff;font-weight:600}
.sidebar nav a svg{width:16px;height:16px;flex:none}
.sidebar-footer{border-top:1px solid rgba(148,163,184,.12);padding:12px;font-size:12px;
  color:var(--sidebar-muted)}

body.collapsed .sidebar{width:60px}
body.collapsed .sidebar nav a span,.collapsed .brand-name,.collapsed .brand-sub,
.collapsed .nav-group-label,.collapsed .sidebar-footer{display:none}
body.collapsed .sidebar nav a{justify-content:center;padding:9px}
body.collapsed .sidebar .brand{justify-content:center}

.main{margin-left:var(--sidebar-w);min-height:100vh;display:flex;flex-direction:column;
  transition:margin .2s ease}
body.collapsed .main{margin-left:60px}
body.staff .main{margin-left:0}

/* ---------- topbar ---------- */
.topbar{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:12px;
  height:var(--header-h);background:var(--card);border-bottom:1px solid var(--border);
  padding:0 20px}
.topbar .crumb{font-size:14px;font-weight:500;color:var(--foreground);white-space:nowrap}
.topbar .crumb .muted{font-weight:400}
.collapse-btn{border:1px solid transparent}
.topbar-search{position:relative;flex:1;max-width:400px;margin-left:auto}
.topbar-search input{width:100%;padding-left:32px;background:var(--muted);border-color:transparent}
.topbar-search input:focus{background:var(--background)}
.topbar-search .sicon{position:absolute;left:10px;top:50%;transform:translateY(-50%);
  color:var(--muted-foreground);width:14px;height:14px}
.topbar-right{display:flex;align-items:center;gap:8px}
.wh-filter select{max-width:170px;font-size:13px;padding:6px 30px 6px 10px;height:34px}
.icon-btn{width:34px;height:34px;border-radius:6px;border:1px solid transparent;background:none;
  display:grid;place-items:center;cursor:pointer;color:var(--muted-foreground);position:relative;
  font-size:15px}
.icon-btn:hover{background:var(--muted);color:var(--foreground)}
.icon-btn svg{width:16px;height:16px}
.badge-dot{position:absolute;top:5px;right:5px;min-width:15px;height:15px;padding:0 4px;
  border-radius:8px;background:var(--accent);color:#fff;font-size:9.5px;font-weight:600;
  line-height:15px;text-align:center}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--foreground);color:#fff;
  display:grid;place-items:center;font-size:12px;font-weight:600;cursor:pointer;flex:none}
.freshness{font-size:11px;color:var(--muted-foreground);white-space:nowrap}
.freshness.stale{color:var(--warning)}

.content{flex:1;padding:24px;width:100%}
body.staff .content{padding-bottom:90px}
.page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin-bottom:20px;flex-wrap:wrap}
.page-title{font-size:30px;font-weight:700}
.page-sub{font-size:14px;color:var(--muted-foreground);margin-top:2px}

/* ---------- cards ---------- */
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:20px;margin-bottom:20px;box-shadow:0 1px 3px rgba(15,23,42,.05)}
.card h2,.card-title{font-size:18px;font-weight:700;margin-bottom:4px}
.card-sub{font-size:13px;color:var(--muted-foreground);margin-bottom:14px}

/* KPI cards */
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;margin-bottom:20px}
.kpi{position:relative;background:var(--card);border:1px solid var(--border);border-radius:14px;
  padding:22px;box-shadow:0 1px 3px rgba(15,23,42,.05)}
.kpi-top{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:12px}
.kpi-ic{width:44px;height:44px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.kpi-ic svg{width:20px;height:20px}
.kpi-ic.blue{background:var(--accent-soft);color:var(--accent)}
.kpi-ic.green{background:#f0fdf4;color:var(--success)}
.kpi-ic.amber{background:#fffbeb;color:var(--warning)}
.kpi-ic.purple{background:#f5f3ff;color:var(--purple)}
.kpi-more{color:var(--muted-foreground);font-size:16px;letter-spacing:1px}
.kpi-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.kpi-label{font-size:14px;font-weight:600;color:var(--muted-foreground)}
.kpi-badge{font-size:11.5px;font-weight:500;padding:2px 8px;border-radius:99px;
  display:inline-flex;align-items:center;gap:3px}
.kpi-badge.up{color:var(--success);background:#f0fdf4}
.kpi-badge.down{color:var(--danger);background:#fef2f2}
.kpi-badge.warn{color:var(--warning);background:#fffbeb}
.kpi-badge.flat{color:var(--muted-foreground);background:var(--muted)}
.kpi-value{font-size:40px;font-weight:800;letter-spacing:-0.03em;color:var(--foreground);
  font-variant-numeric:tabular-nums;line-height:1.1}
.kpi-foot{font-size:13px;color:var(--muted-foreground);margin-top:6px}

/* ---------- chart ---------- */
.chart-card{padding:20px 20px 12px}
.chart-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
  flex-wrap:wrap;margin-bottom:8px}
.chart-title{font-size:18px;font-weight:700}
.chart-sub{font-size:13px;color:var(--muted-foreground)}
.chart-controls{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.seg{display:inline-flex;background:var(--muted);border-radius:8px;padding:3px;gap:2px}
.seg button{border:none;background:none;padding:6px 14px;font-size:13px;font-weight:500;
  color:var(--muted-foreground);border-radius:6px;cursor:pointer}
.seg button.active{background:var(--accent);color:#fff}
.chart-legend{display:flex;gap:16px;font-size:13px;color:var(--muted-foreground);padding:2px 0 8px}
.chart-legend i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:6px}
#chart{position:relative}
#chart svg{display:block;width:100%;height:auto}
#chart .grid line{stroke:var(--border);stroke-width:1;stroke-dasharray:0}
#chart .axis text{font-size:10.5px;fill:var(--muted-foreground);font-family:inherit}
#chart .area-in{fill:rgba(37,99,235,.10)}
#chart .line-in{stroke:var(--accent);stroke-width:2;fill:none}
#chart .area-out{fill:rgba(239,68,68,.08)}
#chart .line-out{stroke:#ef4444;stroke-width:2;fill:none}
#chart .dot-in{fill:#fff;stroke:var(--accent);stroke-width:2}
#chart .dot-out{fill:#fff;stroke:#ef4444;stroke-width:2}
.chart-tip{position:absolute;pointer-events:none;background:var(--foreground);color:#fff;
  font-size:12px;padding:7px 10px;border-radius:6px;white-space:nowrap;display:none;
  transform:translate(-50%,-110%);z-index:5}
.chart-tip .t-in{color:#93c5fd}.chart-tip .t-out{color:#cbd5e1}

/* ---------- tabs ---------- */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:16px;overflow-x:auto}
.tabs button{border:none;background:none;padding:9px 14px;font-size:14px;font-weight:500;
  color:var(--muted-foreground);cursor:pointer;border-bottom:2px solid transparent;
  margin-bottom:-1px;white-space:nowrap}
.tabs button:hover{color:var(--foreground)}
.tabs button.active{color:var(--foreground);border-bottom-color:var(--foreground)}

/* ---------- data table ---------- */
.dt{border:1px solid var(--border);border-radius:var(--radius);background:var(--card);
  box-shadow:0 1px 2px rgba(0,0,0,.04);overflow:hidden}
.dt-toolbar{display:flex;align-items:center;gap:10px;padding:12px 16px;
  border-bottom:1px solid var(--border);flex-wrap:wrap}
.dt-toolbar input[type=search]{max-width:240px;background:var(--muted);border-color:transparent}
.dt-toolbar input[type=search]:focus{background:var(--card)}
.dt-toolbar .spacer{flex:1}
.dt-wrap{overflow-x:auto}
.dt table,.tbl{width:100%;border-collapse:collapse;font-size:13px}
.dt th,.tbl th{text-align:left;font-size:13px;font-weight:600;color:var(--muted-foreground);
  border-bottom:1px solid var(--border);padding:10px 14px;white-space:nowrap;background:var(--card)}
.dt th.sortable{cursor:pointer;user-select:none}
.dt th.sortable:hover{color:var(--foreground)}
.dt th .dir{color:var(--muted-foreground);margin-left:4px}
.dt td,.tbl td{padding:10px 14px;border-bottom:1px solid var(--muted);vertical-align:middle;white-space:nowrap}
.dt td .btn,.tbl td .btn{margin-right:4px}
.dt td .btn:last-child,.tbl td .btn:last-child{margin-right:0}
.dt tbody tr:hover td,.tbl tr:hover td{background:var(--muted)}
.dt tbody tr:last-child td{border-bottom:none}
.tbl .num,.dt .num{text-align:right;font-variant-numeric:tabular-nums}
.dt-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 16px;font-size:12.5px;color:var(--muted-foreground);flex-wrap:wrap}
.dt-footer .pager{display:flex;gap:6px}
.dt-empty{padding:40px;text-align:center;color:var(--muted-foreground);font-size:13px}
.col-toggle{position:relative}
.col-menu{position:absolute;right:0;top:calc(100% + 6px);background:var(--card);
  border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.08);
  padding:6px;min-width:160px;z-index:25}
.col-menu label{display:flex;align-items:center;gap:8px;padding:5px 8px;font-size:13px;
  border-radius:5px;cursor:pointer;margin:0}
.col-menu label:hover{background:var(--muted)}
.row-actions button{background:none;border:none;color:var(--muted-foreground);cursor:pointer;
  font-size:16px;line-height:1;padding:4px 8px;border-radius:5px}
.row-actions button:hover{background:var(--muted);color:var(--foreground)}
.row-actions-menu{position:absolute;background:var(--card);border:1px solid var(--border);
  border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.08);padding:6px;min-width:150px;z-index:30}
.row-actions-menu button{display:block;width:100%;text-align:left;background:none;border:none;
  padding:7px 10px;font-size:13px;border-radius:5px;cursor:pointer;color:var(--foreground)}
.row-actions-menu button:hover{background:var(--muted)}
.row-actions-menu button.danger{color:var(--danger)}

/* ---------- badges ---------- */
.badge,.tag{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:99px;
  font-size:11.5px;font-weight:500;border:1px solid transparent;white-space:nowrap}
.badge.gray,.tag{background:var(--muted);color:var(--muted-foreground)}
.badge.blue,.tag.in_transit,.tag.pending,.tag.open,.tag.draft,.tag.submitted{
  background:var(--accent-soft);color:var(--accent);border-color:#bfdbfe}
.badge.green,.tag.received,.tag.approved,.tag.success{background:#f0fdf4;color:var(--success);
  border-color:#bbf7d0}
.badge.red,.tag.discrepancy,.tag.rejected,.tag.failed{background:#fef2f2;color:var(--danger);
  border-color:#fecaca}
.badge.amber,.tag.cancelled{background:#fffbeb;color:var(--warning);border-color:#fde68a}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font:inherit;
  font-size:13px;font-weight:500;padding:0 14px;height:34px;border-radius:6px;cursor:pointer;
  border:1px solid var(--border);background:var(--card);color:var(--foreground);
  transition:background .1s}
.btn:hover{background:var(--muted)}
.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--primary-foreground)}
.btn.primary:hover{background:#27272a}
.btn.accent{background:var(--accent);border-color:var(--accent);color:var(--accent-foreground)}
.btn.accent:hover{background:#1d4ed8}
.btn.danger{color:var(--danger);border-color:#fecaca;background:var(--card)}
.btn.danger:hover{background:#fef2f2}
.btn.ghost{border-color:transparent}
.btn.sm{height:28px;padding:0 10px;font-size:12px}
.btn.block{width:100%}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn:focus-visible{outline:2px solid var(--ring);outline-offset:1px}

/* ---------- forms ---------- */
input,select,textarea{font:inherit;font-size:13px;padding:0 12px;height:34px;
  border:1px solid var(--input);border-radius:6px;background:var(--card);
  color:var(--foreground);min-width:0}
textarea{height:auto;padding:8px 12px}
input:focus,select:focus,textarea:focus{outline:2px solid var(--ring);outline-offset:0;
  border-color:var(--accent)}
label{display:block;font-size:13px;font-weight:500;color:var(--foreground);margin-bottom:10px}
label input,label select,label textarea{display:block;width:100%;margin-top:5px;font-weight:400}
.chk{display:flex;align-items:center;gap:8px;font-weight:400}
.chk input{width:14px;height:14px;padding:0;accent-color:var(--accent)}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:12px 0}
.row.end{justify-content:flex-end}
.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
fieldset{border:1px solid var(--border);border-radius:8px;padding:12px;margin:10px 0}
legend{font-size:12px;color:var(--muted-foreground);padding:0 6px}

/* ---------- misc ---------- */
.muted{color:var(--muted-foreground)}
.error{color:var(--danger);font-size:12.5px;margin:8px 0}
.msg{padding:10px 14px;border-radius:6px;margin-top:12px;font-size:13px;border:1px solid}
.msg.ok{background:#f0fdf4;color:var(--success);border-color:#bbf7d0}
.msg.err{background:#fef2f2;color:var(--danger);border-color:#fecaca}
.skeleton{color:var(--muted-foreground)}
.offline-bar{position:sticky;top:0;z-index:60;background:#fffbeb;color:var(--warning);
  text-align:center;padding:8px;font-size:12.5px;border-bottom:1px solid #fde68a}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-bottom:8px}
.stat{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px}
.stat-val{font-size:22px;font-weight:650;font-variant-numeric:tabular-nums}
.stat-lbl{font-size:12px;color:var(--muted-foreground)}
.stat.warn .stat-val{color:var(--warning)}.stat.bad .stat-val{color:var(--danger)}
.pager{display:flex;gap:6px;justify-content:flex-end;margin-top:12px;font-size:13px}
.pager button{padding:4px 10px}

/* dropdown panels */
.dropdown{position:absolute;background:var(--card);border:1px solid var(--border);
  border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.08);padding:6px;min-width:180px;z-index:50}
.dropdown .dd-item{display:flex;align-items:center;gap:8px;padding:7px 10px;font-size:13px;
  border-radius:5px;cursor:pointer}
.dropdown .dd-item:hover{background:var(--muted)}
.dropdown .dd-sep{height:1px;background:var(--border);margin:4px -6px}

.search-results{position:absolute;top:calc(100% + 6px);left:0;width:100%;background:var(--card);
  border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.08);
  max-height:380px;overflow-y:auto;z-index:50}
.search-results .sr-item{padding:9px 12px;border-bottom:1px solid var(--muted);cursor:pointer;font-size:13px;display:flex;align-items:center;gap:10px}
.search-results .sr-item:last-child{border-bottom:none}
.search-results .sr-item:hover{background:var(--muted)}
.search-results .sr-item .sku{font-size:11.5px;color:var(--muted-foreground)}
.search-results .sr-item.muted,.search-results .sr-item.sr-all{display:block}
.search-results .sr-item.sr-all a{color:var(--accent);font-size:12px;font-weight:600;text-decoration:none;display:block;text-align:center}
.search-results .sr-main{flex:1;min-width:0}
.search-results .sr-main b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-results .sr-main .sku{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-results .sr-qty{text-align:right;white-space:nowrap;flex:none}
.search-results .sr-qty b{display:block;font-size:14px}
.search-results .sr-qty .badge{font-size:10.5px}

.notif-panel{position:absolute;top:calc(100% + 8px);right:0;width:min(360px,90vw);
  background:var(--card);border:1px solid var(--border);border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.1);max-height:420px;overflow-y:auto;z-index:50}
.notif-panel .n-item{padding:11px 14px;border-bottom:1px solid var(--muted);cursor:pointer}
.notif-panel .n-item:last-child{border-bottom:none}
.notif-panel .n-item.unread{background:var(--accent-soft)}
.notif-panel .n-title{font-weight:550;font-size:13px}
.notif-panel .n-body{font-size:12px;color:var(--muted-foreground);margin-top:2px}

dialog{position:fixed;inset:0;margin:auto;border:1px solid var(--border);
  border-radius:12px;padding:22px;width:500px;max-width:94vw;max-height:88vh;
  overflow:auto;box-shadow:0 16px 40px rgba(0,0,0,.15)}
dialog::backdrop{background:rgba(9,9,11,.4)}
.dlg-form h2{font-size:16px;margin-bottom:14px}
.table-wrap{overflow-x:auto}

/* staff bottom nav */
.bottomnav{position:fixed;bottom:0;left:0;right:0;display:flex;background:var(--card);
  border-top:1px solid var(--border);z-index:40;padding-bottom:env(safe-area-inset-bottom)}
.bottomnav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:8px 0;color:var(--muted-foreground);font-size:10.5px}
.bottomnav a svg{width:18px;height:18px}
.bottomnav a.active{color:var(--accent);font-weight:550}

/* login */
.login-page{display:flex;min-height:100vh;align-items:center;justify-content:center;
  background:var(--muted)}
.login-card{background:var(--card);border:1px solid var(--border);border-radius:12px;
  padding:36px;width:min(380px,92vw);box-shadow:0 1px 3px rgba(0,0,0,.05)}
.login-card h1{font-size:20px;display:flex;align-items:center;gap:10px}
.login-card .btn{margin-top:10px}
.login-card.center{text-align:center}

/* mobile */
@media (max-width:900px){
  .sidebar{transform:translateX(-100%);width:var(--sidebar-w)!important;box-shadow:none}
  body.nav-open .sidebar{transform:translateX(0);box-shadow:0 0 40px rgba(0,0,0,.15)}
  body.nav-open::after{content:'';position:fixed;inset:0;background:rgba(0,0,0,.3);z-index:35}
  .main,body.collapsed .main{margin-left:0}
  body.collapsed .sidebar nav a span,body.collapsed .brand-name,body.collapsed .brand-sub,
  body.collapsed .nav-group-label{display:block}
  body.collapsed .sidebar nav a{justify-content:flex-start}
  body.collapsed .sidebar .brand{justify-content:flex-start}
  .content{padding:16px}
  .topbar-search{display:none}
  .kpi-grid{grid-template-columns:repeat(2,1fr)}
  .tbl,.dt table{font-size:12.5px}
}
@media (min-width:901px){body.nav-open .sidebar{transform:translateX(0)}}

/* ===== v2 reference-match components ===== */
.kpi-icon{position:absolute;top:14px;right:14px;width:30px;height:30px;border-radius:8px;background:#f1f5f9;color:#64748b;display:flex;align-items:center;justify-content:center}
.kpi-icon svg{width:15px;height:15px}
.kpi-delta{display:inline-flex;align-items:center;gap:3px;margin-top:6px;font-size:11px;font-weight:600;padding:2px 7px;border-radius:99px}
.kpi-delta.up{color:#16a34a;background:#f0fdf4}
.kpi-delta.down{color:#ef4444;background:#fef2f2}
.kpi-sub{font-size:11px;color:#64748b;margin-left:6px}

.progress{display:flex;align-items:center;gap:12px}
.progress .picon{width:36px;height:36px;border-radius:9px;background:#0f172a;color:#fff;
  display:flex;align-items:center;justify-content:center;flex:none}
.progress .picon svg{width:16px;height:16px}
.progress .bar{flex:1;height:7px;border-radius:99px;background:#f1f5f9;overflow:hidden}
.progress .bar>i{display:block;height:100%;border-radius:99px;background:#2563eb}
.progress .val{font-size:13.5px;font-weight:700;color:var(--foreground);min-width:84px;text-align:right;white-space:nowrap}
.progress .pct{font-size:12.5px;font-weight:600;color:var(--accent);min-width:44px;text-align:right;white-space:nowrap;text-decoration:none}
.progress .lbl{font-size:13.5px;font-weight:600;color:var(--foreground);min-width:80px}

.act-list{display:flex;flex-direction:column}
.act-item{display:flex;gap:12px;padding:10px 0;border-bottom:1px solid #f1f5f9;align-items:flex-start}
.act-item:last-child{border-bottom:0}
.act-ic{width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;flex:none;margin-top:1px}
.act-ic svg{width:15px;height:15px}
.act-ic.in{background:#f0fdf4;color:#16a34a}
.act-ic.out{background:#fef2f2;color:#ef4444}
.act-ic.tr{background:#eff6ff;color:#2563eb}
.act-ic.ap{background:#f5f3ff;color:#7c3aed}
.act-ic.warn{background:#fffbeb;color:#f59e0b}
.act-tx{flex:1;min-width:0;font-size:13px;color:var(--muted-foreground);line-height:1.45;
  display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.act-tx b{color:var(--foreground);font-weight:600;display:block}
.act-time{font-size:11.5px;color:#94a3b8;white-space:nowrap;display:flex;align-items:center;gap:5px}
.act-time i{width:6px;height:6px;border-radius:50%;background:#16a34a;display:inline-block}
.card-title-row{display:flex;align-items:center;justify-content:space-between}
.card-title-row a{font-size:12px;color:#2563eb;text-decoration:none;font-weight:500}

.pager{display:flex;align-items:center;gap:4px}
.pager button{min-width:28px;height:28px;padding:0 7px;border-radius:6px;border:1px solid #e2e8f0;background:#fff;font-size:12px;color:#334155;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.pager button:hover{background:#f1f5f9}
.pager button.on{background:#0f172a;color:#fff;border-color:#0f172a}
.pager button:disabled{opacity:.4;cursor:default}
.dt-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border-top:1px solid #e2e8f0;flex-wrap:wrap}
.dt-foot .dt-info{padding:0}
.rows-sel{display:flex;align-items:center;gap:6px;font-size:12px;color:#64748b}
.rows-sel select{height:26px;padding:0 6px;font-size:12px;width:auto}

.thumb{width:30px;height:30px;border-radius:6px;background:#f1f5f9;border:1px solid #e2e8f0;display:inline-flex;align-items:center;justify-content:center;flex:none;overflow:hidden}
.thumb svg{width:15px;height:15px;color:#94a3b8}
.thumb.lg{width:56px;height:56px;border-radius:10px}
.thumb.lg svg{width:24px;height:24px}
.tbl td .cell-prod{display:flex;align-items:center;gap:10px;min-width:0}
.tbl td .cell-prod .pn{font-weight:500;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tbl td .cell-prod .ps{font-size:11px;color:#94a3b8}
.tbl input[type=checkbox]{width:14px;height:14px;accent-color:#2563eb;margin:0}

.grid-2{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:14px;align-items:start}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.field{margin-bottom:12px}
.field label{display:block;font-size:12.5px;font-weight:500;color:#334155;margin-bottom:5px}
.field textarea{width:100%;padding:8px 10px;border:1px solid #e2e8f0;border-radius:8px;font:inherit;font-size:13px;resize:vertical;min-height:56px;outline:none}
.field textarea:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.req{color:#ef4444}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.check-list{display:flex;flex-direction:column;gap:6px;font-size:12.5px;color:#334155}
.check-list label{display:flex;align-items:center;gap:7px}
.check-list input{accent-color:#2563eb;width:15px;height:15px;padding:0;display:inline-block;margin:0}

.preview-card .pv-head{display:flex;gap:12px;align-items:center;padding-bottom:12px;border-bottom:1px solid #f1f5f9;margin-bottom:12px}
.preview-card .pv-head .pv-name{font-weight:600;font-size:13.5px}
.preview-card .pv-head .pv-sku{font-size:11px;color:#94a3b8}
.pv-stats{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;text-align:center;margin-bottom:12px}
.pv-stats>div{background:#f8fafc;border:1px solid #f1f5f9;border-radius:8px;padding:10px 4px}
.pv-stats .v{font-size:19px;font-weight:650}
.pv-stats .l{font-size:11px;color:#64748b;margin-top:2px}
.pv-stats .hl .v{color:#2563eb}
.pv-meta{display:flex;flex-direction:column;gap:6px;font-size:12.5px}
.pv-meta div{display:flex;justify-content:space-between}
.pv-meta .k{color:#64748b}
.pv-meta .val{font-weight:500;color:#0f172a}

.pd-head{display:flex;gap:14px;align-items:center;padding:14px}
.pd-head .pd-name{font-size:16px;font-weight:650}
.pd-head .pd-sku{font-size:12px;color:#64748b;margin-top:2px}
.pd-head .spacer{flex:1}
.info-kv{display:grid;grid-template-columns:110px 1fr;gap:7px 14px;font-size:12.5px}
.info-kv .k{color:#64748b}
.info-kv .val{font-weight:500}
.qa-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.wh-stock-row{display:flex;justify-content:space-between;font-size:12.5px;padding:7px 0;border-bottom:1px solid #f1f5f9}
.wh-stock-row:last-child{border-bottom:0}
.wh-stock-row .wl{color:#334155}
.wh-stock-row .wv{font-weight:600}

.rep-layout{display:grid;grid-template-columns:272px minmax(0,1fr);gap:14px;align-items:start}
.check-list label{white-space:nowrap}
.check-list input{flex:none}
.sidebar-user{display:flex;gap:10px;align-items:center;padding:4px 2px}
.sidebar-user .avatar{width:32px;height:32px;font-size:12px;background:#f8fafc;color:#0f172a}
.sidebar-user .un{font-size:13px;font-weight:600;color:#f8fafc;line-height:1.2}
.sidebar-user .ur{font-size:11px;color:var(--sidebar-muted)}
.collapsed .sidebar-user .su-tx{display:none}
.date-range{font-size:12.5px;color:var(--muted-foreground);border:1px solid var(--border);border-radius:8px;padding:5px 10px;background:var(--card);white-space:nowrap}
@media(max-width:1100px){.grid-2,.rep-layout{grid-template-columns:1fr}.kpi-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.kpi-grid{grid-template-columns:1fr}.form-row{grid-template-columns:1fr}}

/* ===== searchable select ===== */
.ssel{position:relative;display:inline-block;min-width:0}
.ssel-box{position:relative;display:flex;align-items:center;gap:8px;height:34px;
  padding:0 28px 0 12px;border:1px solid var(--input);border-radius:6px;
  background:var(--card);font-size:13px;cursor:pointer;white-space:nowrap;min-width:130px}
.ssel-box::after{content:'';position:absolute;right:11px;top:50%;margin-top:-2px;
  border:4px solid transparent;border-top-color:var(--muted-foreground)}
.ssel-box:hover{border-color:#cbd5e1}
.ssel-box .ssel-txt{overflow:hidden;text-overflow:ellipsis}
.ssel-box.empty .ssel-txt{color:var(--muted-foreground)}
.ssel-menu{position:fixed;top:0;left:0;min-width:100%;width:max-content;
  max-width:300px;background:var(--card);border:1px solid var(--border);border-radius:8px;
  box-shadow:0 8px 24px rgba(15,23,42,.12);z-index:300;overflow:hidden}
.ssel-q{display:block;width:100%;border:0;border-bottom:1px solid var(--border);
  border-radius:0;height:34px;padding:0 12px;outline:none;background:var(--card)}
.ssel-q::-webkit-search-cancel-button{-webkit-appearance:none;display:none}
.ssel-q:focus{border-bottom-color:var(--border);box-shadow:none}
.ssel-list{max-height:224px;overflow-y:auto;padding:4px}
.ssel-opt{padding:6px 9px;font-size:13px;border-radius:5px;cursor:pointer;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ssel-opt:hover{background:var(--muted)}
.ssel-opt.on{background:var(--accent-soft);color:var(--accent);font-weight:500}
.ssel-opt.dis{opacity:.4;cursor:default}
.ssel-empty{padding:10px 12px;font-size:12px;color:var(--muted-foreground)}
.field .ssel,.dlg-form .ssel,.form-row .ssel,.rep-layout .ssel{display:block;width:100%}
.field .ssel .ssel-box,.dlg-form .ssel .ssel-box,.form-row .ssel .ssel-box,.rep-layout .ssel .ssel-box{width:100%}
.dt-toolbar .ssel{flex:none}
dialog .ssel-menu{z-index:80}
td .ssel{display:block;width:100%}
td .ssel .ssel-box{width:100%}

/* ===== structured dialogs ===== */
.dlg-lg{width:560px}
.dlg-xl{width:860px}
.dlg-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:16px}
.dlg-head h2{font-size:18px;font-weight:700;margin:0}
.dlg-sub{font-size:12.5px;color:var(--muted-foreground);margin:3px 0 0}
.dlg-x{border:0;background:none;font-size:20px;line-height:1;color:var(--muted-foreground);
  cursor:pointer;padding:2px 6px;border-radius:6px}
.dlg-x:hover{background:var(--muted);color:var(--foreground)}
.dlg-sec{font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  color:var(--muted-foreground);margin:16px 0 10px;padding-top:14px;
  border-top:1px solid var(--border)}
.dlg-sec:first-of-type{border-top:0;padding-top:0;margin-top:0}
.dlg-hint{font-size:12px;color:var(--muted-foreground);margin:6px 0 0}
.req{color:var(--danger);font-style:normal}
.dlg-form input:not([type=checkbox]),.dlg-form .ssel-box{height:40px}
.dlg-form label{font-weight:500;font-size:13px}
.dlg-foot{margin-top:18px}

/* ---------- import page ---------- */
.imp-grid{display:grid;grid-template-columns:1fr auto;gap:14px;align-items:end}
.imp-cols{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.imp-col{font-size:11.5px;font-weight:500;padding:3px 10px;border-radius:999px;
  background:var(--muted);border:1px solid var(--border);color:#334155}
.imp-col.req{background:var(--accent-soft);border-color:#bfdbfe;color:#1d4ed8;font-weight:600}
.imp-note{font-size:12px;margin:0 0 14px}
.imp-hint{font-size:11.5px;color:var(--muted-foreground);margin-top:5px}
.imp-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:5px;padding:20px 16px;border:1.5px dashed var(--border);border-radius:10px;
  background:var(--muted);cursor:pointer;text-align:center;
  transition:border-color .15s,background .15s}
.imp-drop svg{width:24px;height:24px;color:var(--accent)}
.imp-drop:hover,.imp-drop.over{border-color:var(--accent);background:var(--accent-soft)}
.imp-drop-t{font-size:13px;color:var(--foreground)}
.imp-drop-t b{color:var(--accent);font-weight:600}
.imp-drop-f{font-size:11.5px;color:var(--muted-foreground)}
.imp-drop.has-file{border-style:solid;border-color:#bbf7d0;background:#f0fdf4}
.imp-drop.has-file svg{color:var(--success)}
.imp-actions{display:flex;align-items:end;padding-bottom:1px}
@media(max-width:820px){.imp-grid{grid-template-columns:1fr}}

/* hidden attribute must always win over display rules */
[hidden]{display:none!important}
