/* =====================================================================
   Roto-Rooter WMS — app.css
   Brand-driven UI (RR red + blue) · responsive desktop + mobile PWA
   ===================================================================== */

:root{
  /* Brand */
  --red:#E4002B;      --red-600:#C10024;   --red-050:#FFF0F2;
  --blue:#003DA5;     --blue-700:#002E7C;  --blue-900:#001F52;  --blue-050:#EAF1FE;
  /* Ink & surfaces */
  --ink:#0E1726;      --ink-2:#33415A;     --muted:#6B7A90;     --faint:#96A2B4;
  --line:#E4E9F0;     --line-2:#EDF1F6;
  --bg:#F3F6FB;       --surface:#FFFFFF;   --surface-2:#F8FAFD;
  /* Status */
  --ok:#0E9F6E;       --ok-bg:#E7F8F0;
  --warn:#C77700;     --warn-bg:#FEF4E4;
  --danger:#DC2626;   --danger-bg:#FDECEC;
  /* Shape */
  --r:16px; --r-sm:11px; --r-xs:8px; --r-pill:999px;
  --sb:252px;   /* sidebar width */
  --tb:66px;    /* topbar height */
  --sh-sm:0 1px 2px rgba(16,23,38,.06), 0 1px 3px rgba(16,23,38,.04);
  --sh:0 2px 6px rgba(16,23,38,.06), 0 8px 24px rgba(16,23,38,.06);
  --sh-lg:0 12px 40px rgba(16,23,38,.14);
  --font:'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; font-family:var(--font); color:var(--ink); background:var(--bg);
  font-size:14.5px; line-height:1.5; -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
h1,h2,h3,h4{ margin:0; font-weight:700; letter-spacing:-.01em; color:var(--ink); }
a{ color:inherit; text-decoration:none; }
img,svg{ display:block; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea,button{ font:inherit; color:inherit; }
.num{ font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1; }
:focus-visible{ outline:2.5px solid var(--blue); outline-offset:2px; border-radius:6px; }

/* ===================== APP SHELL ===================== */
.app{ min-height:100vh; min-height:100dvh; }
.main-wrap{ margin-left:var(--sb); min-height:100vh; display:flex; flex-direction:column; }

/* ===================== SIDEBAR ===================== */
.sidebar{
  position:fixed; inset:0 auto 0 0; width:var(--sb); z-index:60;
  background:linear-gradient(185deg,#00337F 0%, var(--blue-900) 62%, #001740 100%);
  color:#DCE6FB; display:flex; flex-direction:column;
  box-shadow:2px 0 22px rgba(0,20,64,.18);
}
.brand{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:16px 16px 10px;
}
.brand-logo{
  display:flex; background:#fff; border-radius:12px; padding:10px 12px;
  box-shadow:0 4px 14px rgba(0,10,40,.28); flex:1;
}
.brand-logo img{ width:100%; height:auto; max-height:40px; }
.drawer-close{ display:none; }
.side-sub{
  padding:0 20px 12px; font-size:11px; letter-spacing:.14em; text-transform:uppercase;
  color:rgba(190,208,244,.62); font-weight:600;
}

.nav{ flex:1; overflow-y:auto; padding:6px 12px 14px; }
.nav::-webkit-scrollbar{ width:6px; }
.nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.14); border-radius:6px; }
.nav-group{
  padding:14px 12px 6px; font-size:10.5px; font-weight:700; letter-spacing:.13em;
  text-transform:uppercase; color:rgba(170,190,232,.55);
}
.nav-link{
  display:flex; align-items:center; gap:12px; padding:10px 12px; margin:2px 0;
  border-radius:11px; color:#C6D4F0; font-weight:600; font-size:14px;
  position:relative; transition:background .15s, color .15s;
}
.nav-link:hover{ background:rgba(255,255,255,.08); color:#fff; }
.nav-link.active{ background:#fff; color:var(--blue-900); box-shadow:0 6px 16px rgba(0,10,40,.28); }
.nav-link.active .nav-ico{ color:var(--red); }
.nav-ico{ width:22px; height:22px; display:grid; place-items:center; color:#9FB6E6; }
.nav-link:hover .nav-ico{ color:#fff; }
.nav-ico svg{ width:20px; height:20px; }
.nav-txt{ flex:1; }
.nav-badge{
  background:var(--red); color:#fff; font-size:11px; font-weight:700; line-height:1;
  padding:3px 7px; border-radius:var(--r-pill); min-width:20px; text-align:center;
}
.nav-link.active .nav-badge{ background:var(--red); }

.side-foot{ position:relative; height:64px; }
.side-foot .wave{ position:absolute; inset:auto 0 0 0; width:100%; height:44px; }
.side-foot-in{ position:absolute; inset:0; display:flex; align-items:flex-end; padding:0 20px 12px; }
.ver{ font-size:10.5px; color:rgba(180,200,240,.55); }

.scrim{
  position:fixed; inset:0; background:rgba(6,16,40,.5); z-index:55;
  opacity:0; transition:opacity .2s; backdrop-filter:blur(1px);
}
.scrim.show{ opacity:1; }

/* ===================== TOPBAR ===================== */
.topbar{
  position:sticky; top:0; z-index:40; height:var(--tb);
  display:flex; align-items:center; gap:14px; padding:0 22px;
  background:rgba(255,255,255,.86); backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line);
}
.icon-btn{
  width:40px; height:40px; border:1px solid var(--line); background:var(--surface);
  border-radius:11px; display:none; place-items:center; color:var(--ink-2);
}
.icon-btn svg{ width:20px; height:20px; }
.page-head{ min-width:0; }
.page-title{ font-size:19px; line-height:1.15; }
.page-sub{ margin:2px 0 0; font-size:12.5px; color:var(--muted); }

.topsearch{
  margin-left:auto; display:flex; align-items:center; gap:9px;
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-pill);
  padding:9px 15px; width:min(320px,32vw); transition:border-color .15s, box-shadow .15s;
}
.topsearch:focus-within{ border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-050); background:#fff; }
.topsearch svg{ width:18px; height:18px; color:var(--faint); flex:none; }
.topsearch input{ border:0; background:none; outline:none; width:100%; font-size:14px; }

/* User menu */
.user-menu{ position:relative; }
.user-btn{
  display:flex; align-items:center; gap:10px; background:none; border:1px solid transparent;
  padding:5px 8px 5px 5px; border-radius:var(--r-pill);
}
.user-btn:hover{ background:var(--surface-2); border-color:var(--line); }
.avatar{
  width:38px; height:38px; border-radius:50%; flex:none; display:grid; place-items:center;
  background:linear-gradient(140deg,var(--red),#9c0020); color:#fff; font-weight:800; font-size:15px;
}
.avatar.lg{ width:46px; height:46px; font-size:18px; }
.user-meta{ display:flex; flex-direction:column; line-height:1.15; text-align:left; }
.user-name{ font-weight:700; font-size:13.5px; }
.user-role{ font-size:11.5px; color:var(--muted); }
.chev{ width:16px; height:16px; color:var(--faint); }
.dropdown{
  position:absolute; right:0; top:calc(100% + 10px); width:250px; z-index:70;
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  box-shadow:var(--sh-lg); overflow:hidden; padding:6px;
}
.dd-head{ display:flex; gap:12px; align-items:center; padding:12px 10px; border-bottom:1px solid var(--line-2); margin-bottom:6px; }
.dd-name{ font-weight:700; }
.dd-sub{ font-size:12px; color:var(--muted); }
.dd-item{
  display:flex; align-items:center; gap:11px; padding:11px 10px; border-radius:9px; font-weight:600; font-size:13.5px; color:var(--ink-2);
}
.dd-item svg{ width:19px; height:19px; color:var(--faint); }
.dd-item:hover{ background:var(--surface-2); }
.dd-item.danger{ color:var(--red); } .dd-item.danger svg{ color:var(--red); }

/* ===================== CONTENT ===================== */
.content{ flex:1; padding:26px 26px 40px; max-width:1340px; width:100%; }

/* Toast / flash */
.toast{
  display:flex; align-items:center; gap:12px; padding:13px 16px; border-radius:13px;
  margin-bottom:16px; font-weight:600; font-size:14px; border:1px solid; animation:pop .28s ease;
}
.toast-ic{ display:grid; place-items:center; } .toast-ic svg{ width:20px; height:20px; }
.toast-x{ margin-left:auto; background:none; border:0; font-size:20px; line-height:1; opacity:.5; color:inherit; }
.toast-x:hover{ opacity:1; }
.toast-success{ background:var(--ok-bg); border-color:#B7E7CF; color:#0A6B4A; }
.toast-error{ background:var(--danger-bg); border-color:#F4C4C4; color:#A31818; }
.toast-warning{ background:var(--warn-bg); border-color:#F3D8A6; color:#9A5B00; }
.toast-info{ background:var(--blue-050); border-color:#C3D6F7; color:var(--blue-700); }
@keyframes pop{ from{ opacity:0; transform:translateY(-6px);} to{opacity:1;transform:none;} }

/* ===================== CARDS ===================== */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--sh-sm); }
.card-pad{ padding:20px; }
.card-head{
  display:flex; align-items:center; gap:12px; padding:16px 20px; border-bottom:1px solid var(--line-2);
}
.card-head h3{ font-size:15.5px; }
.card-head .sub{ font-size:12.5px; color:var(--muted); font-weight:500; }
.card-head .spacer{ flex:1; }

/* Section title */
.sec-title{ display:flex; align-items:center; gap:10px; margin:26px 0 14px; }
.sec-title:first-child{ margin-top:4px; }
.sec-title h2{ font-size:16px; }
.sec-title .line{ flex:1; height:1px; background:var(--line); }

/* ===================== KPI ===================== */
.kpi-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.kpi{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
  padding:18px; box-shadow:var(--sh-sm); position:relative; overflow:hidden;
}
.kpi::after{ content:""; position:absolute; right:-24px; top:-24px; width:90px; height:90px; border-radius:50%; opacity:.10; }
.kpi .k-ic{ width:44px; height:44px; border-radius:12px; display:grid; place-items:center; margin-bottom:12px; }
.kpi .k-ic svg{ width:23px; height:23px; }
.kpi .k-val{ font-size:26px; font-weight:800; letter-spacing:-.02em; line-height:1; }
.kpi .k-lbl{ font-size:12.5px; color:var(--muted); margin-top:5px; font-weight:600; }
.kpi.k-blue .k-ic{ background:var(--blue-050); color:var(--blue); } .kpi.k-blue::after{ background:var(--blue); }
.kpi.k-red  .k-ic{ background:var(--red-050); color:var(--red); }   .kpi.k-red::after{ background:var(--red); }
.kpi.k-green .k-ic{ background:var(--ok-bg); color:var(--ok); }      .kpi.k-green::after{ background:var(--ok); }
.kpi.k-amber .k-ic{ background:var(--warn-bg); color:var(--warn); }  .kpi.k-amber::after{ background:var(--warn); }
.kpi .k-foot{ font-size:11.5px; margin-top:9px; color:var(--faint); display:flex; align-items:center; gap:5px; }

/* ===================== BUTTONS ===================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:11px; font-weight:700; font-size:13.5px;
  border:1px solid transparent; transition:transform .05s, background .15s, box-shadow .15s, border-color .15s;
  white-space:nowrap; line-height:1;
}
.btn svg{ width:18px; height:18px; }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--red); color:#fff; box-shadow:0 4px 12px rgba(228,0,43,.24); }
.btn-primary:hover{ background:var(--red-600); }
.btn-blue{ background:var(--blue); color:#fff; box-shadow:0 4px 12px rgba(0,61,165,.22); }
.btn-blue:hover{ background:var(--blue-700); }
.btn-ghost{ background:var(--surface); border-color:var(--line); color:var(--ink-2); }
.btn-ghost:hover{ background:var(--surface-2); border-color:#D2DAE6; }
.btn-danger{ background:var(--danger-bg); color:var(--danger); border-color:#F2C9C9; }
.btn-danger:hover{ background:#F9DDDD; }
.btn-sm{ padding:7px 12px; font-size:12.5px; border-radius:9px; } .btn-sm svg{ width:16px; height:16px; }
.btn-lg{ padding:13px 22px; font-size:15px; border-radius:13px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

/* Icon-only action button */
.act{
  width:34px; height:34px; border:1px solid var(--line); background:var(--surface);
  border-radius:9px; display:inline-grid; place-items:center; color:var(--ink-2);
}
.act svg{ width:17px; height:17px; }
.act:hover{ background:var(--surface-2); border-color:#D2DAE6; }
.act.danger:hover{ background:var(--danger-bg); border-color:#F2C9C9; color:var(--danger); }
.act.blue:hover{ background:var(--blue-050); border-color:#C3D6F7; color:var(--blue); }

/* ===================== BADGES / CHIPS ===================== */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:var(--r-pill); font-size:11.5px; font-weight:700; line-height:1; }
.badge::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-ok{ background:var(--ok-bg); color:#0A7D57; }
.badge-warn{ background:var(--warn-bg); color:#A5670A; }
.badge-danger{ background:var(--danger-bg); color:#C11B1B; }
.badge-blue{ background:var(--blue-050); color:var(--blue-700); }
.badge-plain{ background:var(--surface-2); color:var(--ink-2); border:1px solid var(--line); } .badge-plain::before{ display:none; }

.chip{
  display:inline-flex; align-items:center; gap:7px; padding:6px 12px; border-radius:var(--r-pill);
  background:var(--surface); border:1px solid var(--line); font-size:13px; font-weight:600; color:var(--ink-2);
}
.chip svg{ width:16px; height:16px; color:var(--blue); }
.chip.on{ background:var(--blue); color:#fff; border-color:var(--blue); }
.chip.on svg{ color:#fff; }

.pill{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; padding:4px 10px; border-radius:var(--r-pill); }
.pill-in{ background:var(--ok-bg); color:#0A7D57; }
.pill-out{ background:var(--red-050); color:var(--red-600); }
.pill-adjust{ background:var(--blue-050); color:var(--blue-700); }

/* ===================== TOOLBAR ===================== */
.toolbar{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.toolbar .grow{ flex:1; }
.filterbar{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.search-inline{
  display:flex; align-items:center; gap:9px; background:var(--surface); border:1px solid var(--line);
  border-radius:11px; padding:9px 13px; min-width:220px; flex:1; max-width:360px;
}
.search-inline svg{ width:18px; height:18px; color:var(--faint); flex:none; }
.search-inline input{ border:0; background:none; outline:none; width:100%; }
.select{
  appearance:none; background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A90' stroke-width='2.2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
  border:1px solid var(--line); border-radius:11px; padding:9px 36px 9px 13px; font-weight:600; color:var(--ink-2); cursor:pointer;
}
.select:focus{ outline:none; border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-050); }

/* ===================== TABLE ===================== */
.table-wrap{ overflow-x:auto; border-radius:var(--r); }
table.tbl{ width:100%; border-collapse:collapse; font-size:13.7px; }
.tbl thead th{
  text-align:left; padding:12px 16px; font-size:11.5px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--muted); font-weight:700; background:var(--surface-2); border-bottom:1px solid var(--line); white-space:nowrap;
}
.tbl tbody td{ padding:13px 16px; border-bottom:1px solid var(--line-2); vertical-align:middle; }
.tbl tbody tr:last-child td{ border-bottom:0; }
.tbl tbody tr:hover{ background:var(--surface-2); }
.tbl .r{ text-align:right; } .tbl .c{ text-align:center; }
.tbl .strong{ font-weight:700; color:var(--ink); }
.cell-main{ display:flex; align-items:center; gap:12px; }
.thumb{
  width:42px; height:42px; border-radius:10px; flex:none; overflow:hidden; background:var(--surface-2);
  border:1px solid var(--line); display:grid; place-items:center; color:var(--faint);
}
.thumb img{ width:100%; height:100%; object-fit:cover; }
.thumb svg{ width:20px; height:20px; }
.cell-name{ font-weight:700; color:var(--ink); line-height:1.25; }
.cell-sku{ font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; }
.qty-cell{ font-weight:800; font-variant-numeric:tabular-nums; }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }

/* progress bar (stok vs min) */
.bar{ height:6px; border-radius:6px; background:var(--line); overflow:hidden; min-width:70px; }
.bar > i{ display:block; height:100%; border-radius:6px; }
.bar-ok > i{ background:var(--ok); } .bar-low > i{ background:var(--warn); } .bar-out > i{ background:var(--danger); }

/* ===================== FORMS ===================== */
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:18px 20px; }
.field{ display:flex; flex-direction:column; gap:7px; }
.field.col-2{ grid-column:span 2; }
.field label{ font-size:13px; font-weight:700; color:var(--ink-2); }
.field .hint{ font-size:11.5px; color:var(--faint); font-weight:500; }
.req{ color:var(--red); }
.input, .textarea, select.input{
  width:100%; padding:11px 13px; border:1px solid var(--line); border-radius:11px;
  background:var(--surface); font-size:14px; transition:border-color .15s, box-shadow .15s;
}
select.input{ appearance:none;
  background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A90' stroke-width='2.2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
  padding-right:38px; cursor:pointer;
}
.textarea{ min-height:96px; resize:vertical; }
.input:focus, .textarea:focus, select.input:focus{ outline:none; border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-050); }
.input.err{ border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-bg); }
.err-msg{ font-size:12px; color:var(--danger); font-weight:600; }
.input-group{ display:flex; }
.input-group .input{ border-radius:11px 0 0 11px; }
.input-group .suffix{ display:grid; place-items:center; padding:0 14px; border:1px solid var(--line); border-left:0; border-radius:0 11px 11px 0; background:var(--surface-2); color:var(--muted); font-weight:700; font-size:13px; }
.form-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:22px; padding-top:18px; border-top:1px solid var(--line-2); }

/* file upload */
.uploader{ display:flex; gap:16px; align-items:center; }
.upl-prev{ width:88px; height:88px; border-radius:14px; border:1px dashed var(--line); background:var(--surface-2); display:grid; place-items:center; overflow:hidden; color:var(--faint); flex:none; }
.upl-prev img{ width:100%; height:100%; object-fit:cover; }
.upl-prev svg{ width:26px; height:26px; }

/* ===================== EMPTY STATE ===================== */
.empty{ text-align:center; padding:56px 24px; }
.empty-ic{ width:74px; height:74px; margin:0 auto 16px; border-radius:20px; background:var(--blue-050); color:var(--blue); display:grid; place-items:center; }
.empty-ic svg{ width:34px; height:34px; }
.empty h2{ font-size:18px; margin-bottom:6px; } .empty h3{ font-size:16px; margin-bottom:6px; }
.empty p{ color:var(--muted); max-width:420px; margin:0 auto 18px; }

/* ===================== BOTTOM NAV (mobile) ===================== */
.bottomnav{ display:none; }

/* ===================== LOGIN ===================== */
.login-wrap{ min-height:100vh; min-height:100dvh; display:grid; grid-template-columns:1.05fr 1fr; }
.login-hero{
  position:relative; overflow:hidden; color:#EAF1FE; padding:52px 56px; display:flex; flex-direction:column;
  background:linear-gradient(160deg,#00337F 0%, var(--blue-900) 60%, #001330 100%);
}
.login-hero .hero-logo{ background:#fff; border-radius:16px; padding:16px 20px; width:min(300px,70%); box-shadow:0 10px 34px rgba(0,10,40,.35); }
.login-hero .hero-logo img{ width:100%; height:auto; }
.hero-body{ margin:auto 0; max-width:440px; }
.hero-body h1{ color:#fff; font-size:34px; line-height:1.1; letter-spacing:-.02em; }
.hero-body p{ color:rgba(210,224,250,.82); font-size:15.5px; margin-top:14px; }
.hero-feats{ margin-top:28px; display:flex; flex-direction:column; gap:12px; }
.hf{ display:flex; align-items:center; gap:12px; font-weight:600; font-size:14.5px; color:#D6E2FA; }
.hf .hf-ic{ width:36px; height:36px; border-radius:10px; background:rgba(255,255,255,.12); display:grid; place-items:center; color:#fff; flex:none; }
.hf .hf-ic svg{ width:19px; height:19px; }
.hero-waves{ position:absolute; inset:auto 0 0 0; width:100%; height:120px; }
.hero-foot{ position:relative; z-index:2; font-size:12.5px; color:rgba(190,208,244,.6); }

.login-panel{ display:grid; place-items:center; padding:40px 28px; background:var(--surface); }
.login-card{ width:100%; max-width:392px; }
.login-card .lc-badge{ display:none; }
.login-card h2{ font-size:24px; }
.login-card .lc-sub{ color:var(--muted); margin:6px 0 26px; }
.login-card .field{ margin-bottom:16px; }
.demo-note{
  margin-top:22px; padding:14px 16px; border-radius:13px; background:var(--surface-2); border:1px solid var(--line); font-size:12.7px; color:var(--ink-2);
}
.demo-note b{ color:var(--ink); }
.demo-note code{ background:#fff; border:1px solid var(--line); border-radius:6px; padding:1px 6px; font-size:12px; }
.demo-row{ display:flex; justify-content:space-between; padding:3px 0; }

/* ===================== DETAIL PAGE ===================== */
.detail-grid{ display:grid; grid-template-columns:340px 1fr; gap:22px; align-items:start; }
.pv-media{ width:100%; aspect-ratio:4/3; border-radius:14px; overflow:hidden; background:var(--surface-2); border:1px solid var(--line); display:grid; place-items:center; color:var(--faint); }
.pv-media img{ width:100%; height:100%; object-fit:cover; }
.pv-media svg{ width:56px; height:56px; }
.kv{ display:grid; grid-template-columns:130px 1fr; gap:11px 14px; }
.kv dt{ color:var(--muted); font-size:13px; font-weight:600; }
.kv dd{ margin:0; font-weight:600; }
.big-stock{ display:flex; align-items:baseline; gap:8px; }
.big-stock b{ font-size:38px; font-weight:800; letter-spacing:-.02em; }
.stat-row{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.mini{ background:var(--surface-2); border:1px solid var(--line); border-radius:12px; padding:14px; }
.mini .m-l{ font-size:11.5px; color:var(--muted); font-weight:600; }
.mini .m-v{ font-size:18px; font-weight:800; margin-top:3px; }

/* ===================== CHART (CSS bars) ===================== */
.barchart{ display:flex; flex-direction:column; gap:13px; }
.bc-row{ display:grid; grid-template-columns:120px 1fr auto; align-items:center; gap:14px; }
.bc-lbl{ font-size:13px; font-weight:600; color:var(--ink-2); display:flex; align-items:center; gap:8px; }
.bc-lbl .dot{ width:9px; height:9px; border-radius:3px; flex:none; }
.bc-track{ height:12px; border-radius:8px; background:var(--line-2); overflow:hidden; }
.bc-fill{ height:100%; border-radius:8px; transition:width .6s cubic-bezier(.2,.8,.2,1); }
.bc-val{ font-size:12.5px; font-weight:700; color:var(--muted); font-variant-numeric:tabular-nums; min-width:52px; text-align:right; }

/* movement timeline */
.mov-list{ display:flex; flex-direction:column; }
.mov{ display:flex; gap:13px; padding:13px 0; border-bottom:1px solid var(--line-2); }
.mov:last-child{ border-bottom:0; }
.mov-ic{ width:38px; height:38px; border-radius:11px; flex:none; display:grid; place-items:center; }
.mov-ic svg{ width:18px; height:18px; }
.mov-ic.in{ background:var(--ok-bg); color:var(--ok); }
.mov-ic.out{ background:var(--red-050); color:var(--red); }
.mov-ic.adjust{ background:var(--blue-050); color:var(--blue); }
.mov-main{ flex:1; min-width:0; }
.mov-title{ font-weight:700; font-size:14px; }
.mov-meta{ font-size:12px; color:var(--muted); margin-top:2px; }
.mov-qty{ font-weight:800; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* ===================== LABEL PRINT ===================== */
.label-sheet{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.lbl{
  border:1.5px dashed #c9d2df; border-radius:12px; padding:14px 16px; display:flex; gap:14px; align-items:center; background:#fff;
}
.lbl .qr{ width:96px; height:96px; flex:none; display:grid; place-items:center; }
.lbl .qr canvas,.lbl .qr img{ width:96px !important; height:96px !important; }
.lbl-info{ min-width:0; }
.lbl-info .l-sku{ font-weight:800; font-size:17px; font-variant-numeric:tabular-nums; }
.lbl-info .l-name{ font-weight:600; font-size:13px; margin:2px 0; line-height:1.25; }
.lbl-info .l-loc{ font-size:12px; color:#555; }
.lbl-brand{ font-size:10px; color:#7a8699; margin-top:4px; letter-spacing:.04em; }

/* ===================== UTILITIES ===================== */
.grid{ display:grid; gap:16px; }
.g-2{ grid-template-columns:repeat(2,1fr); }
.g-3{ grid-template-columns:repeat(3,1fr); }
.split-2{ display:grid; grid-template-columns:1.6fr 1fr; gap:18px; align-items:start; }
.flex{ display:flex; } .items-center{ align-items:center; } .gap-8{ gap:8px; } .gap-12{ gap:12px; }
.between{ justify-content:space-between; } .wrap{ flex-wrap:wrap; }
.mt-0{margin-top:0}.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-0{margin-bottom:0}.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}
.muted{ color:var(--muted); } .small{ font-size:12.5px; } .strong{ font-weight:700; }
.text-red{ color:var(--red); } .text-blue{ color:var(--blue); } .text-ok{ color:var(--ok); }
.nowrap{ white-space:nowrap; }
.hide{ display:none !important; }
.divider{ height:1px; background:var(--line); margin:18px 0; }
.back-link{ display:inline-flex; align-items:center; gap:6px; color:var(--muted); font-weight:600; font-size:13px; margin-bottom:12px; }
.back-link:hover{ color:var(--blue); } .back-link svg{ width:16px; height:16px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width:1180px){
  .kpi-grid{ grid-template-columns:repeat(2,1fr); }
  .split-2{ grid-template-columns:1fr; }
  .detail-grid{ grid-template-columns:1fr; }
}
@media (max-width:1024px){
  :root{ --tb:60px; }
  .main-wrap{ margin-left:0; }
  .sidebar{ transform:translateX(-100%); transition:transform .26s cubic-bezier(.3,.8,.3,1); }
  .sidebar.open{ transform:none; }
  .drawer-close{ display:grid; width:38px; height:38px; place-items:center; background:rgba(255,255,255,.1); border:0; border-radius:10px; color:#fff; }
  .icon-btn{ display:grid; }
  .content{ padding:20px 16px 96px; }
  .bottomnav{
    display:flex; position:fixed; inset:auto 0 0 0; z-index:50; height:64px;
    background:rgba(255,255,255,.92); backdrop-filter:saturate(1.4) blur(12px);
    border-top:1px solid var(--line); padding:6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bn-item{
    flex:1; background:none; border:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
    color:var(--muted); font-size:10.5px; font-weight:700; border-radius:12px; padding:4px 0;
  }
  .bn-ic{ width:24px; height:24px; display:grid; place-items:center; } .bn-ic svg{ width:22px; height:22px; }
  .bn-item.active{ color:var(--red); }
  .bn-item.active .bn-ic{ background:var(--red-050); border-radius:10px; }
}
@media (max-width:720px){
  .topsearch{ display:none; }
  .page-title{ font-size:17px; } .page-sub{ display:none; }
  .form-grid{ grid-template-columns:1fr; }
  .field.col-2{ grid-column:auto; }
  .g-2,.g-3{ grid-template-columns:1fr; }
  .stat-row{ grid-template-columns:repeat(3,1fr); }
  .label-sheet{ grid-template-columns:1fr; }
  .bc-row{ grid-template-columns:96px 1fr auto; gap:10px; }

  /* Tabel jadi kartu */
  table.responsive thead{ display:none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td{ display:block; width:100%; }
  table.responsive tr{
    background:var(--surface); border:1px solid var(--line); border-radius:14px; margin-bottom:12px; padding:6px 4px; box-shadow:var(--sh-sm);
  }
  table.responsive tr:hover{ background:var(--surface); }
  table.responsive td{ border:0 !important; padding:8px 14px; display:flex; justify-content:space-between; align-items:center; gap:12px; }
  table.responsive td::before{
    content:attr(data-label); font-size:11.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; flex:none;
  }
  table.responsive td.cell-primary{ padding-top:12px; }
  table.responsive td.cell-primary::before{ display:none; }
  table.responsive td.cell-primary .cell-main{ width:100%; }
  table.responsive td.row-actions-td{ justify-content:flex-end; }
  table.responsive td.row-actions-td::before{ display:none; }
  .row-actions{ width:100%; justify-content:flex-end; }
}
@media (max-width:560px){
  .login-wrap{ grid-template-columns:1fr; }
  .login-hero{ display:none; }
  .login-card .lc-badge{ display:flex; justify-content:center; margin-bottom:20px; }
  .login-card .lc-badge img{ width:210px; height:auto; }
  .user-meta{ display:none; }
  .user-btn{ padding:4px; } .chev{ display:none; }
  .kpi .k-val{ font-size:23px; }
  .toolbar{ gap:9px; } .search-inline{ max-width:none; }
}

@media print{
  .sidebar,.topbar,.bottomnav,.no-print,.toolbar,.scrim{ display:none !important; }
  .main-wrap{ margin:0; }
  .content{ padding:0; max-width:none; }
  body{ background:#fff; }
  .card{ box-shadow:none; border:1px solid #ccc; }
  .lbl{ break-inside:avoid; }
  @page{ margin:12mm; }
}

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* ============================================================
   v3.0 — modul baru (transfer, peminjaman, permintaan, opname,
   kartu stok, form publik, berita acara)
   ============================================================ */

/* --- util --- */
.t-right{ text-align:right !important; }
.t-center{ text-align:center !important; }
.mono{ font-family:"SF Mono",ui-monospace,Menlo,Consolas,monospace; font-size:.93em; letter-spacing:.01em; }
.hide{ display:none !important; }
.gap{ gap:16px; }
.m12{ margin:12px; } .mt4{ margin-top:4px; } .mt8{ margin-top:8px; } .mt12{ margin-top:12px; }
.mt16{ margin-top:16px; } .mb8{ margin-bottom:8px; }
.text-warn{ color:var(--warn); } .text-danger{ color:var(--red); }
.inline{ display:inline; }
.link{ color:var(--blue); font-weight:700; text-decoration:none; }
.link:hover{ text-decoration:underline; }
.pad{ padding:18px 20px; }
.btn-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.actions{ display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }
.actions form{ display:inline; }
.input-sm{ padding:8px 10px !important; font-size:13px !important; border-radius:9px !important; }
.head-inline{ display:flex; align-items:center; gap:8px; }
.page-actions{ display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; margin:-6px 0 16px; }
.page-actions .btn svg{ width:17px; height:17px; }

/* --- tabel alias .table (samakan dgn .tbl) --- */
table.table{ width:100%; border-collapse:collapse; font-size:13.7px; }
.table thead th{ text-align:left; font-size:12px; letter-spacing:.04em; text-transform:uppercase;
  color:var(--muted); font-weight:800; padding:11px 16px; border-bottom:1px solid var(--line);
  background:var(--surface-2); white-space:nowrap; }
.table tbody td{ padding:12px 16px; border-bottom:1px solid var(--line-2); vertical-align:middle; }
.table tbody tr:last-child td{ border-bottom:0; }
.table tbody tr:hover{ background:var(--surface-2); }
.table-tight tbody td{ padding:8px 12px; }
.table-tight thead th{ padding:9px 12px; }
.empty-cell{ text-align:center; color:var(--muted); padding:26px 16px !important; }
.row-open td{ background:var(--surface-2); font-size:12.8px; }

/* --- alert box --- */
.alert{ display:flex; gap:12px; align-items:flex-start; padding:13px 16px; border-radius:var(--r-sm);
  border:1px solid var(--line); background:var(--surface-2); margin-bottom:16px; font-size:13.6px; font-weight:600; }
.alert svg{ width:20px; height:20px; flex:none; margin-top:1px; }
.alert-danger{ background:var(--danger-bg); border-color:#F4C4C4; color:#A31818; }
.alert-success{ background:var(--ok-bg); border-color:#B7E7CF; color:#0A6B4A; }
.alert-warning{ background:var(--warn-bg); border-color:#F3D8A6; color:#9A5B00; }
.alert-info{ background:var(--blue-050); border-color:#C3D6F7; color:var(--blue-700); }

/* --- grid layout --- */
.grid{ display:grid; gap:16px; }
.grid-2{ grid-template-columns:1fr 1fr; }
.grid-3-1{ grid-template-columns:2.2fr 1fr; align-items:start; }
@media (max-width:960px){ .grid-2,.grid-3-1{ grid-template-columns:1fr; } }

/* --- definition list --- */
.dl{ display:grid; gap:10px; }
.dl > div{ display:grid; grid-template-columns:150px 1fr; gap:10px; align-items:baseline;
  padding-bottom:10px; border-bottom:1px dashed var(--line-2); }
.dl > div:last-child{ border-bottom:0; padding-bottom:0; }
.dl span:first-child{ color:var(--muted); font-size:12.6px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; }
@media (max-width:560px){ .dl > div{ grid-template-columns:1fr; gap:2px; } }

/* --- strip info --- */
.info-strip{ display:flex; gap:12px; align-items:flex-start; font-size:13.5px; }
.info-strip svg{ width:22px; height:22px; color:var(--blue); flex:none; }

/* --- filter chips + toolbar --- */
.filter-chips{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.toolbar .filter-chips{ margin-bottom:0; }
.chip-n{ display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 6px;
  border-radius:999px; background:rgba(0,0,0,.08); font-size:11.5px; font-weight:800; }
.chip.on .chip-n{ background:rgba(255,255,255,.25); }
.filter-bar{ display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; align-items:end; margin-bottom:16px; }
.filter-bar .field{ margin:0; }
.field-btn{ display:flex; }
.field-btn .btn{ width:100%; }

/* --- langkah persetujuan --- */
.approve-steps{ display:grid; gap:12px; }
.step{ display:flex; gap:12px; align-items:flex-start; padding:12px; border:1px solid var(--line);
  border-radius:var(--r-sm); background:var(--surface-2); }
.step-dot{ width:30px; height:30px; border-radius:999px; display:grid; place-items:center;
  background:var(--line); color:var(--muted); font-weight:800; flex:none; }
.step.done{ border-color:#B7E7CF; background:var(--ok-bg); }
.step.done .step-dot{ background:var(--ok); color:#fff; }
.step.fail{ border-color:#F4C4C4; background:var(--danger-bg); }
.step.fail .step-dot{ background:var(--red); color:#fff; }

/* --- tombol tambahan --- */
.btn-danger-ghost{ background:transparent; color:var(--red); border:1.5px solid #F4C4C4; }
.btn-danger-ghost:hover{ background:var(--danger-bg); }

/* --- mini stats (peminjaman) --- */
.mini-stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.mini-stats .mini{ background:var(--surface-2); border:1px solid var(--line-2); border-radius:var(--r-sm);
  padding:12px; text-align:center; display:block; }
.mini-stats .mini-n{ display:block; font-size:22px; font-weight:800; color:var(--ink); font-variant-numeric:tabular-nums; }
.mini-stats .mini-l{ display:block; font-size:11.5px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:.04em; margin-top:2px; }

/* --- link cell (departemen) --- */
.link-cell{ display:flex; gap:6px; align-items:center; min-width:230px; }
.link-cell .input{ font-size:11.5px; padding:7px 9px; }

/* --- checkbox label --- */
.check{ display:flex; gap:9px; align-items:flex-start; font-size:13.6px; font-weight:600; cursor:pointer; }
.check input{ width:17px; height:17px; accent-color:var(--blue); margin-top:1px; flex:none; }

/* --- daftar langkah (settings) --- */
.steps-list{ margin:0; padding-left:20px; display:grid; gap:8px; font-size:13.6px; }

/* --- kartu stok --- */
.kartu-block{ margin-bottom:18px; }
.kartu-head{ align-items:flex-start; }
.kartu-head h3{ font-size:15px; }
.kartu-saldo{ display:flex; gap:22px; text-align:right; }
.kartu-saldo strong{ display:block; font-size:18px; font-variant-numeric:tabular-nums; }
.text-blue{ color:var(--blue); }

/* --- honeypot --- */
.hp-field{ position:absolute !important; left:-9999px !important; width:1px; height:1px; opacity:0; }

/* --- halaman publik (req.php) --- */
.public-body{ background:linear-gradient(180deg,var(--blue-050),var(--bg) 320px); min-height:100vh;
  font-family:var(--font); color:var(--ink); -webkit-font-smoothing:antialiased; }
.public-wrap{ max-width:680px; margin:0 auto; padding:28px 16px 40px; }
.public-head{ text-align:center; margin-bottom:20px; }
.public-logo{ width:180px; height:auto; }
.public-sub{ color:var(--muted); font-size:13px; font-weight:600; margin-top:6px; }
.public-foot{ text-align:center; font-size:12px; margin-top:22px; }
.public-wrap .card{ margin-bottom:14px; }
.public-wrap h2{ font-size:20px; margin:10px 0 6px; }
.public-wrap .table thead th{ padding:9px 10px; }
.public-wrap .table tbody td{ padding:8px 10px; }
.success-mark{ width:64px; height:64px; margin:6px auto 4px; border-radius:999px; background:var(--ok);
  color:#fff; font-size:34px; font-weight:800; display:grid; place-items:center; }
.req-code{ display:inline-block; margin:6px auto 10px; padding:10px 18px; border-radius:12px;
  background:var(--blue-050); color:var(--blue-700); font-size:20px; font-weight:800; letter-spacing:.04em; }

/* --- Berita Acara --- */
.ba-doc{ padding:34px 40px; }
.ba-kop{ display:flex; align-items:center; gap:14px; padding-bottom:14px; margin-bottom:16px;
  border-bottom:3px double var(--ink); }
.ba-logo{ width:150px; height:auto; }
.ba-kop-txt{ margin-left:auto; text-align:right; display:grid; }
.ba-kop-txt strong{ font-size:14.5px; }
.ba-kop-txt span{ font-size:12px; color:var(--muted); }
.ba-title{ text-align:center; margin:6px 0 16px; }
.ba-title h2{ font-size:17px; letter-spacing:.06em; text-decoration:underline; text-underline-offset:4px; }
.ba-title .mono{ margin-top:4px; color:var(--muted); }
.ba-info{ margin:0 0 14px; font-size:13.6px; }
.ba-info td{ padding:3px 8px 3px 0; vertical-align:top; }
.ba-info td:first-child{ width:150px; font-weight:700; }
.ba-narrative{ font-size:13.8px; line-height:1.85; text-align:justify; white-space:normal; }
.table-print{ font-size:12.6px; margin-top:8px; }
.table-print th,.table-print td{ border:1px solid var(--line) !important; padding:7px 10px !important; }
.table-print thead th{ background:var(--surface-2); }
.ba-sign{ display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-top:34px; text-align:center; font-size:13.5px; }
.ba-sign > div{ display:grid; justify-items:center; gap:2px; }
.ba-sign-space{ height:64px; }
@media (max-width:640px){ .ba-doc{ padding:20px 16px; } }

/* --- judul khusus cetak --- */
.print-title{ display:none; }

/* --- print v3 --- */
@media print{
  .page-actions,.filter-bar,.filter-chips,.bottomnav,.search-inline{ display:none !important; }
  .print-title{ display:block; font-size:15px; margin-bottom:12px; }
  .kartu-block{ break-inside:avoid; box-shadow:none; }
  .ba-doc{ border:0 !important; box-shadow:none !important; padding:0 !important; }
  .ba-narrative{ font-size:12.5pt; }
  .table-print th,.table-print td{ border-color:#999 !important; }
  a.link{ color:#000; text-decoration:none; }
}

/* ============ v3.1 — Full AI Suite ============ */
.ai-box{ border:1.5px solid #C3D6F7; background:linear-gradient(180deg,#F4F8FF,#fff); }
.ai-box .card-head h3 svg{ width:18px; height:18px; color:var(--blue); vertical-align:-3px; }
.ai-narrative{ font-size:13.9px; line-height:1.8; }
.ai-btn svg{ width:15px; height:15px; }
.ai-btn{ border-color:#C3D6F7 !important; color:var(--blue-700); }

.chat-card{ display:flex; flex-direction:column; min-height:520px; }
.chat-box{ flex:1; overflow-y:auto; max-height:56vh; padding:20px; display:flex; flex-direction:column; gap:12px; }
.chat-empty{ text-align:center; margin:auto; padding:20px 0; }
.chat-hello{ width:54px; height:54px; margin:0 auto 8px; border-radius:16px; background:var(--blue-050);
  display:grid; place-items:center; }
.chat-hello svg{ width:28px; height:28px; color:var(--blue); }
.bubble-row{ display:flex; gap:10px; align-items:flex-end; }
.bubble-row.me{ justify-content:flex-end; }
.bubble-avatar{ width:30px; height:30px; border-radius:10px; background:var(--blue); color:#fff;
  display:grid; place-items:center; flex:none; }
.bubble-avatar svg{ width:16px; height:16px; }
.bubble{ max-width:72%; padding:11px 14px; border-radius:16px; font-size:13.8px; line-height:1.65; }
.b-ai{ background:var(--surface-2); border:1px solid var(--line-2); border-bottom-left-radius:4px; }
.b-me{ background:var(--blue); color:#fff; border-bottom-right-radius:4px; }
.b-err{ background:var(--danger-bg); border-color:#F4C4C4; color:#A31818; }
.chat-quick{ display:flex; gap:8px; flex-wrap:wrap; padding:12px 20px; border-top:1px solid var(--line-2); }
.chat-quick .chip{ cursor:pointer; }
.chat-quick .chip[disabled]{ opacity:.5; cursor:not-allowed; }
.chat-input{ display:flex; gap:10px; padding:14px 20px; border-top:1px solid var(--line-2); background:var(--surface-2); border-radius:0 0 var(--r) var(--r); }
.chat-input .input{ flex:1; }
@media (max-width:640px){ .bubble{ max-width:86%; } .chat-box{ max-height:50vh; } }
