/* WGN Inventory — tampilan bersih, ramah HP teknisi. */
:root {
  --accent: #d6336c;
  --accent-strong: #b8245a;
  --accent-2: #f06595;
  --accent-soft: #fdebf2;
  --accent-grad: linear-gradient(135deg, #f472a6 0%, #d6336c 55%, #b8245a 100%);
  --bg: #f4f3f8;
  --surface: #ffffff;
  --surface-2: #f9f8fc;
  --field: #f3f2f7;
  --line: #e9e6ef;
  --line-2: #dcd8e5;
  --text: #1e1b2c;
  --text-2: #57536b;
  --muted: #9894aa;
  --ok: #15803d;      --ok-soft: #e4f5ea;
  --info: #2563eb;    --info-soft: #e7eefd;
  --warn: #b45309;    --warn-soft: #fdf1df;
  --violet: #7c3aed;  --violet-soft: #f0e9fe;
  --danger: #dc2626;  --danger-soft: #fdeaea;
  --slate: #64748b;   --slate-soft: #eef1f5;
  --teal: #0f8f86;    --teal-soft: #e0f5f3;
  --shadow-sm: 0 1px 2px rgba(30, 27, 44, .05), 0 2px 8px rgba(30, 27, 44, .04);
  --shadow: 0 10px 30px -12px rgba(30, 27, 44, .18);
  --shadow-lg: 0 30px 60px -20px rgba(30, 27, 44, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --side-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-strong); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace; font-size: .92em; letter-spacing: .01em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 16px; height: 16px; }
svg.i-lg { width: 26px; height: 26px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, #fbd3e3 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #e5dcfb 0%, transparent 60%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius-lg);
  padding: 32px 28px; box-shadow: var(--shadow-lg); display: grid; gap: 14px;
}
.login-card h1 { margin: 6px 0 0; font-size: 22px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 6px; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 14px; background: var(--accent-grad); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(214, 51, 108, .6);
}

/* ---------- Form ---------- */
label.f { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label.f > span.hint { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.inp, select.inp, textarea.inp {
  width: 100%; border: 1px solid var(--line); background: var(--field); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--text); outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
  min-height: 42px;
}
textarea.inp { resize: vertical; min-height: 84px; line-height: 1.5; }
.inp:focus { border-color: var(--accent-2); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.inp:disabled { opacity: .7; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239894aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 1em; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); border-radius: var(--radius-sm); padding: 9px 14px; font-weight: 700; font-size: 13.5px;
  min-height: 40px; transition: transform .1s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px rgba(214, 51, 108, .8); }
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.05); border-color: transparent; }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.btn-soft:hover { background: #fbdce8; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--field); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12.5px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--text-2); flex: none; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand .logo-mark { width: 40px; height: 40px; border-radius: 12px; }
.brand b { display: block; font-size: 15.5px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; font-weight: 600; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; border: 0; background: none;
  color: var(--text-2); font-weight: 600; font-size: 14px; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--field); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-item .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--accent-strong); background: var(--accent-soft); flex: none; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: rgba(244, 243, 248, .86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search { position: relative; width: min(340px, 36vw); }
.top-search .inp { padding-left: 40px; background: var(--surface); }
.top-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.mobile-only { display: none !important; }
.view { padding: 6px 28px 40px; display: grid; gap: 18px; align-content: start; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; flex: 1; }
.card-b { padding: 6px 18px 18px; }
.card-b.flush { padding: 0; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-weight: 600; }
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; color: var(--line-2); }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12.5px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.kpi .lbl .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; }
.kpi .val { font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi.click { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kpi.click:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; }

/* ---------- Tones ---------- */
.t-ok { color: var(--ok); background: var(--ok-soft); }
.t-info { color: var(--info); background: var(--info-soft); }
.t-warn { color: var(--warn); background: var(--warn-soft); }
.t-violet { color: var(--violet); background: var(--violet-soft); }
.t-danger { color: var(--danger); background: var(--danger-soft); }
.t-slate { color: var(--slate); background: var(--slate-soft); }
.t-teal { color: var(--teal); background: var(--teal-soft); }
.t-accent { color: var(--accent-strong); background: var(--accent-soft); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--field); color: var(--text-2); }

/* ---------- Table ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl .t-main { font-weight: 700; }
.tbl .t-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.tbl th.right, .tbl td.right { text-align: right; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .inp { width: auto; min-width: 160px; min-height: 38px; padding-top: 7px; padding-bottom: 7px; font-size: 13.5px; }
.filters .search-inp { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.chip .n { opacity: .6; margin-left: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* List rows (dashboard / mobile) */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--surface-2); }
.li .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.li .body { min-width: 0; flex: 1; }
.li .body b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .body span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .end { text-align: right; flex: none; font-size: 12px; color: var(--muted); font-weight: 600; }
.li .end b { display: block; font-size: 14px; color: var(--text); }
.bar { height: 6px; border-radius: 99px; background: var(--field); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--danger); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--field); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Teknisi: tas saya ---------- */
.hero {
  background: var(--accent-grad); color: #fff; border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden;
  box-shadow: 0 20px 40px -20px rgba(184, 36, 90, .7);
}
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero small { opacity: .85; font-weight: 600; }
.hero h2 { margin: 2px 0 12px; font-size: 20px; letter-spacing: -.02em; }
.hero .stats { display: flex; gap: 20px; position: relative; z-index: 1; }
.hero .stats b { display: block; font-size: 24px; letter-spacing: -.02em; }
.hero .stats span { font-size: 12px; opacity: .85; font-weight: 600; }
.actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.action {
  display: grid; justify-items: center; gap: 8px; padding: 14px 8px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; font-size: 12.5px; text-align: center; color: var(--text); box-shadow: var(--shadow-sm);
}
.action:active { transform: scale(.97); }
.action .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(24, 20, 38, .45); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: pop .18s ease; margin-bottom: 5vh;
}
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-h h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; flex: 1; min-width: 0; }
.modal-h .sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.modal-b { padding: 6px 20px 18px; display: grid; gap: 14px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.modal-f .form-error { flex: 1; align-self: center; min-width: 180px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

.timeline { display: grid; gap: 0; position: relative; }
.tl { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.tl::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.tl .dot svg { width: 14px; height: 14px; }
.tl b { font-size: 13.5px; }
.tl .meta { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Transaksi ---------- */
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .1s;
}
.type-card:hover { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
.type-card .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.type-card b { display: block; font-size: 14px; }
.type-card span { font-size: 12px; color: var(--muted); font-weight: 500; }
.section-t { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 -4px; display: flex; align-items: center; gap: 8px; }
.adder { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; background: var(--surface-2); }
.adder-row { display: flex; gap: 8px; align-items: stretch; }
.adder-row .inp { flex: 1; min-width: 0; }
.lines { display: grid; gap: 8px; }
.line {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.line .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.line .body { flex: 1; min-width: 0; }
.line .body b { display: block; font-size: 13.5px; }
.line .body span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.line .qty { width: 92px; min-height: 36px; padding: 6px 8px; text-align: right; }
.line select.inp { width: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.lines-sum { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pick-grp { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; background: var(--surface); }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; font-weight: 600; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.suggest { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-top: 1px solid var(--line); }
.suggest button:first-child { border-top: 0; }
.suggest button:hover { background: var(--surface-2); }
.suggest b { font-size: 13.5px; }
.suggest span { display: block; font-size: 12px; color: var(--muted); }
.cust-chosen { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--info-soft); }
.cust-chosen b { display: block; }
.cust-chosen span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.note-box { padding: 10px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }

/* ---------- Scanner ---------- */
.scan-back { position: fixed; inset: 0; z-index: 80; background: #0d0b14; display: flex; flex-direction: column; }
.scan-back video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scan-frame { position: absolute; left: 50%; top: 42%; width: min(78vw, 360px); height: 150px; transform: translate(-50%, -50%); border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.scan-bar { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; color: #fff; background: #0d0b14; }
.scan-bar .grow { font-size: 13px; font-weight: 600; }
.scan-last { position: absolute; left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top)); color: #fff; font-weight: 700; text-align: center; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 100; opacity: 0; pointer-events: none;
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

/* ---------- Bottom nav (HP) ---------- */
.bottom-nav { display: none; }
.fab { display: none; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  body { font-size: 14.5px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .topbar h1 { font-size: 19px; }
  .top-search { display: none; }
  .view { padding: 4px 14px calc(100px + env(safe-area-inset-bottom)); gap: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 22px; }
  .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { padding: 12px 14px; }
  .filters .inp { flex: 1 1 140px; min-width: 0; }
  .card-h { padding: 14px 14px 8px; }
  .card-b { padding: 6px 14px 14px; }
  .li { padding: 12px 14px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .type-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }

  /* Tabel → kartu di HP */
  .tbl.stackable thead { display: none; }
  .tbl.stackable, .tbl.stackable tbody, .tbl.stackable tr, .tbl.stackable td { display: block; width: 100%; }
  .tbl.stackable tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .tbl.stackable tr:last-child { border-bottom: 0; }
  .tbl.stackable td { padding: 0; border: 0; }
  .tbl.stackable td.hide-m { display: none; }
  .tbl.stackable td.m-end { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
  .tbl.stackable td.m-full { grid-column: 1 / -1; }
  .tbl.stackable td.right { text-align: left; }

  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 22px 22px 0 0; margin: 0; max-height: 94vh; max-height: 94dvh; animation: up .22s ease; }
  .modal-b { overflow-y: auto; }
  .modal-f { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  @keyframes up { from { transform: translateY(40px); opacity: .4; } }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bn { border: 0; background: none; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--muted); position: relative; }
  .bn.active { color: var(--accent-strong); }
  .bn .count { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--danger); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 31;
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent-grad); color: #fff; box-shadow: 0 14px 30px -10px rgba(184, 36, 90, .8);
  }
  .fab svg { width: 26px; height: 26px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .val { font-size: 20px; }
}

/* ---------- Cetak bukti transaksi ---------- */
@media print {
  body { background: #fff; }
  .shell, .bottom-nav, .fab, .toast, .modal-f, .no-print { display: none !important; }
  .modal-back { position: static; background: none; padding: 0; backdrop-filter: none; display: block; }
  .modal, .modal.wide { box-shadow: none; max-width: none; max-height: none; border-radius: 0; animation: none; }
  .modal-b { overflow: visible; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 30px; text-align: center; font-size: 13px; }
.sign div { padding-top: 70px; border-bottom: 1px solid #999; }

/* Utilitas (pengganti style inline — CSP style-src 'self') */
.warn-txt { color: var(--warn); }
.row-flex.tight { gap: 6px; }
.pw-form { margin-top: 18px; max-width: 560px; }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt8 { margin-top: 8px; }
.sign p { margin: 0; }
@media (max-width: 860px) { .kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.k3 .kpi .val { font-size: 19px; } }

/* Grid satu kolom tidak boleh melebar mengikuti teks nowrap (penyebab scroll horizontal di HP). */
.view, .stack, .modal-b, .list, .lines, .timeline, .adder, .login-card { grid-template-columns: minmax(0, 1fr); }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
@media (max-width: 860px) {
  .modal-back { flex-direction: column; justify-content: flex-end; align-items: stretch; overflow: hidden; padding-top: 12px; }
  .modal, .modal.wide { max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); overflow: hidden; }
  .modal-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-h, .modal-f { flex: none; }
}
.li .body b .mono { display: inline; font-size: inherit; color: inherit; font-weight: 700; }
.kpi .val.money { font-size: clamp(18px, 1.7vw, 24px); white-space: nowrap; }
.modal-f .form-error:empty { display: none; }

/* ---------- Work Order ---------- */
.li .body span span, .li .body span svg { display: inline; }
.li .body b.wrap { white-space: normal; }
.li.unread { background: var(--accent-soft); }
.danger-txt { color: var(--danger) !important; font-weight: 700; }
.mt4 { margin-top: 4px; }
svg.i-xs { width: 13px; height: 13px; vertical-align: -2px; }
.desc { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.ph { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--field); aspect-ratio: 1; }
.ph a { display: block; width: 100%; height: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph span { position: absolute; left: 6px; bottom: 6px; background: rgba(20, 16, 32, .65); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; text-transform: capitalize; }
.ph-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(20, 16, 32, .65); color: #fff; display: grid; place-items: center; }
.bell { position: relative; }
.bell-n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.wc-sel { width: auto !important; max-width: 48%; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 12.5px; }
.reg-box summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--accent-strong); padding: 4px 0; }
.line .qty, .adder-row .qty { flex: 0 0 96px; width: 96px; }
@media (max-width: 860px) {
  .wc-sel { max-width: 56%; }
  .modal-f .btn { flex: 1 1 auto; }
}
/* Judul grup di daftar SN menempel di atas — beri ruang agar baris yang di-scroll/fokus tidak tertutup. */
.pick-list { scroll-padding-top: 34px; }
.pick { scroll-margin-top: 34px; }
.pick-grp { z-index: 1; }
/* Baris grid di dalam sheet yang bisa di-scroll tidak boleh menyusut (daftar SN sempat kolaps ±20px di HP). */
.modal-b { grid-auto-rows: max-content; }
