/* Palet Tokyo1
   Utama   : marun #7A3028 (header/sidebar), krem #DDD3C7 (bar atas)
   Pendukung: marun tua #5A211C, putih hangat #FAF6F1, hitam arang #1E1A19
   Aksen   : merah Jepang #E3162B, dipakai sedikit (harga, tombol penting, penanda aktif)
   Proporsi ±60% krem/putih hangat, 30% marun, 10% merah. */
:root {
  --marun: #7A3028;
  --marun-tua: #5A211C;
  --krem: #DDD3C7;
  --putih: #FAF6F1;
  --arang: #1E1A19;
  --merah: #E3162B;

  --bg: var(--putih);
  --surface: #FFFDFA;
  --surface-2: #F4EEE6;
  --ink: var(--arang);
  --muted: #6B5D57;
  --faint: #9A8C84;
  --line: #E7DED3;
  --line-strong: #D2C5B7;
  --brand: var(--marun);
  --brand-hover: var(--marun-tua);
  --brand-soft: #F3E4E0;
  --accent: var(--merah);
  --accent-hover: #C21022;
  --accent-soft: #FCE7E9;
  --side: var(--marun);
  --side-ink: #EEDFD8;
  --side-muted: #CBA79F;
  --side-active: var(--marun-tua);
  --side-line: #8C4036;
  --topbar: var(--krem);
  --topbar-ink: var(--marun-tua);
  --ok: #2F7A3E;
  --ok-soft: #E6F1E3;
  --warn: #9C5A00;
  --warn-soft: #F8EDD7;
  --err: #C8141F;
  --err-soft: var(--accent-soft);
  --info: var(--marun-tua);
  --info-soft: var(--brand-soft);
  --toast: var(--arang);
  --radius: 8px;
  --shadow: 0 1px 2px rgba(30, 26, 25, .05), 0 1px 3px rgba(30, 26, 25, .08);
  --shadow-lg: 0 12px 32px rgba(30, 26, 25, .2);
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--arang); --surface: #28211F; --surface-2: #231D1B; --ink: var(--putih); --muted: #C2B3AA; --faint: #8F817A;
    --line: #3A302D; --line-strong: #4C3F3B; --brand: #A5463B; --brand-hover: #B9554A; --brand-soft: #3D2320;
    --accent: #F0303F; --accent-soft: #42191C; --side: var(--marun-tua); --side-active: #431813; --side-line: #6E2C25;
    --topbar: #2F2724; --topbar-ink: var(--krem);
    --ok: #6CC47D; --ok-soft: #1C2E1F; --warn: #E7B45A; --warn-soft: #3A2D14; --err: #FF5C66; --err-soft: #42191C;
    --info: #E3B7AE; --info-soft: #3D2320; --toast: #120F0E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; font-weight: 550; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.mono { font-family: var(--mono); font-size: .95em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--ok); }
.neg { color: var(--err); }
.price { color: var(--accent); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--putih); font-weight: 700; letter-spacing: .01em; font-size: 16px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--putih); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.brand-mark::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--merah); }
.brand small { display: block; font-weight: 500; color: var(--side-muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: var(--side-ink); border-radius: 6px; font-weight: 500; }
.nav a:hover { background: var(--side-active); color: var(--putih); text-decoration: none; }
.nav a.active { background: var(--side-active); color: var(--putih); box-shadow: inset 3px 0 0 var(--merah); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--side-line); font-size: 12px; }
.side-foot .who { color: var(--putih); font-weight: 600; }
.side-foot button { margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
/* krem top bar */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 26px; background: var(--topbar); color: var(--topbar-ink);
  position: sticky; top: 0; z-index: 30; border-bottom: 1px solid rgba(90, 33, 28, .12); }
.topbar .title { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar button { background: transparent; border: 0; color: inherit; padding: 8px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.topbar button:hover { background: rgba(90, 33, 28, .08); }
.topbar .tb-user { font-size: 13px; }
.topbar [data-menu] { display: none; }
.page { padding: 22px 26px 40px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin-right: auto; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; }
  .app.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(30, 26, 25, .4); z-index: 40; }
  .topbar { padding: 6px 10px; min-height: 48px; }
  .topbar [data-menu] { display: grid; }
  .topbar .tb-user { display: none; }
  .page { padding: 14px 12px 32px; }
  .page-head h1 { font-size: 18px; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:focus-visible, .input:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--putih); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--putih); }
/* merah aksen: hanya untuk tombol yang benar-benar penting (selesai picking / terima) */
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }
.input, select.input, textarea.input { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; min-width: 0; }
textarea.input { height: auto; padding: 8px 10px; }
.input::placeholder { color: var(--faint); }
.input.mono { font-family: var(--mono); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--muted); }
label.field .input { font-weight: 400; color: var(--ink); }
.field-hint { font-weight: 400; font-size: 12px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); cursor: pointer; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 32px; width: 100%; }

/* ---------- cards & tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.card-body { padding: 16px; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { flex: 1 1 260px; max-width: 420px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.t th { position: sticky; top: 0; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; z-index: 1; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--ink); }
.t th .arrow { font-size: 10px; margin-left: 3px; }
.t tbody tr:hover { background: var(--surface-2); }
.t tr.clickable { cursor: pointer; }
.t td.name { min-width: 200px; }
.t tr.sub td { background: var(--surface-2); font-weight: 600; }
.loc { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.t td.cb, .t th.cb { width: 36px; padding-right: 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .grow { flex: 1; }

/* ---------- badges, tabs, stats ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.draft { background: var(--surface-2); color: var(--muted); }
.badge.picking { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.in_transit { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.received, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.cancelled, .badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 11px 12px 10px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 550; }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--faint); }
.stat.accent { border-top: 3px solid var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .2s; }
.progress.ok > span { background: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }

/* stepper */
.steps { display: flex; gap: 0; align-items: center; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); font-weight: 550; }
.step .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; background: var(--surface); }
.step.done { color: var(--brand); }
.step.done .dot { background: var(--brand); border-color: var(--brand); color: var(--putih); }
.step.current { color: var(--ink); }
.step.current .dot { border-color: var(--brand); color: var(--brand); }
.step-line { width: 36px; height: 2px; background: var(--line-strong); margin: 0 8px; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 26, 25, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--toast); color: var(--putih); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-weight: 500; border-left: 4px solid var(--krem); animation: fade .15s ease; }
.toast.ok { border-left-color: #6CC47D; }
.toast.err { border-left-color: var(--merah); }
.toast.warn { border-left-color: #E7B45A; }
.alert { padding: 10px 12px; border-radius: 6px; font-size: 13px; border: 1px solid transparent; }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- scan ---------- */
.scanbox { display: flex; gap: 8px; }
.scanbox .input { flex: 1; height: 48px; font-size: 18px; font-family: var(--mono); border-width: 2px; }
.scanbox .input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.scanbox .btn { height: 48px; }
.scan-hint { font-size: 12px; color: var(--faint); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.feedback { border-radius: 10px; padding: 16px 18px; border: 2px solid var(--line); background: var(--surface); transition: background .15s; }
.feedback.ok { border-color: var(--ok); background: var(--ok-soft); }
.feedback.warn { border-color: var(--warn); background: var(--warn-soft); }
.feedback.err { border-color: var(--err); background: var(--err-soft); }
.feedback .fb-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.warn .fb-title { color: var(--warn); }
.feedback.err .fb-title { color: var(--err); }
.feedback .fb-name { font-size: 20px; font-weight: 700; margin-top: 4px; }
.feedback .fb-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); }
.big-count { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.flash { animation: flash .5s ease; }
@keyframes flash { 0% { transform: scale(1.015); } }
.scan-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.scan-layout > .sticky { position: sticky; top: 16px; }
@media (max-width: 1000px) { .scan-layout { grid-template-columns: 1fr; } .scan-layout > .sticky { position: static; } }
.pick-row.done td { color: var(--faint); }
.pick-row.done .qty-cell { color: var(--ok); }
.pick-row.hl td { background: var(--brand-soft); }
.qty-cell { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cam-reader { width: 100%; min-height: 260px; background: #000; border-radius: 8px; overflow: hidden; }
.cam-reader video { width: 100% !important; display: block; }

/* product card */
.pcard .pname { font-size: 18px; font-weight: 700; }
.wh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.wh-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.wh-box .q { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  linear-gradient(135deg, rgba(122, 48, 40, .12), transparent 45%), var(--krem); }
.login { width: min(380px, 100%); padding: 28px; }
.login .brand { color: var(--ink); padding: 0 0 18px; font-size: 17px; }
.login .brand small { color: var(--muted); }
.login { border-top: 4px solid var(--brand); }
.login .brand-mark { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.side .btn { background: transparent; border-color: var(--side-line); color: var(--side-ink); }
.side .btn:hover { background: var(--side-active); border-color: var(--side-active); color: var(--putih); }

/* ---------- labels / print ---------- */
.label-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--surface-2); border-radius: 8px; max-height: 60vh; overflow: auto; }
.lbl { background: #fff; color: #000; border: 1px dashed #bbb; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 1.2mm 1.5mm; font-family: Arial, sans-serif; text-align: center; }
.lbl .l-name { font-size: 7.5pt; font-weight: 700; line-height: 1.1; max-height: 2.2em; overflow: hidden; width: 100%; }
.lbl .l-price { font-size: 9pt; font-weight: 800; }
.lbl .l-sub { font-size: 6.5pt; }
.lbl svg { max-width: 100%; flex: 1 1 auto; min-height: 0; }
.lbl.loc-lbl .l-loc { font-size: 20pt; font-weight: 800; font-family: Arial, sans-serif; letter-spacing: .02em; }
#print-root { display: none; }
@media print {
  body { background: #fff; }
  body.printing #app, body.printing #toasts { display: none !important; }
  body.printing #print-root { display: block; }
  .no-print, .side, .topbar, .toolbar, .pager, .page-head .btn { display: none !important; }
  .app { display: block; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  .t th { position: static; }
  .lbl { border: 0; }
}
.picklist { font-family: Arial, sans-serif; color: #000; }
.picklist h1 { font-size: 16pt; }
.picklist table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.picklist th, .picklist td { border: 1px solid #999; padding: 3px 5px; }
.picklist th { background: #eee; }
.picklist .box { width: 16px; height: 16px; border: 1.5px solid #000; display: inline-block; }

/* ---------- small-screen fixes ---------- */
.scan-layout > *, .grid-2 > * { min-width: 0; }
.scanbox .input { width: 100%; }
.topbar svg { width: 22px; height: 22px; }
@media (max-width: 600px) {
  .scanbox .cam-label { display: none; }
  .page-head { gap: 8px; }
  .page-head .btn { height: 34px; padding: 0 10px; }
  .toolbar .search { flex-basis: 100%; max-width: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat .value { font-size: 21px; }
  .t th, .t td { padding: 7px 8px; }
  .t td.name { min-width: 150px; }
  .modal-body { padding: 14px; }
  .steps .step-line { width: 14px; margin: 0 4px; }
}

/* ---------- filters & parent SKU chips ---------- */
.filter-row { background: var(--surface-2); align-items: flex-end; }
.mini-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.mini-field .input { height: 32px; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; }
.badge.pg { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-family: var(--mono); }

/* ---------- SKU induk ---------- */
a.badge.pg { text-decoration: none; }
a.badge.pg:hover { background: var(--brand); color: var(--putih); }
.parent-code { font-weight: 700; color: var(--brand); }
.parent-note { padding: 8px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface); }
.parent-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--brand-soft); color: var(--ink); text-decoration: none !important; border: 1px solid transparent; font-weight: 400; }
.parent-box:hover { border-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.active { background: var(--brand); color: var(--putih); }
.group-info { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; margin-bottom: 16px; }
.group-info > div:not(.alert) { display: flex; flex-direction: column; gap: 2px; }
.group-info .muted { font-size: 12px; }
.group-info b { font-size: 17px; }
.wh-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.wh-box.global { background: var(--brand-soft); border-color: transparent; }
.wh-box.global .q { color: var(--brand); }
.t td.col-global, .t th.col-global { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
@media (max-width: 600px) { .wh-grid.three { grid-template-columns: 1fr 1fr; } }

/* ---------- stock alerts ---------- */
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--merah); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--merah); color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; }
.bell-panel { position: fixed; z-index: 90; width: min(380px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: min(560px, 80vh); animation: fade .12s ease; }
.bell-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bell-counts { display: flex; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.bell-counts a { color: var(--ink); font-weight: 500; }
.bell-list { overflow-y: auto; }
.bell-item { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 400; text-decoration: none !important; }
.bell-item:hover { background: var(--surface-2); }
.bell-foot { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 10px; font-size: 13px; }
.bell-foot svg { width: 14px; height: 14px; }
.stock-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 16px; color: var(--ink); text-decoration: none !important;
  border-left: 4px solid var(--merah); font-weight: 400; }
.alert-strip:hover { border-color: var(--merah); background: var(--surface-2); }

/* ---------- auto-fill: product suggestions ---------- */
.suggest { position: fixed; z-index: 150; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-lg);
  overflow-y: auto; animation: fade .1s ease; }
.sg-title { padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sg-item { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
.sg-item:hover { background: var(--surface-2); }
.sg-item.active { background: var(--brand-soft); border-left-color: var(--merah); }
.sg-main { flex: 1; min-width: 0; }
.sg-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-codes { font-size: 12px; color: var(--muted); }
.sg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12px; white-space: nowrap; }
.sg-foot { padding: 8px 12px; font-size: 12px; color: var(--muted); }
.autofill-card { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; background: var(--surface-2);
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.af-head { display: flex; flex-direction: column; gap: 1px; min-width: 220px; flex: 1; }
.af-head .faint { font-size: 12px; }
.af-grid { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; }
.af-grid dt { font-size: 12px; color: var(--muted); }
.af-grid dd { margin: 0; font-weight: 600; }

/* ---------- global search: "Ditemukan juga di" ---------- */
.xsearch { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.xsearch.xs-off { display: none; }
.xs-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.xs-label { color: var(--muted); font-weight: 600; margin-right: 2px; }
.xs-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer; }
.xs-chip b { color: var(--brand); }
.xs-chip:hover { border-color: var(--brand); }
.xs-chip.active { background: var(--brand); border-color: var(--brand); color: var(--putih); }
.xs-chip.active b { color: var(--putih); }
.xs-list { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.xs-row { display: flex; gap: 12px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 400; cursor: pointer; text-decoration: none !important; }
.xs-row:hover { background: var(--surface-2); }
.xs-row .grow { min-width: 0; }
.xs-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; font-size: 12px; }
.xs-all { display: block; padding: 8px 12px; font-size: 13px; }
@media (max-width: 600px) {
  .xs-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .xs-side { justify-content: flex-start; }
}

/* ---------- import: drag and drop ---------- */
.dropzone { display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 16px 18px; border: 2px dashed var(--line-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); outline: none; }
.dropzone.over { border-color: var(--merah); border-style: solid; background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.dropzone [data-drop-body] { display: flex; align-items: center; gap: 14px; width: 100%; }
.dropzone [data-drop-body] > svg { width: 30px; height: 30px; flex: none; color: var(--brand); }
.dropzone.has-file [data-drop-body] > svg { color: var(--ok); }
.dropzone.over [data-drop-body] > svg { color: var(--merah); }
.dz-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dz-text b { overflow-wrap: anywhere; }
.dz-text .muted { font-size: 13px; }

/* ---------- Log Aktivitas ---------- */
.act-detail { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 240px; }
.act-line { line-height: 1.4; overflow-wrap: anywhere; }
.act-line > .muted:first-child { margin-right: 4px; }
.act-line > .muted:first-child::after { content: ":"; }
.act-old { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--muted); }

/* ---------- permissions ---------- */
.cannot-export [data-export], .cannot-export [data-act="export"], .cannot-export [data-act="export-diff"] { display: none !important; }
.perm-table td, .perm-table th { vertical-align: middle; }
.perm-table td.center, .perm-table th.center { width: 120px; }
.perm-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.perm-group td { background: var(--surface-2); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* ---------- inbound ---------- */
.warn-text { color: var(--warn); }
.tabs.sub-tabs { background: var(--surface-2); }
.tabs.sub-tabs button { font-size: 13px; }

/* ---------- bantuan: kotak "Cara pakai", langkah awal, panduan ---------- */
.help { margin: -4px 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.help summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; user-select: none; font-size: 13.5px; }
.help summary::-webkit-details-marker { display: none; }
.help summary > svg { width: 18px; height: 18px; color: var(--brand); flex: none; }
.help summary:hover { background: var(--surface-2); border-radius: var(--radius); }
.help .help-toggle::after { content: "Tampilkan"; font-size: 12.5px; font-weight: 600; color: var(--brand); }
.help[open] .help-toggle::after { content: "Sembunyikan"; }
.help[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.help-body { padding: 12px 16px 14px 42px; font-size: 13.5px; }
.help-intro { margin: 0 0 8px; }
.help-steps { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.help-steps li::marker { color: var(--brand); font-weight: 700; }
.help-tips { margin: 0 0 8px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.help-foot svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
@media (max-width: 600px) { .help-body { padding-left: 16px; } .help .help-sum { display: none; } }

.setup { margin-bottom: 16px; }
.setup .card-head h2 { margin-right: 0; }
.setup .card-head .muted { margin-right: auto; }
.setup-list { list-style: none; margin: 0; padding: 6px 0; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.setup-list li:last-child { border-bottom: 0; }
.setup-list li > svg { width: 22px; height: 22px; flex: none; color: var(--faint); }
.setup-list li.done > svg { color: var(--ok); }
.setup-list li.done > div > b:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.setup-list .muted { font-size: 12.5px; }

.guide-frame { overflow: hidden; }
.guide-frame iframe { display: block; width: 100%; height: calc(100vh - 190px); min-height: 480px; border: 0; background: #fff; }
