/* ═══════════════════════════════════════════════════════════════════
   app.css — Accurate Invoice Manager · design system tunggal
   Tema disamakan dengan GFI ERP (font, palet, tombol, kartu) — lihat juga
   bagian "TEMA GFI ERP" & "DI DALAM ERP" di akhir berkas.
   Ubah warna/ukuran lewat token.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 0. FONT (sama dengan GFI ERP, disimpan sendiri — tanpa CDN; lisensi OFL di fonts/) ── */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

/* ── 1. TOKENS (palet GFI ERP) ─────────────────────────────────────── */
:root {
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --bg: #F1F5FC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFF;
  --surface-3: #EDF2FC;
  --border: #E3EAF7;
  --border-strong: #CCD7EC;
  --text: #101A3D;
  --text-2: #4A5875;
  --text-3: #8492B0;

  --brand: #3565F0;
  --brand-2: #5B8BFF;
  --brand-hover: #2A55DB;
  --brand-soft: #E7EDFF;
  --brand-ring: rgba(53, 101, 240, .22);
  --brand-glow: 0 8px 22px -8px rgba(53, 101, 240, .55);
  --on-brand: #ffffff;
  --navy: #16225A;

  --ok: #11B981;       --ok-soft: #DCF6EC;     --ok-line: rgba(17, 185, 129, .35);
  --warn: #D98411;     --warn-soft: #FDF0DA;   --warn-line: rgba(217, 132, 17, .32);
  --danger: #EF4B5A;   --danger-soft: #FEE6E8; --danger-line: rgba(239, 75, 90, .3);
  --info: #169C95;     --info-soft: #DDF7F5;   --info-line: rgba(31, 200, 192, .35);
  --ppn: #C77A0A;      --ppn-soft: #FFF1DC;
  --non: #3565F0;      --non-soft: #E7EDFF;

  --r-xs: 5px; --r-sm: 8px; --r: 9px; --r-lg: 13px; --r-xl: 15px; --r-full: 999px;
  --sh-xs: 0 1px 2px rgba(23, 42, 102, .05);
  --sh-sm: 0 1px 2px rgba(23, 42, 102, .05), 0 6px 18px -10px rgba(23, 42, 102, .16);
  --sh: 0 2px 6px rgba(23, 42, 102, .07), 0 16px 34px -18px rgba(23, 42, 102, .32);
  --sh-lg: 0 6px 14px rgba(16, 26, 61, .12), 0 30px 60px -24px rgba(16, 26, 61, .5);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --appbar-h: 52px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #080F22;
  --surface: #101A35;
  --surface-2: #15213F;
  --surface-3: #1A2748;
  --border: #22304F;
  --border-strong: #2F3F63;
  --text: #EAF0FF;
  --text-2: #A8B7D4;
  --text-3: #7C8CAD;

  --brand: #5B8BFF;
  --brand-2: #7EA6FF;
  --brand-hover: #7EA6FF;
  --brand-soft: #16264F;
  --brand-ring: rgba(91, 139, 255, .3);
  --brand-glow: 0 8px 22px -8px rgba(91, 139, 255, .45);
  --on-brand: #ffffff;
  --navy: #1B2A63;

  --ok: #34D399;       --ok-soft: #0C3629;     --ok-line: rgba(52, 211, 153, .3);
  --warn: #E9A53C;     --warn-soft: #3A2A0C;   --warn-line: rgba(233, 165, 60, .3);
  --danger: #FF7078;   --danger-soft: #3E1519; --danger-line: rgba(255, 112, 120, .3);
  --info: #35D8CE;     --info-soft: #0D3A39;   --info-line: rgba(53, 216, 206, .3);
  --ppn: #FFB84D;      --ppn-soft: #3B2A0D;
  --non: #7EA6FF;      --non-soft: #16264F;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, .45);
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --sh: 0 2px 8px rgba(0, 0, 0, .5), 0 18px 36px -18px rgba(0, 0, 0, .8);
  --sh-lg: 0 6px 16px rgba(0, 0, 0, .55), 0 30px 60px -22px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

/* ── 2. RESET & BASE ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0; min-height: 100vh; max-width: 100%;
  overflow-x: hidden; overflow-x: clip;
  font-family: var(--font); font-size: 13px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
  animation: fadeIn .3s var(--ease);
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .92em; }
svg { flex-shrink: 0; }
.hidden { display: none !important; }
::selection { background: var(--brand-ring); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 999; background: var(--brand); color: var(--on-brand); padding: 6px 12px; border-radius: var(--r-sm); font-weight: 600; transition: top .2s; }
.skip-link:focus { top: 12px; }
.muted { color: var(--text-3); }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-danger { color: var(--danger); }

/* ── 3. APP BAR & NAV ──────────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 50; height: var(--appbar-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.appbar-inner { max-width: 1200px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; min-width: 0; }
.app-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 13.5px; color: var(--text); white-space: nowrap; min-width: 0; }
.app-brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(145deg, var(--navy), var(--brand)); color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 10.5px; font-weight: 500; color: var(--text-3); }

.nav { display: flex; align-items: center; gap: 2px; height: 100%; }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 100%;
  padding: 0 11px; font-weight: 500; font-size: 12.5px; color: var(--text-2); transition: color .2s;
}
.nav a::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--brand); transform: scaleX(0); transition: transform .3s var(--ease);
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--brand); font-weight: 600; }
.nav a.active::after { transform: scaleX(1); }

.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; min-width: 0;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  font-size: 11.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; max-width: 220px;
}
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.chip.role-admin, .chip.role-gudang { border: 0; background: none; padding: 0 4px; font-weight: 600; }
.chip.role-admin { color: var(--brand); }
.chip.role-gudang { color: var(--warn); }

.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; flex-shrink: 0;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: var(--danger-soft); color: var(--danger); }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

/* ── 4. PAGE LAYOUT ────────────────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; padding: 18px 20px 72px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head > div { min-width: 0; }
.page-title { font-size: 19px; font-weight: 700; }
.page-sub { color: var(--text-3); margin-top: 2px; font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.spacer { flex: 1; }

/* ── 5. CARD ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.card-head .title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-icon { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.card-title { font-size: 13.5px; font-weight: 650; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.card-body { padding: 14px; }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── 6. BUTTONS ────────────────────────────────────────────────────── */
.btn {
  --_bg: var(--surface); --_fg: var(--text); --_bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  font-weight: 600; font-size: 12.5px; white-space: nowrap; cursor: pointer; user-select: none; flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s, transform .1s var(--ease), box-shadow .15s;
}
.btn:hover { text-decoration: none; border-color: var(--text-3); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { --_bg: var(--brand); --_fg: var(--on-brand); --_bd: transparent; }
.btn-primary:hover { --_bg: var(--brand-hover); border-color: transparent; box-shadow: 0 4px 12px -4px var(--brand); }
.btn-success { --_bg: var(--ok); --_fg: #fff; --_bd: transparent; }
.btn-success:hover { border-color: transparent; filter: brightness(1.07); box-shadow: 0 4px 12px -4px var(--ok); }
:root[data-theme="dark"] .btn-success { --_fg: #04130d; }
.btn-danger { --_bg: var(--danger); --_fg: #fff; --_bd: transparent; }
.btn-danger:hover { border-color: transparent; filter: brightness(1.07); }
.btn-ghost { --_bg: transparent; --_bd: transparent; --_fg: var(--text-2); }
.btn-ghost:hover { --_bg: var(--surface-3); --_fg: var(--text); border-color: transparent; }
.btn-soft { --_bg: var(--brand-soft); --_fg: var(--brand); --_bd: transparent; }
.btn-soft:hover { border-color: var(--brand-ring); }
.btn-sm { height: 27px; padding: 0 9px; font-size: 12px; gap: 5px; border-radius: var(--r-sm); }
.btn-lg { height: 38px; padding: 0 16px; font-size: 13px; }
.btn-block { width: 100%; }

.spinner { width: 13px; height: 13px; border-radius: 50%; display: inline-block; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }

/* ── 7. FORM CONTROLS ──────────────────────────────────────────────── */
.input, .select {
  height: 32px; padding: 0 10px; border-radius: var(--r-sm); width: 100%; min-width: 0;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%237b8699' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option { background: var(--surface); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.search { position: relative; flex: 1 1 220px; min-width: 0; }
.search > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 31px; padding-right: 30px; }
.search .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); display: none; place-items: center; cursor: pointer; }
.search .clear:hover { background: var(--surface-3); color: var(--text); }
.search.has-value .clear { display: grid; }
input[type="date"].input { width: auto; }
input[type="number"].input { font-variant-numeric: tabular-nums; }

/* ── 8. BADGE (teks berwarna, tanpa latar) & ALERT ─────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; background: none;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--text-3); line-height: 1.4;
}
.badge.ppn { color: var(--ppn); } .badge.non { color: var(--non); }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); }
.badge.danger { color: var(--danger); } .badge.info { color: var(--info); }
.badge.brand { color: var(--brand); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pulse .dot { animation: pulse 1.6s ease-in-out infinite; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--border); border-left-width: 3px; background: var(--surface); font-size: 12.5px;
  animation: fadeUp .35s var(--ease) both;
}
.alert > svg { margin-top: 1px; }
.alert-title { font-weight: 650; }
.alert ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); }
.alert.ok { border-left-color: var(--ok); } .alert.ok > svg { color: var(--ok); }
.alert.warn { border-left-color: var(--warn); } .alert.warn > svg { color: var(--warn); }
.alert.danger { border-left-color: var(--danger); } .alert.danger > svg { color: var(--danger); }
.alert.info { border-left-color: var(--info); } .alert.info > svg { color: var(--info); }

/* ── 9. TOASTS ─────────────────────────────────────────────────────── */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; max-width: calc(100% - 32px); }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: 360px; padding: 9px 12px 9px 10px; border-radius: var(--r);
  background: #0f172a; color: #f1f5f9; box-shadow: var(--sh-lg); font-size: 12.5px; font-weight: 500; pointer-events: auto;
  animation: toastIn .3s var(--ease-spring) both;
}
.toast.out { animation: toastOut .22s var(--ease) forwards; }
.toast .t-ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff; background: var(--ok); }
.toast.fail .t-ic, .toast.danger .t-ic { background: var(--danger); }
.toast.dup .t-ic, .toast.warn .t-ic { background: var(--warn); }
.toast.info .t-ic { background: var(--info); }
:root[data-theme="dark"] .toast { background: #e8ebf2; color: #0b0e14; }

/* ── 10. KPI (juga filter) ─────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi {
  position: relative; text-align: left; min-width: 0; padding: 9px 12px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); transition: all .2s var(--ease); overflow: hidden;
}
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--sh); }
.kpi::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.kpi.active { border-color: var(--brand-ring); background: var(--brand-soft); }
.kpi.active::after { transform: scaleX(1); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.kpi-value { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin-top: 1px; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.sm { font-size: 15px; }
.kpi.warn .dot { background: var(--warn); } .kpi.ok .dot { background: var(--ok); }
.kpi.brand .dot { background: var(--brand); } .kpi.danger .dot { background: var(--danger); }
.kpi.info .dot { background: var(--info); }
.kpi.danger .kpi-value { color: var(--danger); }

/* ── 11. TOOLBAR & SEGMENTED ───────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; min-width: 0; }
.toolbar > .select { flex: 0 1 230px; }
.seg { scrollbar-width: none; display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.seg button { height: 28px; padding: 0 11px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: all .18s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--sh-sm); }
.seg button .count { font-size: 11px; color: var(--text-3); }
.seg button.active .count { color: var(--brand); }

/* ── 12. STEPPER ───────────────────────────────────────────────────── */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.step { position: relative; display: flex; align-items: center; gap: 9px; padding: 8px 10px; min-width: 0; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); transition: all .3s var(--ease); }
.step > div:last-child { min-width: 0; }
.step-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-3); transition: all .3s var(--ease); }
.step-label { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.active { border-color: var(--brand-ring); background: var(--brand-soft); }
.step.active .step-num { background: var(--brand); color: var(--on-brand); animation: popIn .4s var(--ease-spring); }
.step.done .step-num { background: var(--ok); color: #fff; }
.step.done .step-num .n { display: none; }
.step .step-num svg { display: none; }
.step.done .step-num svg { display: block; }

/* ── 13. CITY CHIPS ────────────────────────────────────────────────── */
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.city-chip {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 9px; min-width: 0;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; user-select: none; transition: all .18s var(--ease);
  animation: fadeUp .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 15ms);
}
.city-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.city-chip input { position: absolute; opacity: 0; pointer-events: none; }
.city-chip .box { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--border-strong); flex-shrink: 0; display: grid; place-items: center; color: transparent; transition: all .18s var(--ease); }
.city-chip .name { font-weight: 550; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-chip .warn-ic { margin-left: auto; color: var(--warn); }
.city-chip.selected { border-color: var(--brand); background: var(--brand-soft); }
.city-chip.selected .box { background: var(--brand); border-color: var(--brand); color: var(--on-brand); animation: popIn .25s var(--ease-spring); }
.city-chip input:focus-visible + .box { box-shadow: 0 0 0 3px var(--brand-ring); }
.selection-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding: 7px 10px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: 12px; color: var(--text-2); }

/* ── 14. TABLE ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); max-width: 100%; }
.table-wrap.allow-overflow { overflow: visible; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--surface-2); padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .empty-row td { text-align: center; color: var(--text-3); padding: 28px 12px; }
.cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ── 15. INVOICE PREVIEW (Generate) ────────────────────────────────── */
.inv-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.inv { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden; transition: border-color .25s, box-shadow .25s; animation: fadeUp .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.inv > summary { list-style: none; cursor: pointer; display: grid; align-items: center; gap: 12px; grid-template-columns: auto minmax(0, 1fr) auto auto auto; padding: 8px 12px; }
.inv > summary::-webkit-details-marker { display: none; }
.inv > summary:hover { background: var(--surface-2); }
.inv-idx { font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 24px; }
.inv-main { min-width: 0; }
.inv-city { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.inv-cust { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-chev { color: var(--text-3); transition: transform .25s var(--ease); }
.inv[open] .inv-chev { transform: rotate(180deg); }
.inv-body { padding: 0 12px 12px; animation: fadeIn .25s var(--ease); }
.inv.processing { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.inv.success { border-left: 3px solid var(--ok); }
.inv.error { border-left: 3px solid var(--danger); }
.inv-error { margin-top: 10px; padding: 9px 12px; border-radius: var(--r); border-left: 3px solid var(--danger); background: var(--surface-2); color: var(--danger); font-size: 12px; }
.inv-error pre { margin: 6px 0 0; font-size: 11px; white-space: pre-wrap; color: var(--text-2); }
.factor-tag { font-family: var(--mono); font-size: 11px; color: var(--brand); margin-left: 4px; font-weight: 600; }

/* ── 16. PROGRESS ──────────────────────────────────────────────────── */
.progress-float {
  position: fixed; left: 50%; bottom: 18px; z-index: 60; width: min(520px, calc(100% - 24px));
  padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--sh-lg); transform: translate(-50%, 140%); opacity: 0; transition: transform .45s var(--ease-spring), opacity .3s;
}
.progress-float.visible { transform: translate(-50%, 0); opacity: 1; }
.pf-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pf-pct { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--brand); font-weight: 700; }
.pf-sub { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.pf-sub b { color: var(--text); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar > i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #5b7ff0, var(--brand)); background-size: 200% 100%;
  animation: shimmerBar 1.6s linear infinite; transition: width .5s var(--ease);
}
.bar.ok > i { background: var(--ok); animation: growX .7s var(--ease) both; transform-origin: left; }
.bar.warn > i { background: var(--warn); animation: growX .7s var(--ease) both; transform-origin: left; }
.bar.sm { height: 4px; margin-top: 0; }

/* ── 17. DRAFTS: kelompok kota ─────────────────────────────────────── */
.groups { display: flex; flex-direction: column; gap: 8px; }
.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); overflow: hidden; min-width: 0; animation: fadeUp .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.group-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.group-pin { width: 22px; height: 22px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.group-info { min-width: 0; flex: 1; }
.group-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.group-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Ikon dokumen dengan label PPN / NON PPN */
.doc-ic { position: relative; width: 24px; height: 30px; padding: 0; border: 0; background: none; flex-shrink: 0; cursor: pointer; color: var(--non); transition: transform .25s var(--ease-spring); }
.doc-ic.ppn { color: var(--ppn); }
.doc-ic svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.doc-ic .doc-body { fill: var(--non-soft); stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.doc-ic.ppn .doc-body { fill: var(--ppn-soft); }
.doc-ic .doc-fold { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.doc-ic .lbl { position: absolute; left: 0; right: 0; top: 60%; transform: translateY(-50%); text-align: center; font-size: 6.5px; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.doc-ic .lbl.two { font-size: 5.2px; line-height: 1.1; }
.doc-ic:hover { transform: translateY(-2px) rotate(-3deg); }
.doc-ic:active { transform: scale(.94); }

/* PPN kiri, Non-PPN kanan — otomatis menumpuk bila layar sempit */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 6px; padding: 6px; }
.inv-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inv-tile {
  position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.inv-tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--non); }
.inv-tile.ppn::before { background: var(--ppn); }
.inv-tile:hover { border-color: var(--border-strong); box-shadow: var(--sh); transform: translateY(-1px); }
.inv-tile.empty-slot { align-items: center; justify-content: center; gap: 6px; min-height: 64px; flex-direction: row; border-style: dashed; background: transparent; color: var(--text-3); font-size: 12px; }
.inv-tile.empty-slot::before { display: none; }
.inv-tile.empty-slot:hover { box-shadow: none; transform: none; }

.tile-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px 4px 10px; }
.tile-title { min-width: 0; }
.tile-id-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tile-id-row .badge { font-size: 11px; }
.tile-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.draft-id { font-family: var(--mono); font-weight: 700; font-size: 12px; color: var(--text); padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-id:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.tile-actions { display: flex; align-items: center; gap: 2px; }
.tile-body { display: flex; flex-direction: column; gap: 3px; padding: 0 10px 7px 10px; min-width: 0; }
.tile-line { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); min-width: 0; }
.tile-line .bar { flex: 1; margin: 0; }
.tile-line b { color: var(--text); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.tile-line.info { color: var(--info); }
.tile-missing { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-missing b { color: var(--warn); font-variant-numeric: tabular-nums; }
.tile-missing i { font-style: normal; color: var(--text-3); margin: 0 5px; }
.draft-err { font-size: 11px; color: var(--danger); }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; gap: 4px; border-radius: 5px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 5px; }

/* Dialog rincian item */
dialog.modal.md { width: min(680px, calc(100% - 24px)); }
.it-doc .doc-ic { cursor: default; transform: none; }
.it-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.it-summary > div { padding: 7px 10px; display: flex; flex-direction: column; gap: 1px; align-items: flex-start; min-width: 0; border-left: 1px solid var(--border); background: var(--surface-2); }
.it-summary > div:first-child { border-left: 0; }
.it-summary span:first-child { font-size: 11px; color: var(--text-3); }
.it-summary b { font-size: 14px; font-variant-numeric: tabular-nums; }
.it-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; font-size: 12.5px; }
.it-caption span { font-size: 11.5px; color: var(--text-3); }
.it-list { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.it-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 48px 96px; gap: 10px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--border); animation: fadeUp .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.it-row:last-child { border-bottom: 0; }
.it-headrow { background: var(--surface-2); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding-top: 6px; padding-bottom: 6px; animation: none; }
.it-no { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.it-name { font-weight: 600; font-size: 12.5px; overflow-wrap: anywhere; }
.it-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.it-code .badge { font-size: 10.5px; }
.it-sns { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; }
.it-sns .sn { font-family: var(--mono); font-size: 10.5px; color: var(--ok); }
.it-sns .sn.more { color: var(--text-3); }
.it-qty { text-align: right; line-height: 1.15; }
.it-qty b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.it-qty span { font-size: 10.5px; color: var(--text-3); }
.it-prog { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; align-items: flex-end; }
.it-prog .bar { width: 100%; margin: 0; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 40px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text-3); animation: fadeIn .4s var(--ease); }
.empty .empty-ic { width: 40px; height: 40px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); margin-bottom: 6px; }
.empty h3 { font-size: 14px; color: var(--text); }
.empty .row { margin-top: 10px; justify-content: center; }

.skel { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel-group { height: 120px; margin-bottom: 10px; }

/* ── 18. DIALOG ────────────────────────────────────────────────────── */
dialog.modal { width: min(440px, calc(100% - 24px)); max-width: calc(100% - 24px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--sh-lg); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: dialogIn .3s var(--ease-spring); }
dialog.modal.lg { width: min(1000px, calc(100% - 24px)); height: min(720px, calc(100dvh - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); animation: fadeIn .25s var(--ease); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-head > div { min-width: 0; }
.modal-head .m-ic { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.modal-head .m-ic.danger { background: var(--danger-soft); color: var(--danger); }
.modal-head .m-ic.ok { background: var(--ok-soft); color: var(--ok); }
.modal-title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 14px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; flex-wrap: wrap; }
.modal-foot .info { margin-right: auto; font-size: 12px; color: var(--text-2); font-weight: 500; }
.info-box { padding: 8px 11px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; margin-top: 10px; word-break: break-word; }
.info-box.mono { font-family: var(--mono); color: var(--danger); }
.big-check { width: 52px; height: 52px; margin: 2px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); animation: popIn .5s var(--ease-spring) .1s both; }
.big-check svg { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s var(--ease) .35s forwards; }

/* ── 19. SCAN ──────────────────────────────────────────────────────── */
.picker-search { margin-bottom: 8px; }
.picker-hint { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; min-width: 0; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all .2s var(--ease); animation: fadeUp .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.pick:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--sh); }
.pick-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.pick-top > div { min-width: 0; }
.pick-name { font-weight: 650; font-size: 12.5px; }
.pick-code { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.pick-top .badge { margin-left: auto; }
.pick-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.pick-foot .bar { flex: 1; margin: 0; }
.pick.complete { border-left: 3px solid var(--ok); }

.scan-view { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; height: 100%; }
.scan-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.scan-box { position: relative; padding: 12px; border-radius: var(--r-lg); background: var(--surface-2); border: 1.5px solid var(--border); transition: border-color .25s, box-shadow .25s; }
.scan-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.scan-box-label { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.scan-box-label .live { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s infinite; }
.scan-row { display: flex; gap: 6px; min-width: 0; }
.scan-code { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: var(--r); outline: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.scan-code:focus { border-color: var(--brand); }
.scan-code:disabled { opacity: .6; }
.scan-qty { width: 64px; height: 42px; padding: 0 6px; border-radius: var(--r); text-align: center; outline: none; border: 1px solid var(--border-strong); background: var(--surface); font-size: 14px; font-weight: 600; }
.scan-row .btn { height: 42px; padding: 0 14px; }
.status-line { margin-top: 8px; font-size: 12px; color: var(--text-2); min-height: 18px; }
.checks { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--text-3); transition: color .2s; }
.check::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.check.ok { color: var(--ok); } .check.fail { color: var(--danger); }
.scan-box.flash { animation: flashOk .7s var(--ease); }
.scan-box.flash-dup { animation: flashWarn .7s var(--ease), shake .4s var(--ease); }
.scan-box.flash-fail { animation: flashFail .7s var(--ease), shake .4s var(--ease); }

.scan-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.scan-stat { padding: 7px 10px; background: var(--surface); border-left: 1px solid var(--border); min-width: 0; }
.scan-stat:first-child { border-left: 0; }
.scan-stat span { font-size: 11px; color: var(--text-3); }
.scan-stat strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scan-progress { padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.scan-progress .row { justify-content: space-between; flex-wrap: nowrap; }

.scan-list-card { display: flex; flex-direction: column; min-height: 0; flex: 1; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.scan-list-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 12.5px; background: var(--surface-2); }
.scan-list-head .badge { margin-left: auto; }
.scan-list { flex: 1; overflow: auto; padding: 4px; min-height: 150px; }
.scan-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r-sm); font-family: var(--mono); font-size: 12px; transition: background .15s; min-width: 0; }
.scan-item:hover { background: var(--surface-2); }
.scan-item .n { font-size: 10.5px; color: var(--text-3); width: 20px; text-align: right; }
.scan-item .code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.scan-item .qty { font-size: 11px; color: var(--brand); font-weight: 700; }
.scan-item.latest { background: var(--ok-soft); animation: slideIn .4s var(--ease-spring); }
.scan-item .del { opacity: 0; transition: opacity .15s; }
.scan-item:hover .del, .scan-item .del:focus-visible { opacity: 1; }
.scan-empty { height: 100%; min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; color: var(--text-3); font-size: 12px; }

.scan-overlay { position: absolute; inset: -14px; z-index: 5; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(5px); animation: fadeIn .2s; }
.scan-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 20px 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-lg); animation: dialogIn .3s var(--ease-spring); width: min(280px, 90%); }
.scan-overlay-card .t { font-weight: 700; margin-top: 4px; }
.scan-overlay-card .s { font-size: 12px; color: var(--text-3); }
.scan-overlay-card .i { font-family: var(--mono); font-size: 11px; color: var(--brand); overflow-wrap: anywhere; }
.load-badge { font-size: 11.5px; font-weight: 600; color: var(--brand); }
.load-badge.done { color: var(--ok); } .load-badge.fail { color: var(--danger); }

/* ── 20. TABS & COMBOBOX (Konfigurasi) ─────────────────────────────── */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .3s var(--ease); }
.mini-stats { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.mini-stats .badge b { color: var(--text); margin-left: 3px; }
.combobox { position: relative; min-width: 0; }
.combobox .input { padding-right: 28px; }
.cbx-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.cbx-clear:hover { background: var(--danger-soft); color: var(--danger); }
.combobox-dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-lg); padding: 4px; display: none; }
.combobox-dropdown.open { display: block; animation: dropIn .18s var(--ease); }
.cbx-opt { padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; outline: none; }
.cbx-opt:hover, .cbx-opt:focus { background: var(--brand-soft); }
.cbx-opt-name { font-weight: 550; font-size: 12.5px; }
.cbx-opt-no { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.cbx-empty { padding: 10px; color: var(--text-3); font-size: 12px; text-align: center; }
.save-bar { position: sticky; bottom: 12px; z-index: 20; margin-top: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--sh-lg); }
.save-bar .msg { font-size: 12px; color: var(--text-3); margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 21. HALAMAN TENGAH (login, database) ──────────────────────────── */
.center-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 12px; }
.center-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-lg); padding: 24px; animation: dialogIn .5s var(--ease-spring); }
.center-card .brand-mark { width: 38px; height: 38px; border-radius: 9px; margin-bottom: 14px; }
.center-card h1 { font-size: 18px; }
.center-card .lead { color: var(--text-3); margin-top: 4px; margin-bottom: 16px; font-size: 12.5px; }
.corner-actions { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; }
.option-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-lg); width: 100%; min-width: 0; text-align: left; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; transition: all .2s var(--ease); animation: fadeUp .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
.option > span:nth-child(2) { min-width: 0; }
.option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.option .o-ic { width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; transition: all .2s; }
.option .o-title { font-weight: 650; }
.option .o-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option .o-check { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; transition: all .2s var(--ease); flex-shrink: 0; }
.option.selected { border-color: var(--brand); background: var(--brand-soft); }
.option.selected .o-ic { background: var(--brand); color: var(--on-brand); }
.option.selected .o-check { background: var(--brand); border-color: var(--brand); color: var(--on-brand); animation: popIn .3s var(--ease-spring); }
.center-links { display: flex; gap: 12px; justify-content: center; margin-top: 14px; font-size: 12px; }
.center-links a { color: var(--text-3); }
.proto-note { margin-top: 14px; font-size: 11.5px; color: var(--text-3); text-align: center; }

/* ── 22. ANIMATIONS ────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes popIn { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes shimmerBar { from { background-position: 0 0; } to { background-position: -200% 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes flashOk { 0% { box-shadow: 0 0 0 0 var(--ok-line); border-color: var(--ok); } 100% { box-shadow: 0 0 0 12px transparent; } }
@keyframes flashWarn { 0% { box-shadow: 0 0 0 0 var(--warn-line); border-color: var(--warn); } 100% { box-shadow: 0 0 0 12px transparent; } }
@keyframes flashFail { 0% { box-shadow: 0 0 0 0 var(--danger-line); border-color: var(--danger); } 100% { box-shadow: 0 0 0 12px transparent; } }
.anim-in { animation: fadeUp .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── 23. RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .scan-view { grid-template-columns: minmax(0, 1fr); height: auto; }
  .scan-list { max-height: 280px; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-text small { display: none; }
}

@media (max-width: 760px) {
  :root { --appbar-h: 50px; }
  .appbar-inner { padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  /* backdrop-filter membuat elemen fixed di dalamnya ikut app bar → matikan agar nav bawah benar */
  .appbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .chip.db { display: none; }
  /* Navigasi pindah ke bawah (tab bar) */
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: auto; gap: 0;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 46px; padding: 0 4px; font-size: 10.5px; border-radius: var(--r); }
  .nav a::after { top: -4px; bottom: auto; left: 30%; right: 30%; }
  body.has-bottom-nav .page { padding-bottom: 84px; }
  body.has-bottom-nav .toast-stack, body.has-bottom-nav .progress-float, body.has-bottom-nav .save-bar { bottom: 66px; }

  .page { padding: 14px 12px 72px; }
  .page-title { font-size: 17px; }
  .page-sub { font-size: 12px; }
  .page-head { align-items: flex-start; margin-bottom: 12px; }
  .page-head > .btn { width: 32px; padding: 0; }
  .page-head > .btn span { display: none; }
  .card-head { padding: 10px 12px; }
  .card-body { padding: 12px; }
  .card-foot { padding: 9px 12px; }

  /* KPI satu baris, rapat */
  .kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 10px; }
  .kpi { padding: 7px 9px; }
  .kpi-label { font-size: 10.5px; gap: 5px; }
  .kpi-value { font-size: 16px; }
  .kpi-value.sm { font-size: 13px; }
  #plan-summary, #result-summary { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .toolbar > .search { flex: 1 1 100%; }
  .toolbar > .select { flex: 1 1 0; }
  .seg { width: 100%; }
  .seg button { flex: 1; justify-content: center; padding: 0 6px; }

  .group-head { padding: 8px 10px; }
  .group-pin { display: none; }
  .group-right .badge:first-child { display: none; }
  .inv-grid { padding: 6px; gap: 6px; }
  .inv-col { gap: 6px; }
  .inv-tile.empty-slot { min-height: 0; padding: 10px; }
  .inv > summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .inv-idx, .inv > summary .badge-status { display: none; }

  /* Tabel konfigurasi → kartu bertumpuk */
  .table.stack-sm thead { display: none; }
  .table.stack-sm tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .table.stack-sm tbody tr:last-child { border-bottom: 0; }
  .table.stack-sm td { padding: 0; border: 0; min-width: 0; }
  .table.stack-sm td.full { grid-column: 1 / -1; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--text-3); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
  .table.stack-sm td.end { text-align: right; align-self: center; }
  .table.stack-sm .empty-row { display: block; }

  /* Dialog menjadi lembar dari bawah */
  dialog.modal.md, dialog.modal:not(.lg) { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; max-height: 92dvh; }
  dialog.modal:not(.lg)[open] { animation: sheetIn .35s var(--ease); }
  dialog.modal.lg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; border: 0; }
  .modal-foot { padding-bottom: calc(9px + env(safe-area-inset-bottom)); }
  .it-row { grid-template-columns: minmax(0, 1fr) 40px 76px; padding: 7px 10px; gap: 8px; }
  .it-no { display: none; }
  .scan-row { flex-wrap: wrap; }
  .scan-row .btn { flex: 1 1 100%; }
  .toast-stack { left: 12px; right: 12px; align-items: stretch; max-width: none; }
  .toast { max-width: none; }
}

@media (max-width: 480px) {
  .chip.role-admin span, .chip.role-gudang span { display: none; }
  .seg button { font-size: 11.5px; gap: 4px; padding: 0 4px; }
  .seg button svg { display: none; }
  .kpi-label { font-size: 10px; }
  .kpi-label .dot { display: none; }
  .it-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .it-summary > div:nth-child(3) { border-left: 0; }
  .it-summary > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .step { padding: 7px 8px; gap: 7px; }
  .step-sub { display: none; }
  .card-foot input[type="date"].input { flex: 1 1 130px; }
  .card-foot .spacer { display: none; }
  .card-foot #btn-verify { flex: 1 1 100%; }
  .center-card { padding: 18px; }
}

/* ═══════════════════════════════════════════════════════════════════
   TEMA GFI ERP — komponen disamakan dengan GFI ERP
   (judul Plus Jakarta Sans, isi IBM Plex Sans, tombol utama gradien biru,
   kartu & input seperti ERP). Token warnanya ada di bagian 1.
   ═══════════════════════════════════════════════════════════════════ */
body { font-size: 12.6px; font-feature-settings: normal; }
h1, h2, h3, h4, .page-title, .card-title, .modal-title, .app-brand, .brand-text, .kpi-value, .step-label,
.alert-title, .center-card h1, .btn, .nav a, .seg button, .chip, .step-num {
  font-family: var(--font-head);
}
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.032em; }
.page-sub { color: var(--text-2); font-size: 11.8px; }
.card-title { font-weight: 700; letter-spacing: -.01em; }
.kpi-value { font-weight: 800; letter-spacing: -.03em; }
.card { box-shadow: var(--sh-sm); }
.btn { font-weight: 600; }
.btn-primary {
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent;
  box-shadow: var(--brand-glow);
}
.btn-primary:hover { background: linear-gradient(140deg, var(--brand), var(--brand-2)); filter: brightness(1.06); box-shadow: var(--brand-glow); }
.input, .select { background: var(--surface-2); border-color: var(--border); }
.input:focus, .select:focus { background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.brand-mark { background: linear-gradient(140deg, var(--navy), var(--brand)); }
.nav a.active { color: var(--brand); }

/* ═══════════════════════════════════════════════════════════════════
   DI DALAM ERP — halaman dibuka di iframe GFI ERP (kelas html.in-erp dari app.js)
   ERP sudah punya judul & navigasi sendiri: header accuratev1 dibuat ringkas
   (tanpa merek, tema, peran), halaman memakai lebar penuh seperti ERP.
   ═══════════════════════════════════════════════════════════════════ */
.in-erp body { animation: none; }
.in-erp .appbar {
  --appbar-h: 40px; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none;
}
.in-erp .appbar-inner, .in-erp .page { max-width: none; }
.in-erp .appbar-inner { padding: 0 clamp(11px, 1.4vw, 17px); gap: 10px; }
.in-erp .nav a { font-size: 11.8px; padding: 0 10px; }
.in-erp .page { padding: 12px clamp(11px, 1.4vw, 17px) 40px; }
.in-erp .page-title { font-size: 17px; }
/* Layar sempit di dalam ERP: navigasi tetap di bar atas (tidak pindah ke bawah seperti versi ponsel),
   karena ERP sudah punya tata letak ponselnya sendiri. */
@media (max-width: 760px) {
  .in-erp .appbar { --appbar-h: 40px; }
  .in-erp .nav {
    position: static; height: 100%; padding: 0; gap: 0; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-top: 0;
  }
  .in-erp .nav a { flex: none; flex-direction: row; height: 100%; gap: 5px; padding: 0 9px; font-size: 11.5px; border-radius: 0; }
  .in-erp .nav a::after { top: auto; bottom: -1px; left: 9px; right: 9px; }
  .in-erp body.has-bottom-nav .page { padding-bottom: 40px; }
  .in-erp body.has-bottom-nav .toast-stack { bottom: 16px; }
  .in-erp body.has-bottom-nav .progress-float { bottom: 18px; }
  .in-erp body.has-bottom-nav .save-bar { bottom: 12px; }
}
