/* Layout: satu kolom selebar HP (maks 480px) di tengah, bilah status di atas, navigasi bawah tetap. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #5d6673;
  --line: #d9dee5;
  --brand: #0c6b58;
  --brand-ink: #ffffff;
  --brand-soft: #e1f1ec;
  --ok: #18794e;
  --warn: #b35c00;
  --bad: #c0362c;
  --warn-soft: #fff3e3;
  --bad-soft: #fdecea;
  --paper: #fffdf7;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1316; --surface: #181d22; --ink: #e8ecf0; --muted: #98a2ae; --line: #2b333b;
  --brand: #35b391; --brand-ink: #062a21; --brand-soft: #143229; --ok: #4cc38a; --warn: #f0a24b; --bad: #ff7a6e;
  --warn-soft: #3a2a12; --bad-soft: #3d1d1a; --paper: #fbfaf5; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1316; --surface: #181d22; --ink: #e8ecf0; --muted: #98a2ae; --line: #2b333b;
  --brand: #35b391; --brand-ink: #062a21; --brand-soft: #143229; --ok: #4cc38a; --warn: #f0a24b; --bad: #ff7a6e;
  --warn-soft: #3a2a12; --bad-soft: #3d1d1a; --paper: #fbfaf5; color-scheme: dark; }

html, body { background: var(--bg); color: var(--ink); font-family: var(--font); }
body { font-size: 15px; }
* { box-sizing: border-box; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.note-contoh { font-size: 12px; color: var(--muted); padding-block: 8px; text-align: center; }

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--brand); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--brand); color: var(--brand-ink); padding-block: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .who { display: flex; flex-direction: column; min-width: 0; }
.topbar .who b { font-weight: 800; letter-spacing: .01em; }
.topbar .who span { font-size: 12px; opacity: .85; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 4px 10px; background: transparent; color: inherit; }
.net i { width: 8px; height: 8px; border-radius: 50%; background: #7dffc9; display: inline-block; }
.net.off i { background: #ffb35c; }

main { flex: 1; padding-block: 14px 96px; display: flex; flex-direction: column; gap: 14px; }
h2 { font-size: 18px; font-weight: 800; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; color: var(--ink); width: 100%; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .01em; }
.money { font-variant-numeric: tabular-nums; }

.alert { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; border: 1px solid; }
.alert.ok { color: var(--ok); border-color: var(--ok); background: var(--brand-soft); }
.alert.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.alert.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.alert b { display: block; margin-bottom: 2px; }

/* login */
.staff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.staff button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.staff button[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.staff b { font-weight: 700; }
.staff span { font-size: 12px; color: var(--muted); }
.pin { display: flex; gap: 10px; justify-content: center; }
.pin i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; }
.pin i.on { background: var(--brand); border-color: var(--brand); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { padding: 14px 0; font-size: 20px; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }

/* kasir */
.scan { display: flex; gap: 8px; }
.scan input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; border: 1px dashed var(--line); border-radius: 999px; padding: 4px 10px; background: transparent; color: var(--muted); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .nm { font-weight: 700; }
.item .meta { font-size: 12px; color: var(--muted); grid-column: 1; }
.item .pr { text-align: right; font-weight: 700; }
.item .x { grid-column: 2; justify-self: end; font-size: 12px; color: var(--bad); background: none; border: 0; padding: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-right: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.second { color: var(--warn); border-color: var(--warn); }
.total { display: flex; justify-content: space-between; align-items: baseline; }
.total b { font-size: 22px; font-weight: 800; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
.result { display: flex; flex-direction: column; gap: 8px; }
.result button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; }
.result button span { font-size: 12px; color: var(--muted); }
.result button b.p { text-align: right; }

/* bayar */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.line { display: flex; justify-content: space-between; font-size: 14px; }
.line.big { font-size: 17px; font-weight: 800; }

/* struk */
.receipt { background: var(--paper); color: #1a1a1a; width: 100%; max-width: 300px; margin: 0 auto; padding: 16px 14px 22px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; border-radius: 4px; box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08); }
.receipt .c { text-align: center; }
.receipt .brand { font-family: var(--font); font-weight: 800; font-size: 16px; letter-spacing: .06em; }
.receipt hr { border: 0; border-top: 1px dashed #777; margin: 8px 0; }
.receipt .l { display: flex; justify-content: space-between; gap: 8px; }
.receipt .l span:last-child { text-align: right; white-space: nowrap; }
.receipt .tg { font-style: italic; }
.paper-note { text-align: center; font-size: 12px; color: var(--muted); }

/* riwayat */
.tx { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; padding-block: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tx:last-child { border-bottom: 0; }
.tx-btn { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; position: relative; padding-right: 18px; }
.tx-btn::after { content: "›"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.tx-btn:hover { background: var(--brand-soft); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.tx span { font-size: 12px; color: var(--muted); }
.st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid; justify-self: end; }
.st.sent { color: var(--ok); }
.st.queue { color: var(--warn); }

/* nav */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
nav.bottom .in.empat { grid-template-columns: repeat(4, 1fr); }
nav.bottom .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
nav.bottom button { background: none; border: 0; padding: 10px 4px 12px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
nav.bottom button svg { width: 22px; height: 22px; }
nav.bottom button[aria-current="page"] { color: var(--brand); }
.badge { background: var(--warn); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 6px; margin-left: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .card, .alert { animation: pop .18s ease-out; }
  @keyframes pop { from { transform: translateY(4px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* Scan kamera layar penuh */
.scan-layer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scan-layer video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-box { position: relative; width: min(78vw, 340px); height: 150px; border: 3px solid #7dffc9; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scan-info { position: relative; color: #fff; font-weight: 700; margin-top: 18px; text-align: center; padding: 0 24px; }
.scan-tutup { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); min-width: 140px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 60; max-width: 90vw; }
