/* ==========================================================================
   PICKMASTER PRO — Picking Station Stylesheet
   Tema: "industrial console" — gelap pekat, aksen indigo/cyan, status jelas.
   Auto-deploy: laptop -> GitHub -> PC office (webhook).
   Dibuat untuk dipakai di layar kantor maupun tablet gudang.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKEN
   -------------------------------------------------------------------------- */
/* Token desain pindah seluruhnya ke tokens.css — satu sumber untuk warna,
   tipografi, radius, tinggi kontrol, tepi aman, dan tangga breakpoint.
   Berkas ini hanya memakainya. */

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* overflow-x: clip, NOT hidden. `hidden` computes overflow-y:auto, which turns the
   element into a scroll container; the page then scrolls on <html> while every
   position:sticky descendant resolves against a scrollport that never moves, so the
   topbar, the view nav and the picking cart all scroll away. `clip` clips the same
   overflow without establishing a scroll container, so sticky keeps working. */
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--tx);
  font: 400 var(--fs-2xl)/1.5 var(--ff);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, dl, dd, dt, ol, ul, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: var(--brand-hi); text-decoration: none; }
b, strong { font-weight: 700; }

:focus-visible {
  outline: 2px solid var(--brand-hi);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.hidden { display: none !important; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.mono { font-family: var(--ff-mono); }
/* nowrap keeps "Rp 11.571.429" as one unit. Without it the column broke after
   "Rp", stranding the currency on its own line above a right-aligned figure. */
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-warn { color: var(--warn); }

.ic { width: 18px; height: 18px; flex: none; stroke-linecap: round; stroke-linejoin: round; }

kbd {
  display: inline-block;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  background: var(--bg-input);
  font: 600 var(--fs-2xs)/1.5 var(--ff-mono);
  color: var(--tx-2);
}

input, select, textarea {
  width: 100%;
  min-height: var(--h-control);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--tx);
  font: 500 var(--fs-lg)/1.4 var(--ff);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus {
  background: var(--bg-input-hi);
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input::placeholder { color: var(--tx-3); }
select { cursor: pointer; appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--tx-3) 50%), linear-gradient(135deg, var(--tx-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 47%, calc(100% - 11px) 47%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* Tinggi dikunci, bukan sekadar lantai. min-height membiarkan input date tumbuh
   jadi 38,89px karena indikator kalender bawaan browser, sehingga ia 1px lebih
   tinggi dari select di sebelahnya dan barisnya tidak rata. */
input:not([type="checkbox"]):not([type="radio"]),
select {
  height: var(--h-control);
  padding-top: 0;
  padding-bottom: 0;
}
textarea { min-height: 88px; padding-top: 8px; padding-bottom: 8px; }

/* --------------------------------------------------------------------------
   3. TOMBOL
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h-control);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-weight: 600;
  font-size: var(--fs-lg);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease-spring), opacity var(--dur), box-shadow var(--dur) var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--sh-1); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--glow-brand); }

.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--glow-accent); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--tx-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--line-strong); color: var(--tx); transform: translateY(-1px); }

.btn-danger-ghost { background: transparent; border-color: var(--bad-soft); color: var(--bad); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }

.btn-sm { min-height: var(--h-control-sm); padding: 0 12px; font-size: var(--fs-base); }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--h-control);
  height: var(--h-control);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--tx-2);
  font-size: var(--fs-4xl);
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--tx); }

.spinnable.is-spinning { animation: spin 1s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   4. SHELL & TOPBAR
   -------------------------------------------------------------------------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* Three lanes: brand (content), status (the only lane that gives way), actions
   (content, never yields). As a flex row the status lane had no min-width:0 and
   overran the actions lane -- at 1440px the sync stamp rendered underneath the
   first button. A grid with minmax(0,1fr) in the middle cannot overrun. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  min-height: var(--h-topbar);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  box-shadow: var(--sh-1);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: var(--fs-2xl); letter-spacing: .2px; }
.brand-name b { color: var(--brand-hi); }
/* The brand lane is sized to content, so the subtitle gets its natural width
   instead of being clipped mid-word ("Warehouse & Main..."). Below 1280px it is
   hidden outright rather than truncated -- a half-word reads as breakage. */
.brand-sub { font-size: var(--fs-xs); color: var(--tx-3); white-space: nowrap; }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}
.topbar-status > * { flex: none; }
/* The sync stamp is the one thing here that may be sacrificed for space. */
.topbar-status .sync-stamp { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.sheet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-input);
  color: var(--tx-2);
  font-size: var(--fs-base);
  font-weight: 600;
  transition: color var(--dur), border-color var(--dur);
}
.sheet-link svg { width: 14px; height: 14px; }
.sheet-link:hover { color: var(--ok); border-color: var(--ok); }

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  font-size: var(--fs-base);
  font-weight: 600;
  white-space: nowrap;
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tx-3); flex: none; }
.conn-pill[data-state="live"] { color: #00d284; border-color: rgba(0, 210, 132, 0.35); background: rgba(0, 210, 132, 0.12); }
.conn-pill[data-state="live"] .conn-dot { background: #00d284; box-shadow: 0 0 0 0 #00d284; animation: pulse-live 1.6s infinite; }
.conn-pill[data-state="reconnecting"] { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.conn-pill[data-state="reconnecting"] .conn-dot { background: var(--warn); box-shadow: 0 0 0 0 var(--warn); animation: pulse 1.8s infinite; }
.conn-pill[data-state="on"] { color: var(--ok); border-color: var(--ok-soft); background: var(--ok-soft); }
.conn-pill[data-state="on"] .conn-dot { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.2s infinite; }
.conn-pill[data-state="off"] { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.conn-pill[data-state="off"] .conn-dot { background: var(--warn); }
.conn-pill[data-state="error"] { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.conn-pill[data-state="error"] .conn-dot { background: var(--bad); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 132, 0.7); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.realtime-box {
  margin-top: 20px;
  padding: 16px 16px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand) 7%, var(--bg-panel-2));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.realtime-header { display: flex; flex-direction: column; gap: 4px; }
.realtime-badge {
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--brand-hi);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.realtime-desc { font-size: var(--fs-base); color: var(--tx-2); margin: 0; line-height: 1.45; }
.copy-input-group { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.copy-input-group input { flex: 1; min-width: 0; font-size: var(--fs-base); }
.webhook-host-hint {
  font-size: var(--fs-xs);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-left: 3px solid var(--warn);
  padding: 8px 12px;
  margin: 8px 0 0 0;
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  line-height: 1.5;
}
.webhook-host-hint code {
  background: var(--bg-panel);
  padding: 1px 4px;
  border-radius: var(--r-2xs);
  color: var(--tx);
}
.realtime-status-row { font-size: var(--fs-xs); color: var(--tx-3); }
.realtime-status-row strong { color: var(--tx-2); }
.realtime-status-row strong.is-live { color: #00d284; }
.realtime-status-row strong.is-connecting { color: var(--warn); }

.sync-stamp { font-size: var(--fs-xs); color: var(--tx-3); font-family: var(--ff-mono); white-space: nowrap; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; justify-self: end; }

/* --------------------------------------------------------------------------
   5. CONTEXT BAR
   -------------------------------------------------------------------------- */
.context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  flex: none;
}
.seg {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.seg:hover { background: var(--bg-hover); transform: translateY(-1px); }
.seg.is-active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); box-shadow: 0 0 16px -2px var(--brand-soft); }
.seg-title { font-weight: 700; font-size: var(--fs-lg); }
.seg.is-active .seg-title { color: var(--brand-hi); }
.seg-meta { font-size: var(--fs-2xs); color: var(--tx-3); }
.seg-meta b { font-family: var(--ff-mono); color: var(--tx-2); }

.context-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-width: 320px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tx-3);
  border-radius: var(--r-sm);
  background: var(--bg-panel);
  text-align: left;
  cursor: pointer;
  transition: transform var(--dur) var(--ease-spring), border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.metric:hover { transform: translateY(-3px); background: var(--bg-panel-2); box-shadow: var(--sh-2); }
.metric-label { font-size: var(--fs-2xs); font-weight: 600; color: var(--tx-3); text-transform: uppercase; letter-spacing: .5px; }
.metric-value { font: 700 var(--fs-4xl)/1.15 var(--ff); font-variant-numeric: tabular-nums; }
.metric-foot { font-size: var(--fs-micro); color: var(--tx-3); }

.metric-close { border-left-color: var(--ok); }
.metric-close .metric-value { color: var(--ok); }
.metric-defisit { border-left-color: var(--bad); }
.metric-defisit .metric-value { color: var(--bad); }
.metric-segera { border-left-color: var(--warn); }
.metric-segera .metric-value { color: var(--warn); }
.metric-cek { border-left-color: var(--info); }
.metric-cek .metric-value { color: var(--info); }
.metric.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), var(--glow-brand); }
.metric-close.is-selected { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft), var(--glow-ok); }
.metric-defisit.is-selected { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-soft), var(--glow-bad); }
.metric-segera.is-selected { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft), var(--glow-warn); }
.metric-cek.is-selected { border-color: var(--info); box-shadow: 0 0 0 2px var(--info-soft), var(--glow-accent); }

/* --------------------------------------------------------------------------
   6. VIEW NAV
   -------------------------------------------------------------------------- */
/* Docks at exactly the topbar's height (64px). Was 62px, which left a 2px seam
   of scrolling content visible between the two bars. */
.view-nav {
  position: sticky;
  top: var(--h-topbar);
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  min-height: var(--h-nav);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* The mask fades whichever edge has content beyond it, so a cut-off tab reads
   as "scroll me" rather than as breakage. */
.view-tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
.view-tabs::-webkit-scrollbar { display: none; }
.vtab { scroll-snap-align: start; }

.vtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--tx-3);
  font-weight: 600;
  font-size: var(--fs-lg);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur), border-color var(--dur), transform var(--dur) var(--ease-spring);
}
.vtab:hover { color: var(--tx-2); transform: translateY(-1px); }
.vtab.is-active { color: var(--tx); border-bottom-color: var(--brand-hi); }
.vtab.is-active .ic { color: var(--brand-hi); }

.vtab-badge {
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-input);
  font: 700 var(--fs-2xs)/1.6 var(--ff-mono);
  color: var(--tx-2);
}
.vtab.is-active .vtab-badge { background: var(--brand-soft); color: var(--brand-hi); }
.vtab-badge.badge-alert { background: var(--bad-soft); color: var(--bad); }

.view-nav-actions { display: flex; gap: 8px; margin-left: auto; padding: 8px 0; flex: none; }

/* --------------------------------------------------------------------------
   7. WORKSPACE & PANEL
   -------------------------------------------------------------------------- */
.workspace { flex: 1; min-height: 0; padding: 20px 20px 28px; }
.view { display: none; animation: fade .22s var(--ease); }
.view.is-active { display: block; }
#tableView.is-active { display: block; overflow: hidden; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  box-shadow: var(--sh-2);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel-2);
}
.panel-title { display: flex; align-items: flex-start; gap: 12px; }
.panel-title h2 { font-size: var(--fs-2xl); font-weight: 700; }
.panel-title p { font-size: var(--fs-base); color: var(--tx-3); margin-top: 2px; }

.step-chip {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand-hi);
  font: 700 var(--fs-base)/1 var(--ff-mono);
}

.pill-soft {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-input);
  border: 1px solid var(--line);
  font: 600 var(--fs-2xs)/1.6 var(--ff-mono);
  color: var(--tx-2);
  white-space: nowrap;
}
.kbd-hint { font-size: var(--fs-2xs); color: var(--tx-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   8. FIELD
   -------------------------------------------------------------------------- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-wide { grid-column: span 2; }
.field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--tx-2); text-transform: uppercase; letter-spacing: .4px; }
.field-label em { color: var(--bad); font-style: normal; font-weight: 700; margin-left: 3px; text-transform: none; letter-spacing: 0; }
.field input.is-invalid, .field select.is-invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.mini-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-field > span { font-size: var(--fs-micro); font-weight: 600; color: var(--tx-3); text-transform: uppercase; letter-spacing: .4px; }
.mini-field select, .mini-field input { padding: 8px 12px; font-size: var(--fs-lg); }
.mini-field.inline { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
.mini-field.inline select { width: auto; }

.switch-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  cursor: pointer;
}
.switch-field input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.switch-field b { display: block; font-size: var(--fs-lg); }
.switch-field em { display: block; font-style: normal; font-size: var(--fs-base); color: var(--tx-3); margin-top: 2px; }

/* --------------------------------------------------------------------------
   9. STASIUN PICKING
   -------------------------------------------------------------------------- */
.station-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, .95fr);
  gap: 16px;
  align-items: start;
}
.station-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* topbar 64 + nav 52 + 12 of air. The cart is the operator's running total and
   must stay visible while they scroll the scan list. */
.station-side { position: sticky; top: 128px; align-self: start; max-height: calc(100vh - 144px); overflow-y: auto; scrollbar-width: thin; }

/* --- Scanner --- */
.panel-scan { border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); }

.scan-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 20px 0;
  padding: 4px 12px 4px 16px;
  border: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-input);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.scan-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), var(--glow-brand); background: var(--bg-input-hi); }
.scan-box[data-state="ok"] { border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft), var(--glow-ok); }
.scan-box[data-state="warn"] { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft), var(--glow-warn); }
.scan-box[data-state="bad"] { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft), var(--glow-bad); }

.scan-icon { color: var(--tx-3); flex: none; }
.scan-icon svg { width: 27px; height: 27px; }
.scan-box:focus-within .scan-icon { color: var(--brand-hi); }
.scan-box[data-state="ok"] .scan-icon { color: var(--ok); }
.scan-box[data-state="bad"] .scan-icon { color: var(--bad); }

.scan-input {
  flex: 1;
  padding: 16px 0;
  border: 0;
  background: transparent;
  font: 600 var(--fs-3xl)/1.2 var(--ff-mono);
  letter-spacing: .5px;
}
.scan-input:focus { outline: none; box-shadow: none; background: transparent; }
.scan-input::placeholder { font-family: var(--ff); font-weight: 500; font-size: var(--fs-2xl); letter-spacing: 0; }

.scan-clear {
  width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--tx-3);
  font-size: var(--fs-4xl); line-height: 1; cursor: pointer;
}
.scan-clear:hover { background: var(--bg-hover); color: var(--tx); }

.scan-cam-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand-hi);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-spring), background var(--dur), color var(--dur), box-shadow var(--dur);
}
.scan-cam-btn:hover {
  background: var(--brand);
  color: var(--on-brand);
  transform: scale(1.08);
  box-shadow: var(--glow-brand);
}
.scan-cam-btn:active {
  transform: scale(.94);
}
.scan-cam-btn .ic {
  width: 18px; height: 18px;
}

.scan-spinner {
  display: none;
  width: 17px; height: 17px; flex: none;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand-hi);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.scan-box.is-busy .scan-spinner { display: block; }

.scan-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  font-size: var(--fs-lg);
  color: var(--tx-2);
}
.sf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tx-3); flex: none; }
.scan-feedback[data-state="ok"] { color: var(--ok); }
.scan-feedback[data-state="ok"] .sf-dot { background: var(--ok); }
.scan-feedback[data-state="warn"] { color: var(--warn); }
.scan-feedback[data-state="warn"] .sf-dot { background: var(--warn); }
.scan-feedback[data-state="bad"] { color: var(--bad); }
.scan-feedback[data-state="bad"] .sf-dot { background: var(--bad); }

/* --- Hasil scan --- */
.scan-results { border-top: 1px solid var(--line); background: var(--bg-panel-2); }
.scan-results-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; color: var(--tx-3);
  text-transform: uppercase; letter-spacing: .5px;
}
.scan-result-list { max-height: 330px; overflow-y: auto; }

.scan-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur);
}
.scan-result:last-child { border-bottom: 0; }
.scan-result:hover { background: var(--bg-hover); }
.scan-result.is-cursor { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand-hi); }

.sr-name { font-weight: 600; font-size: var(--fs-lg); line-height: 1.35; }
.sr-name mark { background: color-mix(in srgb, var(--warn) 32%, transparent); color: inherit; border-radius: var(--r-2xs); padding: 0 1px; }
.sr-codes { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 500 var(--fs-xs)/1.5 var(--ff-mono); color: var(--tx-3); }
.sr-codes span b { color: var(--tx-2); }
.sr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.sr-price { font: 700 var(--fs-lg)/1.3 var(--ff-mono); }
.sr-stock { font-size: var(--fs-2xs); font-weight: 600; }
.sr-stock.ok { color: var(--ok); }
.sr-stock.zero { color: var(--bad); }
.sr-usage { font-size: var(--fs-micro); color: var(--tx-3); }
.sr-tag {
  align-self: flex-start;
  padding: 1px 8px; border-radius: var(--r-pill);
  font: 700 var(--fs-micro)/1.7 var(--ff); text-transform: uppercase; letter-spacing: .5px;
}
.sr-tag.exact { background: var(--ok-soft); color: var(--ok); }
.sr-tag.stk { background: var(--brand-soft); color: var(--brand-hi); }
.sr-tag.pn { background: var(--accent-soft); color: var(--accent); }

.scan-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--warn-soft);
}
.scan-empty-text { font-size: var(--fs-lg); color: var(--tx-2); }
.scan-empty-text strong { font-family: var(--ff-mono); color: var(--warn); margin-right: 4px; }

.scan-log { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.scan-log-title { font-size: var(--fs-micro); font-weight: 700; color: var(--tx-3); text-transform: uppercase; letter-spacing: .5px; }
.scan-log ul { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.scan-log li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-input);
  font: 500 var(--fs-xs)/1.6 var(--ff-mono);
  color: var(--tx-2);
}
.scan-log li[data-result="ok"] { border-color: var(--ok-soft); color: var(--ok); }
.scan-log li[data-result="dup"] { border-color: var(--info-soft); color: var(--info); }
.scan-log li[data-result="miss"] { border-color: var(--bad-soft); color: var(--bad); }

/* --- Keranjang --- */
.panel-cart { display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.cart-body { flex: 1; overflow-y: auto; min-height: 140px; }

.cart-empty { padding: 42px 22px; text-align: center; color: var(--tx-3); }
.cart-empty svg { width: 42px; height: 42px; margin-bottom: 12px; opacity: .55; }
.cart-empty p { font-weight: 700; font-size: var(--fs-lg); color: var(--tx-2); }
.cart-empty span { display: block; margin-top: 4px; font-size: var(--fs-base); line-height: 1.5; }

.cart-line {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  animation: lineIn var(--dur-norm) var(--ease-spring);
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.cart-line:hover { background: var(--bg-hover); }
.cart-line:last-child { border-bottom: 0; }
.cart-line.is-defisit { background: var(--bad-soft); box-shadow: inset 3px 0 0 var(--bad); }
.cart-line.just-added { animation: flashSheen .8s var(--ease-spring); }
@keyframes lineIn { from { opacity: 0; transform: translateX(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes flashSheen {
  0% { background-color: var(--ok-soft); box-shadow: inset 4px 0 0 var(--ok); }
  60% { background-color: var(--ok-soft); }
  100% { background-color: transparent; }
}

.cl-top { display: flex; align-items: flex-start; gap: 12px; }
.cl-idx { font: 700 var(--fs-2xs)/1.7 var(--ff-mono); color: var(--tx-3); flex: none; min-width: 18px; }
.cl-name { flex: 1; font-weight: 600; font-size: var(--fs-lg); line-height: 1.35; min-width: 0; }
.cl-remove {
  width: 24px; height: 24px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: transparent; color: var(--tx-3);
  font-size: var(--fs-2xl); line-height: 1; cursor: pointer;
}
.cl-remove:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

.cl-codes { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 4px 0 8px 28px; font: 500 var(--fs-2xs)/1.5 var(--ff-mono); color: var(--tx-3); }

.cl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: 28px; }

.qty-stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-xs); overflow: hidden; background: var(--bg-input); }
.qty-stepper button {
  width: 27px; height: 30px;
  border: 0; background: transparent; color: var(--tx-2);
  font-size: var(--fs-2xl); font-weight: 700; line-height: 1; cursor: pointer;
}
.qty-stepper button:hover { background: var(--bg-hover); color: var(--tx); }
.qty-stepper input {
  width: 52px; height: 30px; padding: 0 4px;
  border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  border-radius: 0; background: transparent;
  text-align: center;
  font: 700 var(--fs-lg)/1 var(--ff-mono);
}
.qty-stepper input:focus { box-shadow: none; background: var(--bg-input-hi); }

.cl-select, .cl-price {
  height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: var(--bg-input);
  font: 600 var(--fs-xs)/1 var(--ff-mono);
  width: auto;
}
.cl-select { padding-right: 24px; background-position: calc(100% - 13px) 47%, calc(100% - 9px) 47%; }
.cl-price { width: 108px; text-align: right; }

.cl-stock { font: 600 var(--fs-2xs)/1 var(--ff); padding: 0 8px; white-space: nowrap; }
.cl-stock.ok { color: var(--ok); }
.cl-stock.zero { color: var(--bad); }

.cl-flag {
  padding: 3px 8px; border-radius: var(--r-pill);
  font: 700 var(--fs-micro)/1.6 var(--ff); text-transform: uppercase; letter-spacing: .5px;
}
.cl-flag.defisit { background: var(--bad-soft); color: var(--bad); }
.cl-flag.ready { background: var(--ok-soft); color: var(--ok); }

.cart-foot { border-top: 1px solid var(--line); background: var(--bg-panel-2); }
.cart-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.cart-totals > div { padding: 12px 12px; background: var(--bg-panel-2); text-align: center; }
.cart-totals dt { font-size: var(--fs-micro); font-weight: 700; color: var(--tx-3); text-transform: uppercase; letter-spacing: .5px; }
.cart-totals dd { font: 700 var(--fs-3xl)/1.3 var(--ff-mono); margin-top: 2px; }
.cart-total-value dd { color: var(--ok); font-size: var(--fs-lg); }

.cart-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; }
.cart-note { font-size: var(--fs-2xs); line-height: 1.6; color: var(--tx-3); text-align: center; }
.cart-note b { color: var(--warn); }

/* --------------------------------------------------------------------------
   10. TOOLBAR & FILTER (TABEL)
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--bg-panel);
}
.search-wrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 270px; }
.search-wrap .ic { position: absolute; left: 13px; color: var(--tx-3); pointer-events: none; }
.search-wrap input { padding: 12px 38px; font-size: var(--fs-lg); }
.search-clear {
  position: absolute; right: 7px;
  width: 26px; height: 26px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--tx-3);
  font-size: var(--fs-3xl); line-height: 1; cursor: pointer;
}
.search-clear:hover { background: var(--bg-hover); color: var(--tx); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-input);
  color: var(--tx-2);
  font-weight: 600; font-size: var(--fs-base);
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.pill b { font-family: var(--ff-mono); font-size: var(--fs-xs); color: var(--tx-3); }
.pill:hover { border-color: var(--line-strong); color: var(--tx); }
.pill.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hi); }
.pill.is-active b { color: var(--brand-hi); }
.pill-close.is-active { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.pill-close.is-active b { color: var(--ok); }
.pill-defisit.is-active { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.pill-defisit.is-active b { color: var(--bad); }
.pill-segera.is-active { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.pill-segera.is-active b { color: var(--warn); }
.pill-cek.is-active { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.pill-cek.is-active b { color: var(--info); }

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--bg-panel-2);
}
.filter-row .btn { align-self: end; }

.table-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--bg-panel);
  font-size: var(--fs-base);
  color: var(--tx-2);
}
.table-meta b { color: var(--tx); font-family: var(--ff-mono); }
.meta-sep { color: var(--tx-3); }

/* --------------------------------------------------------------------------
   11. TABEL DATA
   -------------------------------------------------------------------------- */
.table-scroll {
  overflow: auto;
  contain: paint;
  max-height: calc(100vh - 340px);
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--bg-panel);
}

.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-lg); }

.dtable thead th {
  position: sticky; top: 0; z-index: 3;
  padding: 8px 12px;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  font-size: var(--fs-micro); font-weight: 700; color: var(--tx-3);
  text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.dtable thead th.num { text-align: right; }
.dtable thead th.sortable { cursor: pointer; user-select: none; }
.dtable thead th.sortable:hover { color: var(--tx); }
.dtable thead th.is-sorted { color: var(--brand-hi); }
.dtable thead th.is-sorted::after { content: ' ▾'; font-size: var(--fs-micro); }
.dtable thead th.is-sorted[data-dir="asc"]::after { content: ' ▴'; }
.col-check { width: 38px; }
.col-act { width: 84px; text-align: center !important; }

.dtable tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tbody tr { transition: background var(--dur); }
.dtable tbody tr:hover { background: var(--bg-hover); }
.dtable tbody tr.is-selected { background: var(--brand-soft); }
.dtable tbody tr.is-local { box-shadow: inset 3px 0 0 var(--accent); }
.dtable tbody tr.is-open-record { background-color: rgba(255, 255, 255, .015); }

.badge-backdate {
  display: inline-block;
  font: 700 var(--fs-micro)/1.4 var(--ff-mono);
  padding: 1px 6px;
  border-radius: var(--r-2xs);
  background: var(--warn-soft);
  color: var(--warn);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.cell-date { font-weight: 600; white-space: nowrap; }
.cell-id { font: 500 var(--fs-micro)/1.4 var(--ff-mono); color: var(--tx-3); }
.tag-unit {
  display: inline-block; padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--bg-input); border: 1px solid var(--line);
  font: 600 var(--fs-xs)/1.6 var(--ff-mono);
  white-space: nowrap;
}
.cell-sub { font-size: var(--fs-micro); color: var(--tx-3); margin-top: 3px; }
.cell-sub b { color: var(--warn); }
.cell-part { font-weight: 600; line-height: 1.35; }
.cell-codes { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 3px; font: 500 var(--fs-micro)/1.5 var(--ff-mono); color: var(--tx-3); }
.cell-mono { font: 600 var(--fs-base)/1.4 var(--ff-mono); }
.cell-muted { color: var(--tx-3); font-style: italic; font-size: var(--fs-xs); }
.cell-price { font: 600 var(--fs-base)/1.4 var(--ff-mono); }

.stock-chip {
  display: inline-block; min-width: 34px; padding: 2px 8px;
  border-radius: var(--r-xs);
  font: 700 var(--fs-xs)/1.7 var(--ff-mono);
  text-align: center;
}
.stock-chip.ok { background: var(--ok-soft); color: var(--ok); }
.stock-chip.zero { background: var(--bad-soft); color: var(--bad); }

.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs); font-weight: 600;
  white-space: nowrap;
  max-width: 190px;
}
.status-chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status-chip span { overflow: hidden; text-overflow: ellipsis; }
.status-chip.close { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.status-chip.defisit { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.status-chip.segeraGI { background: var(--warn-soft); border-color: var(--warn-soft); color: var(--warn); }
.status-chip.cekMO { background: var(--info-soft); border-color: var(--info-soft); color: var(--info); }

.sync-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-left: 4px; vertical-align: middle; }
.sync-dot[data-sync="synced"] { background: var(--ok); }
.sync-dot[data-sync="pending"], .sync-dot[data-sync="local-only"] { background: var(--warn); }
.sync-dot[data-sync="failed"] { background: var(--bad); }
.sync-dot[data-sync="unknown"] { background: var(--info); }

/* Tombol yang sedang memproses (Simpan / Cetak di Stasiun Picking). */
.btn[aria-busy="true"] { cursor: progress; opacity: 0.85; }
.btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 2s; } }

.row-acts { display: flex; gap: 4px; justify-content: center; }
.act-btn {
  display: grid; place-items: center;
  width: 29px; height: 29px;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: transparent; color: var(--tx-3);
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.act-btn svg { width: 14px; height: 14px; }
.act-btn:hover { background: var(--bg-hover); color: var(--tx); border-color: var(--line-strong); }
.act-btn.act-edit:hover { color: var(--brand-hi); border-color: var(--brand); }

.table-state { padding: 46px 20px; text-align: center; color: var(--tx-3); }
.table-state svg { width: 38px; height: 38px; margin-bottom: 12px; opacity: .5; }
.table-state p { font-weight: 700; font-size: var(--fs-lg); color: var(--tx-2); }
.table-state span { display: block; margin-top: 4px; font-size: var(--fs-base); }
.table-state .btn { margin-top: 16px; }

.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--brand-hi);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--bg-panel-2);
}
.pager-info { font-size: var(--fs-base); color: var(--tx-3); }
/* Wraps instead of overflowing. With overflow-x:clip on the body an overflowing
   pager is not just ugly, it is unreachable -- the page buttons ran to x=487 in
   a 375px viewport and were clipped away entirely. */
.pager-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.pager-nums { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.page-num {
  min-width: 31px; height: 31px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: transparent; color: var(--tx-2);
  font: 600 var(--fs-base)/1 var(--ff-mono);
  cursor: pointer;
}
.page-num:hover { background: var(--bg-hover); color: var(--tx); }
.page-num.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-gap { display: grid; place-items: center; min-width: 20px; color: var(--tx-3); }

/* --------------------------------------------------------------------------
   12. ANTREAN TINDAKAN
   -------------------------------------------------------------------------- */
.triage-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 16px;
}
.triage-head h2 { font-size: var(--fs-3xl); font-weight: 700; }
.triage-head p { font-size: var(--fs-lg); color: var(--tx-3); margin-top: 3px; }

.triage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }

.tcard {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tx-3);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  box-shadow: var(--sh-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
/* No lift on hover: this view is worked on a rack-mounted tablet, and a target
   that moves under a gloved finger is a mis-tap. */
.tcard:hover { box-shadow: var(--sh-2); border-color: var(--line-strong); }
.tcard[data-bucket="defisit"] { border-left-color: var(--bad); }
.tcard[data-bucket="segeraGI"] { border-left-color: var(--warn); }
.tcard[data-bucket="cekMO"] { border-left-color: var(--info); }

.tcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tcard-title { font-weight: 700; font-size: var(--fs-lg); line-height: 1.35; margin-top: 4px; }
.tcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.tcard-grid > div { min-width: 0; }
.tcard-grid dt { font-size: var(--fs-micro); font-weight: 600; color: var(--tx-3); text-transform: uppercase; letter-spacing: .4px; }
.tcard-grid dd { font: 600 var(--fs-base)/1.4 var(--ff-mono); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
/* margin-top: auto pins the action row to the bottom of the card. Without it the
   footer floats after the content, so a card whose material name wraps to two
   lines pushes its buttons ~18px below its neighbours' -- measured at
   y 559/559/559/577 across one grid row. The operator works down this grid
   clicking the same button on every card; it has to be in the same place. */
.tcard-acts { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.tcard-acts .btn { flex: 1; min-height: var(--h-touch); }

.state-block { grid-column: 1 / -1; padding: 50px 20px; text-align: center; color: var(--tx-3); }
.state-block h3 { font-size: var(--fs-2xl); color: var(--ok); }
.state-block p { margin-top: 8px; font-size: var(--fs-lg); }

/* --------------------------------------------------------------------------
   REMINDER PR — tabel format ME51N + alarm stok kritis
   -------------------------------------------------------------------------- */
.pr-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-top: 12px;
  border: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--bg-panel-2);
}
.pr-meta { font-size: var(--fs-sm); color: var(--tx-3); line-height: 1.6; min-width: 0; }
.pr-meta b { color: var(--tx); font-weight: 600; }
.pr-warn { color: var(--warn); font-weight: 600; }
.pr-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.pr-settings {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  padding: 12px; border: 1px solid var(--line); border-top: 0; background: var(--bg-panel);
}
.pr-settings[hidden] { display: none; }
.pr-settings input {
  min-height: var(--h-control-sm); padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-xs);
  background: var(--bg-input); color: var(--tx); font: 500 var(--fs-base) var(--ff-mono);
}
.pr-settings-acts { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

.pr-scroll { max-height: calc(100vh - 300px); }
.pr-table td.mono, .pr-table td.num { font-family: var(--ff-mono); white-space: nowrap; }
.pr-table td.num { text-align: right; }
.pr-table tbody tr { box-shadow: inset 3px 0 0 var(--warn); }
.pr-table tbody tr[data-level="HB"], .pr-table tbody tr[data-level="KR"] { box-shadow: inset 3px 0 0 var(--bad); }
.pr-mat { display: block; font-family: var(--ff-mono); }
.pr-desc { display: block; max-width: 260px; color: var(--tx-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-track {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-pill);
  font: 700 var(--fs-sm) var(--ff-mono); letter-spacing: .3px; white-space: nowrap;
  background: var(--warn-soft); color: var(--warn);
}
.pr-track[data-level="HB"], .pr-track[data-level="KR"] { background: var(--bad-soft); color: var(--bad); }
.pr-reminder { min-width: 320px; font-size: var(--fs-sm); line-height: 1.45; color: var(--tx-2); }
.pr-empty { padding: 40px 16px !important; text-align: center; color: var(--ok); font-size: var(--fs-lg); }
.pr-error { color: var(--bad); }
.pr-legend { margin-top: 8px; font-size: var(--fs-xs); color: var(--tx-3); line-height: 1.6; }
.pr-legend code { font-family: var(--ff-mono); color: var(--tx-2); }
#prBadge:not([hidden]) { animation: pr-pulse 1.6s ease-in-out infinite; }
@keyframes pr-pulse { 50% { box-shadow: 0 0 0 4px var(--bad-soft); } }
@media (prefers-reduced-motion: reduce) { #prBadge:not([hidden]) { animation: none; } }

/* --------------------------------------------------------------------------
   13. ANALITIK (ULTRA-PREMIUM S-CURVE & BOTTOM FRAME)
   -------------------------------------------------------------------------- */
.analytics-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media screen and (max-width: 1024px) {
  .analytics-main-grid { grid-template-columns: 1fr; }
}

.scurve-panel {
  display: flex;
  flex-direction: column;
}

.scurve-time-pills {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
}
.scurve-pill {
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--tx-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}
.scurve-pill:hover {
  color: var(--tx);
}
.scurve-pill.is-active {
  background: var(--brand-hi);
  color: #ffffff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 40%, transparent);
}

.scurve-chart-container {
  padding: 16px;
  min-height: 310px;
  position: relative;
}
.scurve-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.analytics-bottom-frame {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.rank-row-bar-track {
  height: 5px;
  background: var(--bg-input);
  border-radius: var(--r-2xs);
  margin-top: 4px;
  overflow: hidden;
}
.rank-row-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-2xs);
}

.bars { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: var(--fs-base); }
.bar-meta b { font-family: var(--ff-mono); }
.bar-track { height: 9px; border-radius: var(--r-pill); background: var(--bg-input); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); transition: width .5s var(--ease); }

.rank-list,
.panel .rank-list {
  display: flex;
  flex-direction: column;
}

.rank-row,
.panel .rank-row,
.analytics-bottom-frame .panel .rank-row {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px !important;
  padding: 12px 20px !important;
  border-bottom: 1px solid var(--line) !important;
  grid-template-columns: none !important;
  opacity: 1 !important;
  animation: none !important;
}

.rank-row:last-child,
.panel .rank-row:last-child,
.analytics-bottom-frame .panel .rank-row:last-child {
  border-bottom: 0 !important;
}

.rank-row-head,
.panel .rank-row-head,
.analytics-bottom-frame .panel .rank-row-head {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
}

.rank-n,
.panel .rank-n {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: var(--r-xs);
  background: var(--bg-input);
  font: 700 var(--fs-2xs)/1 var(--ff-mono);
  color: var(--tx-3);
}

.rank-row:nth-child(1) .rank-n,
.panel .rank-row:nth-child(1) .rank-n {
  background: var(--brand-soft);
  color: var(--brand-hi);
}

.rank-name,
.panel .rank-name {
  flex: 1;
  font-weight: 600;
  font-size: var(--fs-base);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx);
}

.rank-vals,
.panel .rank-vals {
  text-align: right;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.rank-main,
.panel .rank-main {
  font: 700 var(--fs-base)/1.3 var(--ff-mono);
  color: var(--tx);
  min-width: auto;
}

.rank-sub,
.panel .rank-sub {
  font-size: var(--fs-micro);
  color: var(--tx-3);
}

.rank-row-bar-track,
.panel .rank-row-bar-track,
.analytics-bottom-frame .panel .rank-row-bar-track {
  display: block !important;
  width: 100% !important;
  height: 5px !important;
  background: var(--bg-input) !important;
  border-radius: var(--r-2xs) !important;
  margin-top: 4px !important;
  overflow: hidden !important;
}

.rank-row-bar-fill,
.panel .rank-row-bar-fill,
.analytics-bottom-frame .panel .rank-row-bar-fill {
  display: block !important;
  height: 100% !important;
  background: var(--brand) !important;
  border-radius: var(--r-2xs) !important;
  transition: width .5s var(--ease) !important;
}

.trend { display: flex; align-items: flex-end; gap: 8px; padding: 22px 20px 20px; min-height: 190px; overflow-x: auto; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 44px; }
.trend-bar-wrap { display: flex; align-items: flex-end; width: 100%; height: 120px; }
.trend-bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  background: var(--brand);
  min-height: 3px;
  transition: height .5s var(--ease);
}
.trend-val { font: 700 var(--fs-2xs)/1 var(--ff-mono); color: var(--tx-2); }
.trend-label { font-size: var(--fs-micro); color: var(--tx-3); white-space: nowrap; }

/* --------------------------------------------------------------------------
   14. MODAL
   -------------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(4, 7, 13, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fade .16s var(--ease);
  overflow-y: auto;
}
.modal-card {
  width: 100%;
  max-height: calc(100vh - 44px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  box-shadow: var(--sh-3), 0 0 40px -10px rgba(0, 0, 0, .75);
  animation: rise .24s var(--ease-spring);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }

.modal-sm { max-width: 560px; }
.modal-md { max-width: 700px; }
.modal-xl { max-width: 1060px; }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex: none;
}
.modal-head h3 { font-size: var(--fs-2xl); font-weight: 700; }
.modal-sub { font-size: var(--fs-base); color: var(--tx-3); margin-top: 2px; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body .field-grid { padding: 0; }
.modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex: none;
}

.record-brief {
  padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
}
.record-brief strong { display: block; font-size: var(--fs-lg); }
.record-brief span { display: block; margin-top: 3px; font: 500 var(--fs-xs)/1.5 var(--ff-mono); color: var(--tx-3); }

.conn-status {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  margin-bottom: 16px;
}
.conn-status[data-state="on"] { border-color: var(--ok-soft); background: var(--ok-soft); }
.conn-status[data-state="off"] { border-color: var(--warn-soft); background: var(--warn-soft); }
.conn-status strong { font-size: var(--fs-lg); }
.conn-status p { font-size: var(--fs-base); color: var(--tx-2); margin-top: 3px; }
.conn-status .pill { cursor: default; }

#formConn .field { margin-bottom: 12px; }
.conn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

.guide { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.guide summary { font-weight: 600; font-size: var(--fs-lg); cursor: pointer; color: var(--tx-2); }
.guide summary:hover { color: var(--tx); }
.guide ol { margin-top: 12px; padding-left: 20px; list-style: decimal; }
.guide li { font-size: var(--fs-lg); line-height: 1.7; color: var(--tx-2); }
.guide code { padding: 1px 4px; border-radius: var(--r-2xs); background: var(--bg-input); font: 500 var(--fs-base) var(--ff-mono); }

/* --------------------------------------------------------------------------
   15. SLIP CETAK
   -------------------------------------------------------------------------- */
.slip-wrap { background: var(--bg); padding: 22px; }

.slip {
  max-width: 950px; margin: 0 auto; padding: 30px 34px;
  background: #fff; color: #10151f;
  font-size: var(--fs-base); line-height: 1.5;
  box-shadow: var(--sh-2);
}
/* Pembungkus halaman: kepala dokumen ikut tercetak ulang di tiap lembar. */
.slip-page { width: 100%; border-collapse: collapse; }
.slip-page > thead > tr > th,
.slip-page > tbody > tr > td { padding: 0; text-align: left; font-weight: inherit; }

/* ---- Kepala dokumen resmi (INTEGRATED BSS EXCELLENT SYSTEM) ---- */
.slip-doc {
  width: 100%;
  border-collapse: collapse;
  /* Lebar kolom mengikuti isi supaya label No.Dok/Halaman tidak pernah terjepit. */
  table-layout: auto;
  margin-bottom: 16px;
}
.doc-col-logo { width: 13%; }
.doc-col-label { width: 1%; }
.doc-col-value { width: 22%; }
.slip-doc td {
  border: 1px solid #10151f;
  padding: 4px 8px;
  vertical-align: middle;
  color: #10151f;
}

.doc-logo { text-align: center; padding: 8px 8px; }
.doc-logo img { display: block; width: 100%; max-width: 100%; height: auto; margin: 0 auto; }

.doc-system {
  background: #dbe5f1;
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.doc-kind,
.doc-name {
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.doc-label { font-size: var(--fs-2xs); white-space: nowrap; }
.doc-value { font-size: var(--fs-2xs); white-space: nowrap; }

/* ---- Identitas slip (di bawah kepala dokumen) ---- */
.slip-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
  padding-bottom: 12px;
  border-bottom: 2px solid #10151f;
}
.slip-subhead-text { min-width: 0; }
.slip-dept { font-size: var(--fs-micro); font-weight: 700; letter-spacing: 1.3px; color: #5a6578; text-transform: uppercase; }
.slip-title { font-size: var(--fs-3xl); font-weight: 800; margin-top: 4px; line-height: 1.25; }
.slip-subtitle { font-size: var(--fs-micro); color: #5a6578; margin-top: 3px; }
.slip-meta { font-size: var(--fs-2xs); border-collapse: collapse; flex: none; }
.slip-meta td { padding: 1.5px 4px; white-space: nowrap; }
.slip-meta td:first-child { color: #5a6578; }

.slip-info { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 0; border-bottom: 1px solid #d6dbe4; }
.slip-block { min-width: 0; }
.slip-block dt { font-size: var(--fs-micro); font-weight: 700; color: #5a6578; text-transform: uppercase; letter-spacing: .6px; }
.slip-block dd { font-size: var(--fs-lg); font-weight: 700; margin-top: 3px; font-family: var(--ff-mono); word-break: break-word; }

.slip-items { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: var(--fs-xs); }
.slip-items th {
  padding: 8px 8px;
  background: #eef1f6;
  border: 1px solid #c8cfda;
  text-align: left;
  font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
.slip-items td { padding: 8px; border: 1px solid #d6dbe4; vertical-align: top; }
.slip-items tfoot td { background: #eef1f6; font-weight: 800; text-align: right; }
.slip-items .num, .slip-items .w-price, .slip-items .w-qty { text-align: right; }
.slip-items .w-no, .slip-items .w-uom, .slip-items .w-val { text-align: center; }
.slip-items { table-layout: fixed; }
.slip-items .c-no { width: 5%; }
.slip-items .c-mat { width: 13%; }
.slip-items .c-desc { width: 30%; }
.slip-items .c-pn { width: 14.5%; }
.slip-items .c-qty { width: 6%; }
.slip-items .c-uom { width: 8.5%; }
.slip-items .c-val { width: 9%; }
.slip-items .c-price { width: 14%; }
.slip-items td, .slip-items th { overflow-wrap: anywhere; }
.slip-item-mono { font-family: var(--ff-mono); font-size: var(--fs-2xs); }
.slip-item-sub { font-size: var(--fs-micro); color: #5a6578; margin-top: 2px; }
.slip-flag-defisit { display: inline-block; margin-left: 4px; padding: 0 4px; border: 1px solid #c62c44; border-radius: var(--r-2xs); font-size: var(--fs-micro); font-weight: 700; color: #c62c44; }

.slip-notes { margin-top: 12px; padding: 8px 12px; background: #f6f8fb; border-left: 3px solid #10151f; font-size: var(--fs-2xs); }
.slip-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 30px; }
.sign { display: flex; flex-direction: column; text-align: center; }
.sign-role { font-size: var(--fs-micro); color: #5a6578; }
.sign-space { height: 52px; }
.sign-name { padding-top: 4px; border-top: 1px solid #10151f; font-size: var(--fs-base); font-weight: 700; text-transform: uppercase; }
.sign-note { font-size: var(--fs-micro); color: #5a6578; margin-top: 2px; }
.slip-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 8px; border-top: 1px solid #d6dbe4; font-size: var(--fs-micro); color: #5a6578; }
.slip-sys { font-weight: 700; letter-spacing: .5px; }

/* ==========================================================================
   MAINTENANCE ORDER (RESMI BSS) - STYLING
   ========================================================================== */
.mo-order,
.mo-order * {
  font-family: 'Times New Roman', Times, serif !important;
}

.mo-order {
  color: #000 !important;
  background: #fff !important;
  width: 100%;
  max-width: 195mm;
  margin: 0 auto;
  padding: 8mm 10mm;
  box-sizing: border-box;
  font-size: 8.5pt;
  line-height: 1.32;
}

/* KOTAK HEADER & WORK ORDER MENYATU (PERSIS BENCHMARK SAP) */
.mo-head-wo-box {
  border: 1px solid #000;
  padding: 0 !important;
  margin-bottom: 2mm;
  background: #fff;
}

.mo-header {
  display: grid;
  grid-template-columns: 46mm 1fr 46mm;
  align-items: center;
  padding: 2mm 3.5mm 1.5mm 3.5mm;
  border-bottom: 1px solid #000;
  margin-bottom: 0;
  min-height: 13.5mm;
}

.mo-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.mo-logo img {
  height: 9mm;
  width: auto;
  display: block;
}

.mo-logo-text {
  font-size: 6.5pt;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.1px;
  margin-top: 1px;
  line-height: 1;
}

.mo-title-block {
  text-align: center;
}

.mo-company-name {
  font-size: 11.5pt;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.2px;
  margin-bottom: 1mm;
  line-height: 1.15;
}

.mo-main-title {
  font-size: 14pt;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.6px;
  margin: 0;
  line-height: 1.15;
}

.mo-header-spacer {
  /* spacer for 3-column grid balance */
}

.mo-box {
  border: 1px solid #000;
  padding: 2mm 3.5mm;
  margin-bottom: 2mm;
  background: #fff;
}

.mo-wo-grid {
  padding: 1.5mm 3.5mm 0 3.5mm;
  font-size: 8.5pt;
}

.mo-row {
  display: flex;
  line-height: 1.38;
}

.mo-lbl {
  width: 40mm;
  flex-shrink: 0;
  color: #000;
}

.mo-lbl-sm {
  width: 29mm;
  flex-shrink: 0;
  color: #000;
}

.mo-val {
  flex-grow: 1;
  color: #000;
  font-weight: normal;
}

.mo-split-wrap {
  display: flex;
  width: calc(100% + 7mm);
  margin-left: -3.5mm;
  margin-top: 1.2mm;
  border-top: 1px solid #000;
}

.mo-split-left {
  flex: 1;
  padding: 1mm 3.5mm;
  border-right: 1px solid #000;
}

.mo-split-right {
  flex: 1;
  padding: 1mm 3.5mm;
}

.mo-section {
  margin-bottom: 2mm;
}

.mo-section-bar {
  text-align: center;
  font-weight: 700;
  font-size: 8.5pt;
  background: #e6e6e6 !important;
  color: #000 !important;
  border: 1px solid #000;
  border-bottom: none;
  padding: 0.8mm 2mm;
  letter-spacing: 0.2px;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.mo-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #000;
  font-size: 8pt;
  background: #fff;
}

.mo-table th,
.mo-table td {
  border: 1px solid #000;
  padding: 1mm 2mm;
  color: #000;
}

.mo-table th {
  background: #fff;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

/* Operation Table Column Widths */
.mo-table-op th:nth-child(1), .mo-table-op td:nth-child(1) { width: 7%; }
.mo-table-op th:nth-child(2), .mo-table-op td:nth-child(2) { width: 8%; }
.mo-table-op th:nth-child(3), .mo-table-op td:nth-child(3) { width: 11%; }
.mo-table-op th:nth-child(4), .mo-table-op td:nth-child(4) { width: 38%; }
.mo-table-op th:nth-child(5), .mo-table-op td:nth-child(5) { width: 8%; }
.mo-table-op th:nth-child(6), .mo-table-op td:nth-child(6) { width: 9%; }
.mo-table-op th:nth-child(7), .mo-table-op td:nth-child(7) { width: 10%; }
.mo-table-op th:nth-child(8), .mo-table-op td:nth-child(8) { width: 9%; }

/* Spare Part Reservation List Column Widths */
.mo-table-parts thead tr:first-child th:nth-child(1), .mo-table-parts tbody td:nth-child(1) { width: 7%; }
.mo-table-parts thead tr:first-child th:nth-child(2), .mo-table-parts tbody td:nth-child(2) { width: 14%; }
.mo-table-parts thead tr:first-child th:nth-child(3), .mo-table-parts tbody td:nth-child(3) { width: 38%; }
.mo-table-parts thead tr:first-child th:nth-child(4), .mo-table-parts tbody td:nth-child(4) { width: 17%; }
.mo-table-parts thead tr:first-child th:nth-child(5) { width: 24%; }
.mo-table-parts thead tr:nth-child(2) th:nth-child(1), .mo-table-parts tbody td:nth-child(5) { width: 12%; }
.mo-table-parts thead tr:nth-child(2) th:nth-child(2), .mo-table-parts tbody td:nth-child(6) { width: 12%; }

/* Time Confirmation Column Widths */
.mo-table-time thead tr:first-child th:nth-child(1), .mo-table-time tbody td:nth-child(1) { width: 7%; }
.mo-table-time thead tr:first-child th:nth-child(2), .mo-table-time tbody td:nth-child(2) { width: 14%; }
.mo-table-time thead tr:first-child th:nth-child(3), .mo-table-time tbody td:nth-child(3) { width: 23%; }
.mo-table-time thead tr:first-child th:nth-child(4) { width: 28%; }
.mo-table-time thead tr:first-child th:nth-child(5) { width: 28%; }
.mo-table-time thead tr:nth-child(2) th, .mo-table-time tbody td:nth-child(n+4) { width: 14%; }

/* Signatures Table Column Widths */
.mo-table-sign th, .mo-table-sign td { width: 50%; }

.mo-table td.mo-center {
  text-align: center;
}

.mo-table td.mo-desc {
  text-align: left;
}

.mo-sub-pn {
  font-size: 6.8pt;
  color: #444;
  margin-top: 1px;
}

.mo-pn {
  font-size: 7.2pt;
  color: #333;
  font-weight: normal;
  margin-left: 3px;
}

.mo-table td.mo-bold {
  font-weight: 700;
}

.mo-table td.mo-actual {
  min-width: 14mm;
}

.mo-notes-box {
  border: 1px solid #000;
  margin-bottom: 2.5mm;
  padding: 1.5mm 3mm;
  min-height: 11mm;
  background: #fff;
}

.mo-notes-title {
  font-weight: 700;
  font-size: 8pt;
  color: #000;
}

.mo-notes-content {
  font-size: 7.5pt;
  color: #111;
  margin-top: 1mm;
}

.mo-blank-row td {
  height: 14mm;
}

.mo-completion-box {
  border: 1px solid #000;
  padding: 2.5mm 4mm;
  display: flex;
  font-size: 8pt;
  line-height: 1.8;
  background: #fff;
}

.mo-completion-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mo-completion-col label {
  display: flex;
  align-items: center;
  color: #000;
  font-weight: normal;
}

.mo-chk {
  display: inline-block;
  width: 3.5mm;
  height: 3.5mm;
  border: 1px solid #000;
  margin-right: 2.5mm;
  flex-shrink: 0;
  background: #fff;
}

.mo-table-sign {
  border: 1px solid #000;
  margin-bottom: 2mm;
}

.mo-table-sign th {
  text-align: left;
  padding: 1.5mm 3mm;
  font-weight: normal;
  font-size: 8pt;
}

.mo-table-sign td {
  padding: 1.5mm 3mm;
  vertical-align: top;
}

.mo-sign-role {
  font-size: 8pt;
  font-weight: normal;
}

.mo-sign-space {
  height: 16mm;
}

.mo-sign-field {
  font-size: 8pt;
  line-height: 1.4;
}

.mo-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 3mm;
  font-size: 7.5pt;
  color: #000;
}

.mo-foot-right {
  text-align: right;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   16. TOAST
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(400px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--bg-elev);
  box-shadow: var(--sh-3), 0 0 20px -4px rgba(0, 0, 0, 0.4);
  font-size: var(--fs-lg); line-height: 1.5;
  animation: toastIn var(--dur-norm) var(--ease-spring);
  transition: opacity .2s, transform .2s var(--ease-spring);
}
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast-title { display: block; font-weight: 700; }
.toast-body { display: block; color: var(--tx-2); font-size: var(--fs-base); margin-top: 2px; }
.toast.is-out { opacity: 0; transform: translateX(18px) scale(.95); }
.toast[data-type="success"] { border-left-color: var(--ok); box-shadow: var(--sh-2), var(--glow-ok); }
.toast[data-type="success"] svg { color: var(--ok); }
.toast[data-type="error"] { border-left-color: var(--bad); box-shadow: var(--sh-2), var(--glow-bad); }
.toast[data-type="error"] svg { color: var(--bad); }
.toast[data-type="warn"] { border-left-color: var(--warn); box-shadow: var(--sh-2), var(--glow-warn); }
.toast[data-type="warn"] svg { color: var(--warn); }
.toast[data-type="info"] { box-shadow: var(--sh-2), var(--glow-brand); }
.toast[data-type="info"] svg { color: var(--brand-hi); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.95); } to { opacity: 1; transform: none; } }

.app-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--tx-3);
}
.app-foot #footStamp { font-family: var(--ff-mono); }

/* --------------------------------------------------------------------------
   17. RESPONSIF
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   16b. IDENTITAS / LOGO & PANDUAN KONEKSI
   -------------------------------------------------------------------------- */

/* Logo: peti material isometrik + badge "sudah dipicking". */
.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand);
  transition: background var(--dur) var(--ease);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand:hover .brand-mark { background: var(--brand-hi); }

/* Kilau tipis yang menyapu saat halaman dibuka. */
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: none;
  pointer-events: none;
}
@keyframes brandSheen {
  0% { background-position: 150% 0; }
  35%, 100% { background-position: -120% 0; }
}

.brand-name { font-size: var(--fs-2xl); letter-spacing: -.1px; }

/* Logo versi cetak di kepala slip (hitam putih, ikut currentColor). */
/* Logo slip kini memakai kop resmi BSS (lihat .slip-doc). */

/* Panduan pemasangan Apps Script (modal Koneksi). */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: setup;
}

.setup-step {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-panel-2);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.setup-step:hover { border-color: var(--line-strong); background: var(--bg-input); }

.setup-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-hi);
  font: 800 var(--fs-base)/1 var(--ff-mono);
}

.setup-body { min-width: 0; }
.setup-body b { display: block; font-size: var(--fs-lg); font-weight: 700; }
.setup-body p { margin: 4px 0 0; font-size: var(--fs-base); line-height: 1.6; color: var(--tx-2); }
.setup-body code {
  padding: 1px 4px;
  border-radius: var(--r-xs);
  background: var(--bg-input-hi);
  font: 600 var(--fs-xs)/1.5 var(--ff-mono);
  color: var(--accent);
}
.setup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.setup-actions .btn { text-decoration: none; }

/* Ringkasan jadwal sinkron otomatis di modal Koneksi. */
.conn-schedule {
  margin: 16px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  font: 600 var(--fs-xs)/1.6 var(--ff-mono);
  color: var(--tx-2);
}
.conn-schedule b { color: var(--tx); }
.warn-text { color: var(--warn); }

.setup-note {
  margin: 16px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--info);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--info-soft);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--tx-2);
}

/* ==========================================================================
   RESPONSIVE LAYOUT ENGINE (TABLET, MOBILE & COMPACT SMARTPHONES)
   ========================================================================== */

@media screen and (max-width: 1280px) {
  /* Hidden outright rather than truncated: a half-word ("Warehouse & Main...")
     reads as breakage, an absent subtitle reads as a compact header. */
  .brand-sub { display: none; }
  .station-grid { grid-template-columns: 1fr; }
  .station-side { position: static; max-height: none; }
  .panel-cart { max-height: none; }
  .cart-body { max-height: 420px; }
  .analytics-main-grid { grid-template-columns: 1fr; }
}

@media screen and (max-width: 1100px) {
  .context-metrics { grid-template-columns: repeat(2, 1fr); }
  .slip-info { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 900px) {
  /* Still three lanes, still a grid -- the middle lane just has less in it.
     The old rule set flex-wrap on what is now a grid and did nothing. */
  .topbar { gap: 12px; padding: 12px 16px; min-height: 56px; }
  .topbar-status { gap: 8px; }
  /* The sync stamp is the sacrificial element: its content is still reachable
     from the Sync Sheet panel, and the connection pill already says live/off. */
  .sync-stamp { display: none; }
  .sheet-link span { display: none; }
  .sheet-link { padding: 8px 8px; }
  .btn-label { display: none; }
  .btn-primary .btn-label { display: inline; }
  /* Stays sticky. Losing the tab bar on the view where the table is longest is
     exactly backwards -- it is more useful on a phone, not less. */
  .view-nav { top: 56px; padding: 0 16px; min-height: 48px; }
  .topbar { min-height: 56px; }
  .view-nav-inner { min-width: max-content; }
  /* The action buttons go icon-only so the tab strip keeps the width. They had
     flex:none and were crowding the tabs down to a sliver of one label.
     Each button already carries a title, which is its accessible name. */
  .view-nav-actions .btn > span { display: none; }
  .view-nav-actions .btn { padding: 0 12px; min-height: 36px; min-width: 40px; }
  /* Inline-styled flex rows in the markup that have no wrap of their own. */
  .panel-actions { flex-wrap: wrap; min-width: 0; }
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .station-side { position: static; max-height: none; }
  .table-scroll { max-height: none; }
  .analytics-grid { grid-template-columns: 1fr; }
}

@media screen and (max-width: 768px) {
  .workspace { padding: 12px 12px 24px; }
  .topbar, .context-bar, .view-nav { padding-left: 12px; padding-right: 12px; }
  
  /* Topbar & Sync info on mobile */
  .topbar-brand { gap: 8px; }
  .brand { font-size: var(--fs-lg); }
  .brand-tag { font-size: var(--fs-micro); padding: 2px 8px; }
  .topbar-status { font-size: var(--fs-2xs); }

  /* The KPI strip was a 2-column grid, so five cards left an orphan alone in
     the last row and the whole context bar ran ~400px tall -- on an 812px
     phone the chrome consumed more than a full screen before any content.
     One swipeable row of fixed-width cards costs ~86px instead, shows the
     same five, and has no orphan. */
  .context-bar { flex-direction: column; gap: 12px; padding: 12px; }
  .context-metrics {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 20px), transparent 100%);
  }
  .context-metrics::-webkit-scrollbar { display: none; }
  .metric {
    flex: 0 0 148px;
    scroll-snap-align: start;
    padding: 8px 12px;
    border-radius: var(--r-sm);
  }
  .metric-value { font-size: var(--fs-3xl); }
  .metric-foot { font-size: var(--fs-micro); }

  /* Both segments get the same box. The second had no border, so the control
     read as one bordered pill with a loose label beside it rather than as a
     two-up switch, and its meta line wrapped. */
  .segmented { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .seg {
    min-height: 44px;
    justify-content: center;
    border-color: var(--line);
    background: var(--bg-panel);
    font-size: var(--fs-base);
  }
  .seg-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Category Hero Banner on mobile */
  .category-hero-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--r-md);
  }
  .hero-cat-left {
    gap: 12px;
  }
  .hero-cat-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--r-sm);
  }
  .hero-cat-icon svg {
    width: 18px;
    height: 18px;
  }
  .hero-cat-title {
    font-size: var(--fs-base);
  }
  .hero-cat-desc {
    font-size: var(--fs-2xs);
    line-height: 1.35;
  }
  .hero-cat-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    font-size: var(--fs-base);
  }

  /* Gateway Landing Portal on mobile */
  /* Stasiun Picking Inputs on mobile */
  .field-grid { grid-template-columns: 1fr; gap: 8px; }
  .field-wide { grid-column: span 1; }
  .input, .select, .textarea {
    font-size: var(--fs-3xl) !important; /* Prevents auto-zoom on iOS */
    min-height: 44px;
  }
  .scan-box { padding: 16px 12px; }
  .scan-input { font-size: var(--fs-3xl) !important; min-height: 48px; }
  .scan-status-summary { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mass-action-bar { flex-direction: column; gap: 8px; padding: 12px; }
  .mass-btn { width: 100%; justify-content: center; min-height: 42px; }
  
  /* Cart controls on mobile */
  .cart-totals { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cart-totals .cstat-val { font-size: var(--fs-lg); }
  .cart-item { padding: 12px; gap: 8px; }
  .cart-qty-ctrl .btn-icon { min-width: 38px; min-height: 38px; }
  .cart-qty-input { min-height: 38px; font-size: var(--fs-3xl); }

  /* Kurva S & Executive Analytics on mobile */
  .analytics-resume-card {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  .resume-pill-card {
    padding: 16px 12px;
  }
  .resume-val {
    font-size: var(--fs-4xl);
  }
  .scurve-summary-matrix {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 12px 0;
  }
  .scurve-matrix-card {
    padding: 12px 12px;
  }
  .sm-label {
    font-size: var(--fs-micro);
  }
  .sm-value {
    font-size: var(--fs-lg);
  }
  .sm-sub {
    font-size: var(--fs-micro);
  }
  .scurve-chart-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 12px 8px;
  }
  .scurve-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }
  .scurve-time-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    width: 100%;
  }
  .scurve-pill {
    text-align: center;
    padding: 8px 4px;
    font-size: var(--fs-2xs);
  }
  .scurve-select-wrap {
    width: 100%;
  }
  .scurve-month-select {
    width: 100%;
    min-height: 40px;
    font-size: var(--fs-lg);
  }
  .scurve-chart-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
  }
  .scurve-svg {
    min-width: 600px;
    height: auto;
  }
  .scurve-matrix-table-wrap {
    padding: 12px 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .matrix-breakdown-table {
    min-width: 580px;
    font-size: var(--fs-xs);
  }

  /* Table View on mobile */
  .filter-bar {
    flex-direction: column;
    gap: 12px;
  }
  .search-wrap {
    width: 100%;
  }
  .search-input {
    min-height: 42px;
    font-size: var(--fs-3xl) !important;
  }
  .status-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .pagination {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
  }

  /* Modals on mobile */
  .modal { padding: 0; }
  .modal-card {
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    border: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-head, .modal-foot { border-radius: 0; padding: 12px 16px; }
  .modal-body { flex: 1; overflow-y: auto; padding: 16px 16px; }
  
  /* Floating elements */
  .toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}

/* Below 640px the action group alone is wider than the viewport. As a single
   grid row it was laid out with justify-self:end and overflowed LEFT, painting
   the buttons on top of the wrapped brand name. Two rows instead: brand, then
   the actions as a swipeable strip with the theme toggle pinned to its end. */
@media screen and (max-width: 640px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "actions";
    row-gap: 8px;
    padding: 12px 12px;
  }
  .brand { grid-area: brand; min-width: 0; }
  .brand-text { min-width: 0; }
  .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-status { display: none; }
  .topbar-actions {
    grid-area: actions;
    justify-self: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 44px), transparent 100%);
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > * { flex: none; }
  .topbar-actions .btn { min-height: 44px; }
  /* Always reachable without swiping to the end of the strip. */
  #btnTheme {
    position: sticky;
    right: 0;
    margin-left: auto;
    height: 44px;
    width: 44px;
    background: var(--bg-elev);
  }
}

@media screen and (max-width: 480px) {
  .scurve-summary-matrix { grid-template-columns: 1fr; }
  .metric-value { font-size: var(--fs-3xl); }
  .topbar-actions .btn { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   18. MODAL SUKSES SIMPAN & PINTASAN CETAK REALTIME
   -------------------------------------------------------------------------- */
.save-success-card {
  text-align: center;
  padding: 28px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.save-success-icon {
  font-size: var(--fs-display);
  line-height: 1;
  margin-bottom: 12px;
  animation: bouncePop .4s var(--ease);
}
@keyframes bouncePop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.save-success-title {
  font-size: var(--fs-4xl);
  font-weight: 800;
  color: var(--tx);
  margin-bottom: 8px;
}
.save-success-sub {
  font-size: var(--fs-lg);
  color: var(--tx-2);
  margin-bottom: 20px;
}
.save-success-summary {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 12px;
  background: var(--bg-panel-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.summary-pill {
  font-size: var(--fs-base);
  color: var(--tx-2);
}
.summary-pill strong {
  color: var(--brand-hi);
  margin-left: 4px;
}
.save-success-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-glow-print {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: var(--fs-2xl);
  font-weight: 700;
  padding: 16px 20px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--r-md);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.45);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.btn-glow-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.6);
}
.kbd-badge {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--r-2xs);
  font-family: var(--ff-mono);
  font-size: var(--fs-2xs);
  font-weight: 800;
  color: #fff;
}

/* --------------------------------------------------------------------------
   19. MODAL PASTE MASSAL (BULK SCANNER & EXCEL IMPORT)
   -------------------------------------------------------------------------- */
.bulk-instructions {
  padding: 12px 16px;
  background: var(--bg-panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: 16px;
  font-size: var(--fs-base);
  color: var(--tx-2);
}
.bulk-instructions ul {
  margin: 8px 0 0 20px;
  padding: 0;
}
.bulk-instructions li {
  margin-bottom: 3px;
}
.bulk-paste-area {
  width: 100%;
  font-family: var(--ff-mono);
  font-size: var(--fs-lg);
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--tx);
  resize: vertical;
}
.bulk-paste-area:focus {
  border-color: var(--brand-hi);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.bulk-preview-wrap {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-panel);
}
.bulk-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-lg);
  font-weight: 600;
}
.bulk-table-scroll {
  max-height: 220px;
  overflow-y: auto;
}
.bulk-table {
  width: 100%;
  font-size: var(--fs-base);
}

/* --------------------------------------------------------------------------
   20. MASS ACTION TOOLBAR & PR MODAL & QR SLIP
   -------------------------------------------------------------------------- */
.mass-action-bar {
  animation: slideDown .2s var(--ease);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 15%, transparent);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.slip-qr-box {
  border: 1px dashed var(--line-strong);
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--r-xs);
}

@media print {
  .slip-qr-box {
    border-color: #aaa !important;
    background: transparent !important;
  }
}

/* --------------------------------------------------------------------------
   21. ULTRA-PREMIUM GATEWAY PORTAL & HERO BANNER
   -------------------------------------------------------------------------- */
.category-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--bg-panel);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
}
.hero-cat-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.hero-cat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-hi);
  flex-shrink: 0;
  box-shadow: 0 0 14px color-mix(in srgb, var(--brand) 20%, transparent);
}
.hero-cat-icon-wrap svg {
  width: 24px;
  height: 24px;
}
.hero-cat-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand-hi);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.hero-cat-desc {
  font-size: var(--fs-xs);
  color: var(--tx-2);
  margin-top: 2px;
}

/* Portal Utama (#gatewayView) sepenuhnya diatur home.css — tidak ada lagi
   aturan tandingan di sini yang harus ditimpa. */
.val-cyan { color: #38bdf8 !important; }
.val-green { color: #34d399 !important; }
.val-yellow { color: #fbbf24 !important; }

/* --------------------------------------------------------------------------
   22. S-CURVE EXECUTIVE ANALYTICS STYLES
   -------------------------------------------------------------------------- */
.analytics-resume-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.resume-pill-card {
  border-radius: var(--r-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.resume-pill-card:hover {
  transform: translateY(-2px);
}
.card-daily {
  background: var(--bg-panel-2);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.card-weekly {
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
}
.card-monthly {
  background: var(--ok-soft);
  border: 1px solid rgba(22, 185, 120, 0.4);
}

.resume-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.resume-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.card-daily .resume-tag { color: var(--accent); }
.card-weekly .resume-tag { color: var(--brand-hi); }
.card-monthly .resume-tag { color: var(--ok); }
.resume-tag-ic {
  width: 16px;
  height: 16px;
}
.dot-cyan { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot-indigo { background: var(--brand-hi); box-shadow: 0 0 8px var(--brand-hi); }
.dot-green { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.resume-val {
  font: 800 var(--fs-4xl)/1.2 var(--ff);
  color: var(--tx);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.resume-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-base);
  color: var(--tx-2);
}
.foot-accent { color: var(--accent); font-weight: 600; }
.foot-brand { color: var(--brand-hi); font-weight: 600; }
.foot-green { color: var(--ok); font-weight: 600; }

.scurve-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.scurve-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scurve-label-mini {
  font-size: var(--fs-2xs);
  color: var(--tx-3);
  font-weight: 700;
  text-transform: uppercase;
}
.scurve-month-select {
  background: var(--bg-input);
  color: var(--tx);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 4px 16px;
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
}

/* S-CURVE SUMMARY MATRIX */
.scurve-summary-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 20px 0;
}
.scurve-matrix-card {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
}
.sm-label {
  font-size: var(--fs-micro);
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.sm-value {
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--tx);
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.sm-sub {
  font-size: var(--fs-2xs);
  color: var(--tx-3);
}

.scurve-chart-wrapper {
  position: relative;
  width: 100%;
}
.scurve-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--brand-hi);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--fs-xs);
  color: var(--tx);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10;
  backdrop-filter: blur(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* S-CURVE BREAKDOWN MATRIX TABLE */
.scurve-matrix-table-wrap {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.matrix-breakdown-table {
  width: 100%;
  font-size: var(--fs-base);
  border-collapse: collapse;
}
.matrix-breakdown-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: var(--fs-micro);
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.matrix-breakdown-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.matrix-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-2xs);
  overflow: hidden;
  margin-top: 4px;
}
.matrix-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-2xs);
}
.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: var(--r-2xs);
  font-size: var(--fs-micro);
  font-weight: 700;
  font-family: var(--ff-mono);
}
.delta-up { background: rgba(22, 185, 120, 0.18); color: #34d399; }
.delta-down { background: rgba(245, 69, 95, 0.18); color: #f87171; }
.delta-flat { background: rgba(255, 255, 255, 0.08); color: var(--tx-3); }



/* --------------------------------------------------------------------------
   23. MODAL PIN SESI GUDANG
   Dibuka otomatis oleh app.js saat server menolak aksi tulis (HTTP 401).
   -------------------------------------------------------------------------- */
.pin-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}
.pin-input {
  height: 52px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-input);
  color: var(--tx);
  font: 700 var(--fs-4xl)/1 var(--ff-mono);
  letter-spacing: 8px;
  text-align: center;
}
.pin-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.pin-error {
  margin: 0;
  min-height: 17px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--bad);
}
.pin-hint {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--tx-2);
}
.pin-hint code {
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--bg-input);
  border: 1px solid var(--line);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
}
.pin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

/* --------------------------------------------------------------------------
   24. MODAL PILIH KATEGORI (.cat-pick-*)
   Menggantikan 25 atribut style inline yang tidak bisa mengikuti tema
   terang/gelap maupun breakpoint.
   -------------------------------------------------------------------------- */
.cat-pick-body { padding: 20px; }
.cat-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.cat-pick {
  --cp: var(--brand);
  --cp-hi: var(--brand-hi);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-radius: var(--r-md);
  border: 2px solid var(--cp);
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--cp) 12%, transparent),
              color-mix(in srgb, var(--cp) 4%, transparent));
  text-align: center;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.cat-pick-mo { --cp: var(--brand); --cp-hi: var(--brand-hi); }
.cat-pick-ro { --cp: var(--accent); --cp-hi: var(--accent); }
.cat-pick:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -18px color-mix(in srgb, var(--cp) 90%, transparent);
}
.cat-pick.is-selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cp) 30%, transparent);
}
.cat-pick-ic {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  color: var(--cp-hi);
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--cp) 25%, transparent),
              color-mix(in srgb, var(--cp) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--cp) 40%, transparent);
}
.cat-pick-ic svg { width: 28px; height: 28px; }
.cat-pick-title { font: 800 var(--fs-3xl)/1.2 var(--ff); color: var(--cp-hi); }
.cat-pick-desc { font-size: var(--fs-base); line-height: 1.5; color: var(--tx-2); }
.cat-pick-desc strong { color: var(--tx); }
.cat-pick-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.cat-pick-tags .pill { font-size: var(--fs-2xs); }
.cat-pick-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: auto;
  height: var(--h-control);
  border-radius: var(--r-sm);
  font: 800 var(--fs-base)/1 var(--ff);
  color: var(--on-brand);
  background: var(--cp);
}
.cat-pick-ro .cat-pick-cta { color: var(--on-accent); }

/* --------------------------------------------------------------------------
   25. KELAS PENGGANTI STYLE INLINE
   Semua aturan di bawah ini sebelumnya hidup sebagai atribut style="..." di
   index.html: tidak bisa ikut tema terang/gelap, tidak bisa ikut media query,
   dan tidak bisa dipakai ulang. Perilaku visualnya dipertahankan apa adanya.
   -------------------------------------------------------------------------- */

/* Pil outbox di topbar — kini disembunyikan dengan atribut [hidden]. */
.outbox-pill {
  background: var(--warn-soft);
  border: 1px solid rgba(240, 160, 41, .4);
  color: var(--warn);
  padding: 4px 10px;
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
}
.outbox-pill[hidden] { display: none; }

.panel-actions { display: flex; align-items: center; gap: 6px; }

/* Bar aksi massal di atas tabel transaksi. */
.mass-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  border: 1px solid var(--brand-hi);
}
.mass-action-bar[hidden] { display: none; }
.mass-action-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--brand-hi);
}
.mass-action-buttons { display: flex; gap: 8px; margin-left: auto; }

.chart-slot { padding: 14px 18px 0; min-height: 180px; }

/* Kotak QR pada slip cetak. Warnanya sengaja tetap putih/abu absolut:
   slip selalu dicetak di atas kertas, apa pun tema layarnya. */
.slip-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-left: auto;
  text-align: center;
}
.slip-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  padding: 2px;
  border-radius: var(--r-2xs);
  background: #fff;
  border: 1px solid #ccc;
}
.slip-qr-label {
  font-size: var(--fs-micro);
  font-weight: 800;
  color: #333;
  letter-spacing: .5px;
}

/* Modal Integrasi & Dokumen. */
.pill-ok-solid { background: var(--ok); color: #fff; }
.conn-note {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  font-size: var(--fs-lg);
}
.conn-note-link { margin-left: 6px; color: var(--accent); text-decoration: underline; }
.conn-subhead { margin: 16px 0 8px; font-size: var(--fs-lg); color: var(--tx); }

/* Modal Purchase Request. */
.pr-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: var(--fs-lg);
}
.pr-ref { color: var(--accent); }
.pr-table-scroll {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.pr-total-label { font-weight: 700; }
.pr-total-value { font-weight: 800; color: var(--accent); }

/* --------------------------------------------------------------------------
   26. TEKS KHUSUS PEMBACA LAYAR
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   27. TOMBOL TEMA (tiga keadaan) & MODE SARUNG TANGAN
   Tombol tema dulu dua keadaan dan selalu memaksa gelap pada kunjungan
   pertama. Kini: ikut sistem -> terang -> gelap.
   -------------------------------------------------------------------------- */
#btnTheme .ic-sun,
#btnTheme .ic-moon { display: none; }
#btnTheme[data-mode="light"] .ic-sun { display: block; }
#btnTheme[data-mode="dark"] .ic-moon { display: block; }
/* Mode "ikut sistem" memakai ikon yang sesuai hasil resolusinya, dengan
   titik kecil sebagai penanda bahwa pilihannya otomatis. */
#btnTheme[data-mode="system"] .ic-moon { display: block; }
:root[data-theme="light"] #btnTheme[data-mode="system"] .ic-moon { display: none; }
:root[data-theme="light"] #btnTheme[data-mode="system"] .ic-sun { display: block; }
#btnTheme[data-mode="system"] { position: relative; }
#btnTheme[data-mode="system"]::after {
  content: '';
  position: absolute;
  right: 6px; bottom: 6px;
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

#btnDensity.is-on {
  color: var(--brand-hi);
  background: var(--brand-soft);
  border-color: var(--brand);
}

/* --------------------------------------------------------------------------
   28. TEPI AMAN — ponsel berponi / indikator home
   -------------------------------------------------------------------------- */
.topbar {
  padding-top: max(12px, var(--safe-t));
  padding-left: max(14px, var(--safe-l));
  padding-right: max(14px, var(--safe-r));
}
.workspace {
  padding-left: max(16px, var(--safe-l));
  padding-right: max(16px, var(--safe-r));
  padding-bottom: max(24px, var(--safe-b));
}
.modal-card { margin-bottom: var(--safe-b); }

/* --------------------------------------------------------------------------
   29. TARGET SENTUH DI LAYAR SEMPIT
   Token --h-touch sudah ada sejak awal tetapi hanya dipakai satu kali.
   Mulai dari lebar tablet ke bawah, setiap kontrol yang disentuh memenuhi
   tingginya; mode sarung tangan menaikkannya lagi lewat --h-touch-now.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  .btn,
  .btn-sm,
  .icon-btn,
  .act-btn,
  .vtab,
  .pill-btn,
  .rsw,
  .hp-more,
  .ipanel-more,
  .seg,
  .metric,
  .kpi,
  .module,
  .pager button,
  select,
  input[type="text"],
  input[type="date"],
  input[type="number"],
  input[type="search"] {
    min-height: var(--h-touch-now);
  }

  /* Kontrol yang isinya hanya ikon juga perlu lebar minimum. */
  .icon-btn,
  .act-btn {
    min-width: var(--h-touch-now);
  }

  /* Pengalih peringkat dulu setinggi 21 px — terlalu kecil untuk jari. */
  .rank-switch { width: 100%; }
  .rsw { flex: 1; justify-content: center; }

  .hp-more,
  .ipanel-more { padding-inline: 12px; }
}

/* Mode sarung tangan berlaku di semua lebar, bukan hanya ponsel. */
:root[data-density="glove"] .btn,
:root[data-density="glove"] .btn-sm,
:root[data-density="glove"] .icon-btn,
:root[data-density="glove"] .act-btn,
:root[data-density="glove"] .vtab,
:root[data-density="glove"] .rsw,
:root[data-density="glove"] select,
:root[data-density="glove"] input[type="text"],
:root[data-density="glove"] input[type="date"],
:root[data-density="glove"] input[type="number"],
:root[data-density="glove"] input[type="search"] {
  min-height: var(--h-touch-now);
}
:root[data-density="glove"] .icon-btn,
:root[data-density="glove"] .act-btn { min-width: var(--h-touch-now); }

/* --------------------------------------------------------------------------
   30. TABEL TRANSAKSI -> KARTU DI LAYAR SEMPIT
   Di lebar 375 px tabelnya 1.263 px di dalam wadah 351 px: 12 kolom yang
   harus digulir mendatar. Di bawah 768 px tiap baris jadi satu kartu dengan
   label kolom diambil dari atribut data-label, jadi tidak ada markup kedua
   yang harus dijaga agar tetap sinkron.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  .dtable-wrap,
  .table-scroll { overflow: visible; }

  .dtable { display: block; width: 100%; border-collapse: separate; }
  .dtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dtable tbody { display: flex; flex-direction: column; gap: 10px; }

  .dtable tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--bg-panel);
    box-shadow: var(--sh-1);
    transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast), background var(--dur-fast);
  }
  .dtable tbody tr:active {
    transform: scale(.99);
  }
  .dtable tbody tr.is-selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 16px -2px var(--brand-soft); }

  .dtable tbody td {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: baseline;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .dtable tbody td::before {
    content: attr(data-label);
    font: 700 var(--fs-micro)/1.5 var(--ff-mono);
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--tx-3);
    white-space: nowrap;
  }
  .dtable tbody td.num { text-align: left; }

  /* Baris status dan aksi memakai seluruh lebar kartu. */
  .dtable tbody td.col-act,
  .dtable tbody td.col-check { grid-template-columns: 1fr; }
  .dtable tbody td.col-check::before,
  .dtable tbody td.col-act::before { display: none; }
  .dtable tbody td.col-check {
    grid-column: 1 / -1;
    justify-items: start;
  }
  .dtable tbody td.col-act { padding-top: 6px; }
  .dtable tbody td.col-act .row-acts { display: flex; gap: 8px; }
  .dtable tbody td.col-act .act-btn { flex: 1; }

  /* Baris kosong / status tabel tetap satu blok penuh. */
  .dtable tbody td.table-state {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .dtable tbody td.table-state::before { display: none; }

  .cell-uom { color: var(--tx-3); font-size: var(--fs-micro); }
  .cell-pic { font-size: var(--fs-base); font-weight: 600; }
}

.cell-uom { color: var(--tx-3); font-size: var(--fs-micro); }
.cell-pic { font-size: var(--fs-base); font-weight: 600; }

/* --------------------------------------------------------------------------
   31. TARGET SENTUH — PENIMPA KHUSUS
   Beberapa aturan lama memakai selektor dua tingkat (mis.
   `.view-nav-actions .btn`) atau tinggi tetap, sehingga mengalahkan aturan
   umum di bagian 29. Daftar di bawah menargetkannya secara eksplisit
   dengan kekhususan yang setara atau lebih tinggi.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  .view-nav-actions .btn,
  .view-nav-actions .btn-sm,
  .panel-actions .btn,
  .panel-actions .btn-sm,
  .mass-action-buttons .btn,
  .modal-foot .btn {
    min-height: var(--h-touch-now);
  }

  /* Kapsul filter status: dulu 36 px, dipakai untuk menyaring ribuan baris. */
  .pill,
  .pill-btn { min-height: var(--h-touch-now); padding-block: 0; }

  /* Kotak centang baris: area ketuknya diperbesar lewat padding induknya,
     bukan dengan membesarkan kotaknya sendiri (yang akan terlihat janggal). */
  .dtable td.col-check,
  .dtable th.col-check { padding: 4px 0; }
  .dtable .row-check,
  #checkAll {
    width: 22px;
    height: 22px;
    margin: 11px 0;
  }

  .search-clear {
    min-width: var(--h-touch-now);
    min-height: var(--h-touch-now);
  }
}

:root[data-density="glove"] .view-nav-actions .btn,
:root[data-density="glove"] .view-nav-actions .btn-sm,
:root[data-density="glove"] .panel-actions .btn,
:root[data-density="glove"] .panel-actions .btn-sm,
:root[data-density="glove"] .pill,
:root[data-density="glove"] .search-clear {
  min-height: var(--h-touch-now);
}

/* --------------------------------------------------------------------------
   32. AREA KETUK KOTAK CENTANG & NOMOR HALAMAN
   Kotak centang 22 px tidak boleh dibesarkan begitu saja — akan terlihat
   janggal di layar lebar. Yang diperbesar adalah label pembungkusnya, jadi
   area ketuknya 44 px sementara kotaknya tetap berukuran wajar.
   -------------------------------------------------------------------------- */
.check-tap {
  display: inline-grid;
  place-items: center;
  min-width: var(--h-touch-now);
  min-height: var(--h-touch-now);
  margin: -8px;
  cursor: pointer;
}
.check-tap input { margin: 0; }

@media screen and (max-width: 768px) {
  .page-num { min-width: var(--h-touch-now); }
}
:root[data-density="glove"] .page-num { min-width: var(--h-touch-now); }

/* ==========================================================================
   33. AUTENTIKASI PENGGUNA, PROFIL OPERATOR & MODE TAMU
   ========================================================================== */
.user-auth-widget {
  display: flex;
  align-items: center;
}

.user-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--tx);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  min-height: var(--h-control-sm);
}

.user-badge-btn:hover {
  background: var(--bg-hover);
  border-color: var(--line-strong);
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: .5px;
}

.user-avatar.is-guest {
  background: var(--tx-3);
  color: var(--bg);
}

.user-avatar.is-storeman {
  background: var(--accent);
  color: var(--on-accent);
}

.user-avatar.is-staff {
  background: var(--brand);
  color: var(--on-brand);
}

.user-avatar.is-supervisor {
  background: var(--ok);
  color: var(--on-brand);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.2;
}

.user-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--tx);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: var(--fs-nano);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-hi);
  letter-spacing: .4px;
}

.user-role-badge.is-guest {
  color: var(--tx-3);
}

.user-chevron {
  width: 14px;
  height: 14px;
  color: var(--tx-3);
  margin-left: 2px;
}

/* Banner Mode Tamu */
.guest-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line-strong);
  color: var(--tx);
  font-size: var(--fs-sm);
}

.guest-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guest-banner-content .ic {
  width: 18px;
  height: 18px;
  color: var(--warn);
  flex-shrink: 0;
}

/* Modals Auth & Registrasi */
.modal-auth {
  max-width: 480px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}

.auth-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--tx-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.auth-tab:hover {
  color: var(--tx);
}

.auth-tab.is-active {
  color: var(--brand-hi);
  border-bottom-color: var(--brand);
}

.auth-body {
  padding: 18px 20px 22px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-with-icon,
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.field-ic {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--tx-3);
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 36px;
  width: 100%;
}

.input-password-wrap .form-input {
  padding-left: 36px;
  padding-right: 40px;
  width: 100%;
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 0;
  color: var(--tx-3);
  cursor: pointer;
  border-radius: var(--r-xs);
  transition: color var(--dur) var(--ease);
}

.btn-toggle-eye:hover {
  color: var(--tx);
}

.btn-toggle-eye .ic {
  width: 16px;
  height: 16px;
}

.auth-alert {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.auth-alert.is-error {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid var(--bad);
}

.auth-alert.is-success {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 4px 0;
  color: var(--tx-3);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line);
}

.auth-divider span {
  padding: 0 10px;
}

.guest-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.guest-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.guest-card-info strong {
  font-size: var(--fs-sm);
  color: var(--tx);
}

.guest-card-info span {
  font-size: var(--fs-micro);
  color: var(--tx-3);
  line-height: 1.3;
}

.auth-callout {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-hi);
  border-radius: var(--r-md);
  color: var(--tx);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.auth-callout .ic {
  width: 18px;
  height: 18px;
  color: var(--brand-hi);
  flex-shrink: 0;
  margin-top: 1px;
}

.auth-callout strong {
  display: block;
  font-size: var(--fs-sm);
  margin-bottom: 2px;
}

.auth-callout p {
  margin: 0;
  color: var(--tx-2);
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Modal Profil User Aktif */
.profile-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.profile-avatar-big {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-xl);
  font-weight: 700;
}

.profile-meta h4 {
  margin: 0 0 4px;
  font-size: var(--fs-lg);
  color: var(--tx);
}

.profile-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-hi);
  font-size: var(--fs-nano);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.profile-details-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.detail-k {
  color: var(--tx-3);
}

.detail-v {
  color: var(--tx);
  font-weight: 600;
}

.profile-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

/* Modal Guest Blocked */
.modal-guest-blocked {
  max-width: 420px;
}

.guest-blocked-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--warn-soft);
  color: var(--warn);
  margin-right: 12px;
}

.guest-blocked-icon svg {
  width: 22px;
  height: 22px;
}

.guest-blocked-note {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-top: 12px;
  background: var(--bg-panel-2);
  border-radius: var(--r-sm);
  color: var(--tx-2);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.guest-blocked-note .ic {
  width: 16px;
  height: 16px;
  color: var(--tx-3);
  flex-shrink: 0;
}

.field-user-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: var(--r-pill);
  font-size: var(--fs-nano);
  font-weight: 600;
  text-transform: none;
}

.field-user-tag .ic {
  width: 10px;
  height: 10px;
}

@media screen and (max-width: 768px) {
  .user-badge-btn {
    padding: 4px;
  }
  .user-info {
    display: none;
  }
  .field-grid-2 {
    grid-template-columns: 1fr;
  }
  .guest-mode-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* User Management Modal Styles */
.topbar-badge-pending {
  background: var(--warn);
  color: #fff;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
}

.profile-manage-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.user-mgmt-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-mgmt-body {
  padding: 16px 20px;
}

.user-mgmt-notice {
  background: var(--bg-hover);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.user-mgmt-notice-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.user-mgmt-notice-text {
  flex: 1;
  min-width: 280px;
}

.user-mgmt-notice-title {
  font-weight: 600;
  font-size: var(--fs-xl);
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-mgmt-notice-desc {
  font-size: var(--fs-md);
  color: var(--tx-2);
  margin: 4px 0 0 0;
  line-height: 1.5;
}

.user-mgmt-notice-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.user-mgmt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.user-filter-tabs {
  display: flex;
  gap: 6px;
}

.user-filter-pending-count {
  color: var(--warn);
  font-weight: 700;
}

.user-mgmt-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-mgmt-search-input {
  width: 200px;
}

.user-mgmt-table-wrap {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.user-mgmt-table {
  width: 100%;
  margin: 0;
}

.user-mgmt-nik-col { width: 105px; }
.user-mgmt-role-col { width: 100px; }
.user-mgmt-reg-col { width: 150px; }
.user-mgmt-status-col { width: 115px; }
.user-mgmt-login-col { width: 140px; }
.user-mgmt-action-col { width: 155px; text-align: right; }

.user-mgmt-empty-cell {
  text-align: center;
  padding: 32px;
  color: var(--tx-2);
}

.user-mgmt-nik-code {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--brand-hi);
}

.user-mgmt-user-name {
  font-weight: 600;
  color: var(--tx);
}

.user-mgmt-user-sub {
  color: var(--tx-2);
  font-size: var(--fs-2xs);
}

.user-mgmt-date-cell {
  font-size: var(--fs-sm);
  color: var(--tx-2);
}

.user-mgmt-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.pill-pending {
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 700;
}

.btn-approve-user {
  background: var(--ok);
  color: var(--on-brand);
  padding: 4px 8px;
  font-size: var(--fs-sm);
}

.btn-reject-user {
  color: var(--bad);
  padding: 4px 8px;
  font-size: var(--fs-sm);
}

.btn-suspend-user {
  color: var(--tx-2);
  padding: 4px 8px;
  font-size: var(--fs-sm);
}

.btn-del-user {
  color: var(--bad);
  padding: 4px 8px;
  font-size: var(--fs-sm);
}

/* --------------------------------------------------------------------------
   INTEGRASI SPREADSHEET & DIAGNOSTIK KECEPATAN (SPEED TEST)
   -------------------------------------------------------------------------- */
.conn-tabs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.conn-tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--tx);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.conn-tab-chip:hover {
  background: var(--bg-hover);
  border-color: var(--line-strong);
  color: var(--accent);
}

.conn-diag-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.conn-diag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.conn-diag-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 6px;
}

.conn-diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.conn-diag-card {
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conn-diag-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--tx-2);
}

.conn-diag-val {
  font-size: var(--fs-lg);
  font-weight: 700;
  font-family: var(--ff-mono);
  color: var(--tx);
}

.conn-diag-sub {
  font-size: var(--fs-2xs);
  color: var(--tx-3);
  margin: 0;
}

.conn-diag-badge {
  font-size: var(--fs-nano);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-2xs);
  text-transform: uppercase;
}

.conn-diag-badge.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.conn-diag-badge.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.conn-diag-badge.badge-error {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ============================================================================
   MODAL AUDIT LOG & JEJAK TRANSAKSI
   ============================================================================ */
.audit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-toolbar-left,
.audit-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.audit-search-input {
  width: 220px;
}

.audit-table-wrap {
  max-height: 480px;
  overflow-y: auto;
}

.audit-col-id { width: 60px; }
.audit-col-time { width: 160px; }
.audit-col-nik { width: 110px; }
.audit-col-op { width: 160px; }
.audit-col-act { width: 140px; }
.audit-col-type { width: 70px; }
.audit-col-reason { width: auto; }

/* ============================================================================
   MODAL PEMINDAI BARCODE KAMERA (ZXing)
   ============================================================================ */
.modal-cam-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.cam-preview-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.cam-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-laser-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cam-target-box {
  position: relative;
  width: 70%;
  height: 55%;
  border: 2px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), 0 0 20px -2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.cam-target-box::before,
.cam-target-box::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.cam-target-box::before {
  top: -2px;
  left: -2px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
}
.cam-target-box::after {
  bottom: -2px;
  right: -2px;
  border-bottom: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
}

.cam-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 72, 100, 0.8) 20%, #ffffff 50%, rgba(255, 72, 100, 0.8) 80%, transparent 100%);
  box-shadow: 0 0 12px 2px var(--bad), 0 0 24px 4px rgba(255, 72, 100, 0.5);
  animation: laserScan 2.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}
.cam-laser-line::after {
  content: '';
  position: absolute;
  left: 5%;
  right: 5%;
  top: -12px;
  height: 24px;
  background: radial-gradient(ellipse at center, rgba(255, 72, 100, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes laserScan {
  0% { top: 6%; opacity: .8; }
  50% { opacity: 1; }
  100% { top: 94%; opacity: .8; }
}

.cam-status-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 16, 26, 0.85);
  border: 1px solid var(--line-strong);
  color: var(--tx);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.cam-controls-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  justify-content: space-between;
  align-items: center;
}

.cam-device-select {
  font-size: var(--fs-sm);
}

.cam-help-text {
  font-size: var(--fs-xs);
}



