:root {
  --navy: #0f4c5c;
  --navy-2: #16616f;
  --gold: #e09f3e;
  --gold-soft: #fcefdc;
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #667085;
  --line: #e4e7ec;
  --danger: #c0362c;
  --ok: #2e7d32;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; }
a { color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Halaman login / setup ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 16px;
  padding: 28px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand img { width: 40px; height: 40px; }
.brand b { font-size: 18px; letter-spacing: .5px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.auth-card h1 { font-size: 20px; margin: 0 0 6px; }
.auth-card p.lead { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Form ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=tel], select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none;
}
input:focus, select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15, 76, 92, .12); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; font-weight: 600;
  background: var(--navy); color: #fff;
}
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #f1c7c3; }

.msg { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.msg.error { background: #fdecea; color: var(--danger); }
.msg.ok { background: #e8f5e9; color: var(--ok); }
.hidden { display: none !important; }

/* ---------- Kerangka aplikasi ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 240px; flex-shrink: 0; background: var(--navy); color: #dceef0;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.side .brand { color: #fff; padding: 0 8px; }
.side .brand small { color: #9fc2c8; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; flex: 1; overflow-y: auto; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #8fb6bd; margin: 14px 10px 6px; }
.nav a {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 8px; text-decoration: none; color: #dceef0; font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .07); }
.nav a.active { background: var(--gold); color: var(--navy); font-weight: 600; }
.nav a .soon { font-size: 10px; opacity: .7; }
.side .me { border-top: 1px solid rgba(255, 255, 255, .12); padding: 12px 8px 0; font-size: 13px; }
.side .me b { display: block; color: #fff; }
.side .me .btn { margin-top: 10px; width: 100%; background: rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; display: block;
}
.tile:hover { border-color: var(--gold); }
.tile b { display: block; margin-bottom: 4px; }
.tile span { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: #8a5414; font-weight: 600; }
.badge.grey { background: #eef0f4; color: var(--muted); }
.badge.green { background: #e8f5e9; color: var(--ok); }
.badge.red { background: #fdecea; color: var(--danger); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
table.perm th, table.perm td { text-align: center; }
table.perm th.mod, table.perm td.mod { text-align: left; white-space: nowrap; font-weight: 600; }
table.perm th.role { font-size: 13px; color: var(--text); text-transform: none; border-bottom: 2px solid var(--line); }
table.perm .k { background: #eef7f4; }
table.perm .a { background: #fdf4e7; }
table.perm input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- Modul stok ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  text-align: left; cursor: pointer; color: var(--text);
}
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.stat[data-st=habis] b, .stat[data-st=kritis] b { color: var(--danger); }
.stat[data-st=menipis] b { color: #a5661c; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--gold); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; flex: 1 1 180px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.card.flush { padding: 4px 0; }
table.list td, table.list th { vertical-align: top; }
table.list th:first-child, table.list td:first-child { padding-left: 16px; }
table.list td.actions { padding-right: 12px; }
.r { text-align: right !important; }
.nowrap { white-space: nowrap; }
.sub { font-size: 12px; color: var(--muted); }
.badge.gold { background: var(--gold-soft); color: #8a5414; }
input[type=search], input[type=date] { font: inherit; }
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(15, 76, 92, .45); }
.dform { padding: 20px; }
.dform h2 { margin: 0 0 4px; font-size: 18px; }
.dform > .sub, .dform > p.sub { margin: 0 0 14px; }
.dform input[type=date] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; }
.seg input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(15, 76, 92, .2); }
.grow { flex: 1; }
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid2 { grid-template-columns: 1fr; }
}
.show-sm { display: none; }
@media (max-width: 820px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  table.list td.actions .btn { margin: 0; }
}

/* ---------- Modul produksi ---------- */
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stat.on, button.stat { font: inherit; }
div.stat { cursor: default; }
.daybar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.daybar input[type=date] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.team { margin-bottom: 10px; }
.team-name { text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin: 6px 0; }
.att-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.seg.small { margin: 0; gap: 4px; flex-wrap: nowrap; }
.seg.small span { padding: 5px 10px; min-width: 34px; text-align: center; font-size: 13px; }
.seg input:disabled + span { opacity: .6; cursor: default; }
.seg input:checked + span.att-hadir { background: var(--ok); border-color: var(--ok); }
.seg input:checked + span.att-setengah { background: #a5661c; border-color: #a5661c; }
.seg input:checked + span.att-alpa { background: var(--danger); border-color: var(--danger); }
.linkbtn { background: none; border: 0; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.log-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.log-form select, .log-form input { flex: 1 1 160px; width: auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.log-form select[name=productId] { flex: 3 1 260px; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tr.muted td { color: #a0a7b4; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
label.inline input { flex: none; }
@media (max-width: 820px) {
  .stats.three { grid-template-columns: repeat(3, 1fr); }
  .stats.three .stat b { font-size: 18px; }
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- Modul barang jadi ---------- */
input.stock-in { width: 90px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: right; font: inherit; }
input.stock-in.changed { border-color: var(--gold); background: var(--gold-soft); }
.stock-in::placeholder { color: #b8bfcc; }
tr.grouprow td { background: #f7f8fa; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.savebar {
  position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  background: var(--navy); color: #fff; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
}
.savebar span { margin-right: auto; font-weight: 600; }
.savebar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
label.check { flex: none; cursor: pointer; }
@media (max-width: 820px) { .savebar { top: 52px; } }
.flabel { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.checks input[type=text] { width: 150px; padding: 7px 10px; }
.sku-preview { background: #f7f8fa; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.sku-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: center; margin-top: 6px; }
.sku-row input { padding: 7px 10px; font-family: ui-monospace, Menlo, monospace; }

/* ---------- Keuangan ---------- */
.pos { color: var(--ok) !important; }
.neg { color: var(--danger) !important; }
.stat b.pos, .stat b.neg { font-size: 20px; }
.wallets { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wallet { background: var(--navy); color: #dceef0; border-radius: var(--radius); padding: 10px 14px; min-width: 150px; }
.wallet span { display: block; font-size: 12px; }
.wallet b { color: #fff; font-size: 17px; }
.wallet.total { background: var(--gold); color: var(--navy); }
.wallet.total b { color: var(--navy); }
input[type=month] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.photo-prev { display: block; max-width: 100%; max-height: 180px; margin-top: 8px; border-radius: 8px; border: 1px solid var(--line); }
.photo-dlg { padding: 12px; width: min(720px, calc(100vw - 24px)); }
.photo-dlg img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto 10px; border-radius: 8px; }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; }
table.pl td { padding: 7px 8px; }
td.indent { padding-left: 28px !important; color: var(--muted); }
tr.total.big td { font-size: 17px; border-top: 3px double var(--line); }
.bar-row { margin-bottom: 10px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.bar { height: 8px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.check-line { display: flex !important; align-items: center; gap: 8px; font-size: 14px; }
.check-line input { width: auto; }
.bar i.w0 { width: 0%; }
.bar i.w1 { width: 1%; }
.bar i.w2 { width: 2%; }
.bar i.w3 { width: 3%; }
.bar i.w4 { width: 4%; }
.bar i.w5 { width: 5%; }
.bar i.w6 { width: 6%; }
.bar i.w7 { width: 7%; }
.bar i.w8 { width: 8%; }
.bar i.w9 { width: 9%; }
.bar i.w10 { width: 10%; }
.bar i.w11 { width: 11%; }
.bar i.w12 { width: 12%; }
.bar i.w13 { width: 13%; }
.bar i.w14 { width: 14%; }
.bar i.w15 { width: 15%; }
.bar i.w16 { width: 16%; }
.bar i.w17 { width: 17%; }
.bar i.w18 { width: 18%; }
.bar i.w19 { width: 19%; }
.bar i.w20 { width: 20%; }
.bar i.w21 { width: 21%; }
.bar i.w22 { width: 22%; }
.bar i.w23 { width: 23%; }
.bar i.w24 { width: 24%; }
.bar i.w25 { width: 25%; }
.bar i.w26 { width: 26%; }
.bar i.w27 { width: 27%; }
.bar i.w28 { width: 28%; }
.bar i.w29 { width: 29%; }
.bar i.w30 { width: 30%; }
.bar i.w31 { width: 31%; }
.bar i.w32 { width: 32%; }
.bar i.w33 { width: 33%; }
.bar i.w34 { width: 34%; }
.bar i.w35 { width: 35%; }
.bar i.w36 { width: 36%; }
.bar i.w37 { width: 37%; }
.bar i.w38 { width: 38%; }
.bar i.w39 { width: 39%; }
.bar i.w40 { width: 40%; }
.bar i.w41 { width: 41%; }
.bar i.w42 { width: 42%; }
.bar i.w43 { width: 43%; }
.bar i.w44 { width: 44%; }
.bar i.w45 { width: 45%; }
.bar i.w46 { width: 46%; }
.bar i.w47 { width: 47%; }
.bar i.w48 { width: 48%; }
.bar i.w49 { width: 49%; }
.bar i.w50 { width: 50%; }
.bar i.w51 { width: 51%; }
.bar i.w52 { width: 52%; }
.bar i.w53 { width: 53%; }
.bar i.w54 { width: 54%; }
.bar i.w55 { width: 55%; }
.bar i.w56 { width: 56%; }
.bar i.w57 { width: 57%; }
.bar i.w58 { width: 58%; }
.bar i.w59 { width: 59%; }
.bar i.w60 { width: 60%; }
.bar i.w61 { width: 61%; }
.bar i.w62 { width: 62%; }
.bar i.w63 { width: 63%; }
.bar i.w64 { width: 64%; }
.bar i.w65 { width: 65%; }
.bar i.w66 { width: 66%; }
.bar i.w67 { width: 67%; }
.bar i.w68 { width: 68%; }
.bar i.w69 { width: 69%; }
.bar i.w70 { width: 70%; }
.bar i.w71 { width: 71%; }
.bar i.w72 { width: 72%; }
.bar i.w73 { width: 73%; }
.bar i.w74 { width: 74%; }
.bar i.w75 { width: 75%; }
.bar i.w76 { width: 76%; }
.bar i.w77 { width: 77%; }
.bar i.w78 { width: 78%; }
.bar i.w79 { width: 79%; }
.bar i.w80 { width: 80%; }
.bar i.w81 { width: 81%; }
.bar i.w82 { width: 82%; }
.bar i.w83 { width: 83%; }
.bar i.w84 { width: 84%; }
.bar i.w85 { width: 85%; }
.bar i.w86 { width: 86%; }
.bar i.w87 { width: 87%; }
.bar i.w88 { width: 88%; }
.bar i.w89 { width: 89%; }
.bar i.w90 { width: 90%; }
.bar i.w91 { width: 91%; }
.bar i.w92 { width: 92%; }
.bar i.w93 { width: 93%; }
.bar i.w94 { width: 94%; }
.bar i.w95 { width: 95%; }
.bar i.w96 { width: 96%; }
.bar i.w97 { width: 97%; }
.bar i.w98 { width: 98%; }
.bar i.w99 { width: 99%; }
.bar i.w100 { width: 100%; }

/* ---------- Pesanan & kirim ---------- */
dialog.wide { width: min(780px, calc(100vw - 24px)); }
.sect { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 8px; }
.form-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.form-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
.row-start { display: flex; gap: 8px; margin-bottom: 8px; }
.row-start.wrap, .row-end.wrap { flex-wrap: wrap; }
.totalbox { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 12px 14px; margin: 6px 0 4px; }
.totalbox b { font-size: 18px; color: var(--gold); }
.pick-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 8px 6px; cursor: pointer; font: inherit; }
.pick-list button:hover { background: var(--gold-soft); }
.pick-list { max-height: 200px; overflow-y: auto; }
#custQ { width: 100%; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font: inherit; }
table.list.clickable tbody tr[data-id] { cursor: pointer; }
table.list.clickable tbody tr[data-id]:hover td { background: #fafbfc; }
.detail-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.detail-head .badge { margin-bottom: 4px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #f7f8fa; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.info-grid b { display: block; }
.info-grid .sub:first-child { display: block; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.pay-form { border-top: 1px solid var(--line); margin-top: 8px; }
details.log { margin: 12px 0; }
details.log summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
a.btn { text-decoration: none; }
.board { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eceef3; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kcard { background: #fff; border-radius: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.kcard:hover { border-color: var(--gold); }
.kc-top { display: flex; justify-content: space-between; }
.kc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.kcard .btn { margin-top: 6px; }
.empty-col { text-align: center; padding: 20px 0; }
@media (max-width: 820px) {
  .form-grid3, .form-grid4 { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(5, 78vw); }
}
@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 10mm; }
  dialog { box-shadow: none; }
}
table.payroll input { width: 100px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: right; font: inherit; }
table.payroll input.p-days { width: 60px; }
table.payroll input:disabled { background: #f4f5f8; }

/* ---------- Dashboard ---------- */
.stats.dash { grid-template-columns: repeat(3, 1fr); }
a.stat.link { text-decoration: none; display: block; }
a.stat.link:hover { border-color: var(--gold); }
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.dash-grid .card-head a { text-decoration: none; }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.flow.two { grid-template-columns: 1fr 1fr; }
.flow > a, .flow > div { background: #f7f8fa; border-radius: 10px; padding: 10px; text-decoration: none; color: var(--text); }
.flow b { display: block; font-size: 20px; }
.flow span { font-size: 12px; color: var(--muted); }
.flow .alert { background: #fdecea; }
.flow .alert b { color: var(--danger); }
.flow .alert.soft { background: var(--gold-soft); }
.flow .alert.soft b { color: #8a5414; }
.vbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 150px; }
.vbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.vbar i { display: block; width: 70%; max-width: 34px; background: var(--navy); border-radius: 6px 6px 0 0; min-height: 2px; }
.vbar .vv { font-size: 11px; color: var(--muted); }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .stats.dash { grid-template-columns: 1fr 1fr; } .flow { grid-template-columns: repeat(3, 1fr); } }
.vbar i.h0 { height: 1%; }
.vbar i.h1 { height: 1%; }
.vbar i.h2 { height: 2%; }
.vbar i.h3 { height: 3%; }
.vbar i.h4 { height: 4%; }
.vbar i.h5 { height: 4%; }
.vbar i.h6 { height: 5%; }
.vbar i.h7 { height: 6%; }
.vbar i.h8 { height: 7%; }
.vbar i.h9 { height: 8%; }
.vbar i.h10 { height: 9%; }
.vbar i.h11 { height: 10%; }
.vbar i.h12 { height: 11%; }
.vbar i.h13 { height: 12%; }
.vbar i.h14 { height: 13%; }
.vbar i.h15 { height: 14%; }
.vbar i.h16 { height: 14%; }
.vbar i.h17 { height: 15%; }
.vbar i.h18 { height: 16%; }
.vbar i.h19 { height: 17%; }
.vbar i.h20 { height: 18%; }
.vbar i.h21 { height: 19%; }
.vbar i.h22 { height: 20%; }
.vbar i.h23 { height: 21%; }
.vbar i.h24 { height: 22%; }
.vbar i.h25 { height: 22%; }
.vbar i.h26 { height: 23%; }
.vbar i.h27 { height: 24%; }
.vbar i.h28 { height: 25%; }
.vbar i.h29 { height: 26%; }
.vbar i.h30 { height: 27%; }
.vbar i.h31 { height: 28%; }
.vbar i.h32 { height: 29%; }
.vbar i.h33 { height: 30%; }
.vbar i.h34 { height: 31%; }
.vbar i.h35 { height: 32%; }
.vbar i.h36 { height: 32%; }
.vbar i.h37 { height: 33%; }
.vbar i.h38 { height: 34%; }
.vbar i.h39 { height: 35%; }
.vbar i.h40 { height: 36%; }
.vbar i.h41 { height: 37%; }
.vbar i.h42 { height: 38%; }
.vbar i.h43 { height: 39%; }
.vbar i.h44 { height: 40%; }
.vbar i.h45 { height: 40%; }
.vbar i.h46 { height: 41%; }
.vbar i.h47 { height: 42%; }
.vbar i.h48 { height: 43%; }
.vbar i.h49 { height: 44%; }
.vbar i.h50 { height: 45%; }
.vbar i.h51 { height: 46%; }
.vbar i.h52 { height: 47%; }
.vbar i.h53 { height: 48%; }
.vbar i.h54 { height: 49%; }
.vbar i.h55 { height: 50%; }
.vbar i.h56 { height: 50%; }
.vbar i.h57 { height: 51%; }
.vbar i.h58 { height: 52%; }
.vbar i.h59 { height: 53%; }
.vbar i.h60 { height: 54%; }
.vbar i.h61 { height: 55%; }
.vbar i.h62 { height: 56%; }
.vbar i.h63 { height: 57%; }
.vbar i.h64 { height: 58%; }
.vbar i.h65 { height: 58%; }
.vbar i.h66 { height: 59%; }
.vbar i.h67 { height: 60%; }
.vbar i.h68 { height: 61%; }
.vbar i.h69 { height: 62%; }
.vbar i.h70 { height: 63%; }
.vbar i.h71 { height: 64%; }
.vbar i.h72 { height: 65%; }
.vbar i.h73 { height: 66%; }
.vbar i.h74 { height: 67%; }
.vbar i.h75 { height: 68%; }
.vbar i.h76 { height: 68%; }
.vbar i.h77 { height: 69%; }
.vbar i.h78 { height: 70%; }
.vbar i.h79 { height: 71%; }
.vbar i.h80 { height: 72%; }
.vbar i.h81 { height: 73%; }
.vbar i.h82 { height: 74%; }
.vbar i.h83 { height: 75%; }
.vbar i.h84 { height: 76%; }
.vbar i.h85 { height: 76%; }
.vbar i.h86 { height: 77%; }
.vbar i.h87 { height: 78%; }
.vbar i.h88 { height: 79%; }
.vbar i.h89 { height: 80%; }
.vbar i.h90 { height: 81%; }
.vbar i.h91 { height: 82%; }
.vbar i.h92 { height: 83%; }
.vbar i.h93 { height: 84%; }
.vbar i.h94 { height: 85%; }
.vbar i.h95 { height: 86%; }
.vbar i.h96 { height: 86%; }
.vbar i.h97 { height: 87%; }
.vbar i.h98 { height: 88%; }
.vbar i.h99 { height: 89%; }
.vbar i.h100 { height: 90%; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; flex-shrink: 0; }

/* ---------- Pilih produk bertahap & baris barang ---------- */
.picker { display: grid; grid-template-columns: 1.1fr 1.5fr .8fr; gap: 6px; }
.picker select, .item-row input, .log-form input { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; font: inherit; width: 100%; }
.picker select:disabled { background: #f4f5f8; color: #a0a7b4; }
.item-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; background: #fff; }
.i-nums { display: grid; grid-template-columns: 90px 1fr auto 40px; gap: 8px; align-items: end; margin-top: 8px; }
.i-nums label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.i-sub { font-weight: 700; padding-bottom: 10px; text-align: right; min-width: 90px; }
.i-del { height: 42px; }
.log-form .grow-pick { flex: 3 1 420px; }
.log-form input[name=qty] { flex: 0 1 110px; }

/* ---------- Ikon & menu ---------- */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav a .lbl { flex: 1; }
.nav a .ico { width: 18px; height: 18px; opacity: .85; }
.side .me .btn .ico { width: 16px; height: 16px; }
.bottomnav, .scrim { display: none; }

/* =====================================================================
   TAMPILAN HP
   ===================================================================== */
@media (max-width: 820px) {
  html, body { background: #f2f3f7; }
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  .shell { display: block; }

  /* Atas: judul halaman */
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; min-height: 54px;
  }
  .topbar img { width: 28px; height: 28px; }
  .topbar b { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; }

  /* Bawah: menu utama */
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(15, 76, 92, .06);
  }
  .bottomnav a, .bottomnav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none;
    color: #8a93a6; text-decoration: none; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 10px;
  }
  .bottomnav .ico { width: 23px; height: 23px; }
  .bottomnav .on { color: var(--navy); }
  .bottomnav .on .ico { stroke-width: 2.2; }
  .bottomnav .on span { position: relative; }
  .bottomnav .on span::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 18px; height: 3px; margin-left: -9px; border-radius: 3px; background: var(--gold); }

  /* Menu lengkap: laci dari kiri */
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 84vw; max-width: 320px; transform: translateX(-105%); transition: transform .22s ease; padding-top: calc(18px + env(safe-area-inset-top)); }
  .shell.open .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(6, 30, 36, .45); }
  .shell.open .scrim { display: block; }
  .nav a { padding: 12px 10px; font-size: 15px; }

  /* Isi halaman */
  .main { padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
  .main:not([data-page=home]) .page-head h1 { display: none; }
  .page-head { margin-bottom: 12px; }
  .page-head p { font-size: 13px; }
  .page-head > .btn.gold {
    position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 22;
    border-radius: 999px; padding: 14px 20px; box-shadow: 0 8px 22px rgba(224, 159, 62, .45); font-size: 15px;
  }
  .page-head > .btn.small { padding: 8px 12px; }

  /* Ukuran sentuh & huruf 16px (supaya HP tidak memperbesar layar) */
  input, select, textarea { font-size: 16px !important; }
  input[type=text], input[type=password], input[type=tel], input[type=search], input[type=date], input[type=month], select { min-height: 46px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 36px; padding: 7px 12px; }

  /* Ringkasan angka */
  .stats, .stats.dash, .stats.three { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .stat { padding: 12px; border-radius: 14px; }
  .stat b, .stat b.pos, .stat b.neg { font-size: 19px; }
  .stat span { font-size: 12px; line-height: 1.35; display: block; }
  .stats.three .stat:last-child:nth-child(odd), .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }

  /* Tab jadi tombol bulat yang bisa digeser */
  .tabs { border: 0; gap: 6px; margin: 0 -14px 12px; padding: 0 14px; }
  .tabs button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: #fff; color: var(--muted); font-size: 14px; }
  .tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

  /* Saringan */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters input[type=search] { grid-column: 1 / -1; }
  .filters > *:only-child, .filters > *:last-child:nth-child(even) { grid-column: auto; }
  .filters label.inline { display: grid; gap: 4px; font-size: 12px; }
  .filters label.inline input { width: 100%; }
  .filters .btn.small { min-height: 40px; }

  /* Tabel → kartu */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.list td { display: block; border: 0; padding: 3px 0 !important; text-align: right; font-size: 14px; overflow: hidden; }
  table.list td[data-label]::before { content: attr(data-label); float: left; margin-right: 12px; color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; }
  table.list td .sub { display: inline; }
  table.list td > div.sub { display: block; }
  table.list td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px !important; }
  table.list td:first-child::before { display: none; }
  table.list td.actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 6px; padding-top: 10px !important; }
  table.list td.actions::before { display: none; }
  table.list td.actions .btn { flex: 1 1 0; margin: 0; white-space: nowrap; }
  table.list td:empty { display: none; }
  table.list td.empty, table.list td[colspan] { display: block; text-align: left; }
  table.list td.empty { text-align: center; }
  table.list td[colspan]::before { display: none; }
  table.list tr.sumrow { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 0; }
  table.list tr.sumrow td { width: auto; padding: 0 !important; }
  table.list tr.sumrow td[colspan] { text-align: left; color: var(--muted); }
  table.list tr.total { display: flex; justify-content: space-between; font-weight: 800; padding: 12px 0; border-top: 2px solid var(--line); border-bottom: 0; }
  table.list tr.total td { width: auto; padding: 0 !important; }
  table.list tr.total td::before { display: none; }
  table.list tr.grouprow { padding: 14px 0 4px; border: 0; }
  table.list tr.grouprow td { background: none; padding: 0 !important; }
  table.list .show-sm { display: block; margin-top: 4px; }
  table.list.pl tr { padding: 6px 0; }

  /* Daftar utama: tiap baris jadi kartu putih */
  .card.flush { background: transparent; border: 0; padding: 0; }
  .card.flush table.list tbody tr:not(.total):not(.grouprow) {
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
  }
  .card.flush table.list tr.total { padding: 12px 4px; }
  .card.flush table.list tr.grouprow { padding: 14px 4px 6px; }
  table.list.clickable tbody tr[data-id]:active { background: #f7f8fa; }

  /* Kartu & dialog layar penuh */
  .card { padding: 14px; border-radius: 14px; }
  dialog, dialog.wide { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
  .dform { padding: calc(16px + env(safe-area-inset-top)) 16px 0; min-height: 100%; display: flex; flex-direction: column; }
  .dform > .row-end:last-child, .dform > div > .row-end:last-child {
    position: sticky; bottom: 0; margin: auto -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); z-index: 2;
  }
  .dform > .row-end:last-child .btn, .dform > div > .row-end:last-child .btn { flex: 1 1 auto; }
  .dform h2 { font-size: 20px; }
  .form-grid2, .form-grid3, .form-grid4 { grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .form-grid2 > .field:only-child { grid-column: 1 / -1; }
  .photo-dlg { padding: 12px; }
  .seg { gap: 6px; }
  .seg span { padding: 10px 14px; }

  /* Pilih produk & barang pesanan */
  .picker { grid-template-columns: 1fr; }
  .i-nums { grid-template-columns: 76px 1fr 44px; }
  .i-nums .i-sub { grid-column: 1 / -1; order: 5; text-align: right; padding: 0; }
  .log-form { display: grid; grid-template-columns: 1fr auto; }
  .log-form .grow-pick { grid-column: 1 / -1; }
  .totalbox { position: sticky; bottom: 76px; z-index: 1; }

  /* Lain-lain */
  .daybar { display: grid; grid-template-columns: 44px 1fr 44px; }
  .daybar .sub { grid-column: 1 / -1; }
  .wallets { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px; scrollbar-width: none; }
  .wallet { flex: 0 0 auto; }
  .board { grid-template-columns: repeat(5, 82vw); scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 8px; }
  .col { scroll-snap-align: start; }
  .savebar { top: 62px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px; }
  .att-row { padding: 10px 0; }
  .seg.small span { min-width: 40px; padding: 8px 0; }
  .two-col, .dash-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .detail-head { flex-direction: column; }
  .msg { position: sticky; top: 62px; z-index: 5; }
  #printNota { display: none; }
  input.stock-in { width: 96px; min-height: 42px; }
  table.payroll input { width: 110px; min-height: 40px; }
}
@media (max-width: 820px) {
  .filters label.inline.check { display: flex; align-items: center; gap: 8px; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-height: 46px; }
  .filters label.inline.check input { width: 20px; height: 20px; }
  table.list td input.stock-in { margin-top: -6px; }
}
