:root {
  --amber: #EFA100;
  --graphite: #3C3A36;
  --bg: #F1EFEA;
  --line: #DBD7CF;
  --text: #2B2926;
  --muted: #8A857C;
  --red: #C1462E;
  --green: #2E7D52;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- Wordmark ---- */
.wordmark { display: flex; align-items: center; gap: 7px; font-weight: 800; letter-spacing: .05em; color: var(--graphite); font-size: 15px; }
.wordmark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.wm-lg { font-size: 24px; justify-content: center; }
.wm-lg .dot { width: 12px; height: 12px; }

/* ---- Header flat: icon-only (Lucide 45px) ---- */
.hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 4px; background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.hdr-icons { display: flex; align-items: center; }
.ic {
  position: relative; background: none; border: none; color: var(--graphite);
  width: 45px; height: 45px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic:active { opacity: .55; }
.stmt-badge {
  position: absolute; top: 3px; right: 3px; background: #E03B2F; color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 800; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---- HOME: grid icon besar (tactile, dipakai di lapangan) ---- */
.home { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 9dvh 22px 24px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 400px; margin-top: 40px; }
.tile {
  position: relative; aspect-ratio: 1.15; background: transparent;
  border: 1.5px solid var(--line); border-radius: 22px; color: var(--graphite);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tile svg { width: 58px; height: 58px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile:active { background: #E7E4DC; transform: scale(.97); }
.tile .stmt-badge { top: 12px; right: 12px; min-width: 22px; height: 22px; font-size: 12px; border-radius: 12px; }
.ic-logout { margin-top: 28px; opacity: .55; }

/* ---- Layout ---- */
.app { max-width: 520px; margin: 0 auto; padding: 10px 18px 40px; }
.section-title { margin: 14px 0 10px; font-size: 15px; font-weight: 700; }
.loading { color: var(--muted); text-align: center; padding: 30px; }
.muted-note { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }

/* ---- Input flat ---- */
.ship-in {
  width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text);
}
.ship-in::placeholder { color: #B4AFA5; }
.ship-in:last-child { margin-bottom: 0; }
.inv-search { margin-bottom: 6px; }
#listHint { margin-top: 12px; }

/* ---- Daftar faktur flat (tanpa card) ---- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.row.tappable { cursor: pointer; }
.row.tappable:active { opacity: .6; }
.row .cust { font-weight: 600; font-size: 14px; }
.row .ref { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.row .amt { font-family: var(--mono); font-weight: 700; font-size: 14px; text-align: right; white-space: nowrap; }
.badge { display: inline-block; font-size: 10px; padding: 1px 0; margin-top: 2px; font-weight: 600; }
.badge.Overdue { color: var(--red); }
.badge.DueToday { color: #8a6100; }
.badge.ComingDue { color: var(--green); }

/* ---- KPI flat (area OWNER) ---- */
.kpi { margin: 20px 0; }
.kpi .k-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.kpi .k-value { font-family: var(--mono); font-size: 27px; font-weight: 700; margin-top: 3px; letter-spacing: .01em; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Login ---- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px; }
.login .sub { color: var(--muted); font-size: 13px; margin-top: 6px; text-align: center; }
.pin-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.pin-form input {
  font-family: var(--mono); font-size: 22px; text-align: center; letter-spacing: 8px;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent;
}
.pin-form button {
  font: inherit; font-weight: 700; padding: 13px; border: none; border-radius: 10px;
  background: var(--graphite); color: #fff; cursor: pointer;
}
.pin-form button:active { transform: translateY(1px); }
.err { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }

/* ---- Sheet (flat, sewarna background) ---- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(43, 41, 38, .38);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 520px;
  border-radius: 16px 16px 0 0; padding: 20px 18px 26px;
  max-height: 90dvh; overflow-y: auto; animation: slideup .16s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { font-size: 17px; margin-bottom: 2px; }
.sheet .ref { font-family: var(--mono); color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.sheet .field { margin: 12px 0; }
.sheet .field .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.sheet .field .val { font-size: 14px; white-space: pre-line; }
.sheet .items { margin: 6px 0; border-top: 1px solid var(--line); }
.sheet .items .it { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet .items .it .q { font-family: var(--mono); color: var(--muted); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions button { flex: 1; font: inherit; font-size: 14px; font-weight: 700; padding: 12px 8px; border-radius: 10px; border: none; cursor: pointer; }
.btn-print { background: var(--amber); color: #3a2c00; }
.btn-ship { background: var(--graphite); color: #fff; }
.btn-wa { background: #1FAF5A; color: #fff; }
.btn-close { background: transparent; color: var(--text); border: 1px solid var(--line) !important; }
.sheet-msg { text-align: center; font-size: 13px; min-height: 18px; margin-top: 10px; }
.sheet-msg.ok { color: var(--green); }
.sheet-msg.err { color: var(--red); }
button:disabled { opacity: .55; cursor: default; }
.ship-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ship-box .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.tel-link { display: inline-block; font-size: 13px; font-weight: 600; color: var(--green); text-decoration: none; padding: 2px 0; }
.field.two-col { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }

/* ---- Form order ---- */
select.ship-in { appearance: none; -webkit-appearance: none; }
.ord-line { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 6px; align-items: center; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.ord-line .ord-item { grid-column: 1 / -1; margin-bottom: 0; }
.ord-line .ord-qty, .ord-line .ord-price { margin-bottom: 0; }
.ord-line .ord-note { grid-column: 1 / -1; margin-bottom: 0; font-size: 13px; }
.ord-del { background: transparent; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; height: 100%; }
.btn-additem { background: none; border: 1px dashed var(--line); color: var(--text); font: inherit; padding: 9px; width: 100%; border-radius: 8px; cursor: pointer; margin-top: 2px; }
.ord-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 14px; }
.ord-total span { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--text); }

/* ---- Statement ---- */
.st-sec { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.st-row .st-info { flex: 1; font-size: 13px; }
.st-row .st-amt { font-family: var(--mono); font-size: 13px; font-weight: 700; white-space: nowrap; }
.st-cb { width: 18px; height: 18px; accent-color: var(--amber); flex: 0 0 auto; }

/* ---- Ledger ---- */
.lg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lg-grid2 .ship-in { margin-bottom: 8px; }
.lg-info { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.lg-info b { color: var(--text); font-family: var(--mono); }
.lg-info.err, .lg-info.err b { color: var(--red); } /* Br-Y >= Bg: salah ketik, jangan sampai masuk buku */
.lg-submit { width: 100%; font: inherit; font-size: 14px; font-weight: 700; padding: 12px; border: none; border-radius: 10px; background: var(--graphite); color: #fff; cursor: pointer; margin-top: 4px; }
.lg-submit:active { transform: translateY(1px); }
.lg-blend { display: grid; grid-template-columns: 1fr 92px 34px; gap: 6px; margin-bottom: 8px; }
.lg-blend .ship-in { margin-bottom: 0; }
