/* Opzsi POS: MokPos visual system, blue accent on light ground. */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --blue: #2563eb;
  --navy: #1e3a8a;
  --ink: #1f2937;
  --grey: #6b7280;
  --ground: #f7f9fa;
  --line: #e5e7eb;
  --surface: #fff;
  --surface2: #eef1f4;
  --body-bg: #e8edf2;
  --green: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  color-scheme: light;
}
[data-theme="dark"] {
  --blue: #3b82f6;
  --ink: #f1f5f9;
  --grey: #94a3b8;
  --ground: #0f172a;
  --line: #334155;
  --surface: #1e293b;
  --surface2: #243449;
  --body-bg: #020617;
  color-scheme: dark;
}
[data-theme="dark"] .btn.ghost { background: #1e293b; color: #93c5fd; }
[data-theme="dark"] .mini.red { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .rolebadge { background: #1e293b; color: #93c5fd; }
[data-theme="dark"] .cartbar:disabled { background: #334155; }
[data-theme="dark"] input::placeholder { color: var(--grey); }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--body-bg); color: var(--ink); }
.phone { max-width: 420px; margin: 0 auto; background: var(--ground); min-height: 100vh; position: relative; }
main { padding: 12px 16px 96px; }
.screen { display: none; }
.screen.active { display: block; }
h1.title { color: var(--blue); text-align: center; font-size: 22px; font-weight: 800; margin: 8px 0 16px; }
h2 { font-size: 16px; font-weight: 700; margin: 16px 0 8px; }
.card { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--grey); font-size: 13px; }
.blue { color: var(--blue); }
.red { color: var(--red); }
.toast { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(340px, calc(100vw - 24px)); padding: 10px 14px; border-radius: 10px; font-size: 14px; text-align: center; z-index: 99; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.toast.ok { background: #dcfce7; color: #166534; }
.toast.err { background: #fee2e2; color: #991b1b; }
.green { color: var(--green); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.btn { display: block; width: 100%; background: var(--blue); color: #fff; font-weight: 700; font-size: 16px; padding: 14px; border-radius: 12px; margin-top: 12px; }
.btn:disabled { background: #93c5fd; cursor: default; }
.btn.ghost { background: #eef2ff; color: var(--blue); }
.btn.danger { background: none; color: var(--red); font-weight: 600; padding: 8px; }
input, select { font-family: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); width: 100%; }
input[type="number"] { text-align: right; }
.search { margin-bottom: 12px; }

/* Kasir */
.catrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cat { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.cat.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pcard { background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: relative; }
.pcard img { width: 100%; height: 120px; object-fit: cover; display: block; }
.pcard .pinfo { padding: 10px; }
.pcard .pname { font-weight: 700; font-size: 14px; min-height: 38px; }
.pcard .pprice { color: var(--blue); font-weight: 800; font-size: 15px; }
.addbtn { position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 20px; font-weight: 700; line-height: 1; }
.stepper { position: absolute; right: 10px; top: 10px; height: 34px; display: flex; align-items: center; background: var(--blue); color: #fff; border-radius: 999px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.stepper button { width: 34px; height: 34px; color: #fff; font-size: 20px; font-weight: 700; line-height: 1; }
.stepper span { min-width: 20px; text-align: center; font-size: 15px; }
.cartbar { background: var(--blue); color: #fff; border-radius: 14px; padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between; margin-top: 16px; width: 100%; font-size: 15px; }
.cartbar:disabled { background: #c3cdd8; }
.fallback-note { font-size: 12px; color: var(--grey); text-align: center; margin-top: 10px; }

/* Pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { flex: 1 1 30%; padding: 10px 0; border-radius: 999px; background: var(--surface2); font-weight: 600; font-size: 14px; text-align: center; }
.pill.on { background: var(--blue); color: #fff; }

/* Order lines */
.line { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: none; }
.qty { min-width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qtybtn { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); font-size: 16px; font-weight: 700; }
.totals .row { padding: 6px 0; }
.totals .total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* Keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.key { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 0; font-size: 20px; font-weight: 700; }
.key.enter { background: var(--blue); color: #fff; }
.keypad .key.wide { grid-column: span 1; }

/* Tables */
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tcard { border-radius: 16px; padding: 18px 12px; text-align: center; font-weight: 700; color: #fff; }
.tcard.terisi { background: var(--blue); }
.tcard.kosong { background: var(--green); }
.tcard.bersih { background: var(--red); }
.legend { font-size: 13px; color: var(--grey); margin: 10px 0 16px; }
.bill { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bill:last-child { border-bottom: none; }
.bill .actions { display: flex; gap: 8px; margin-top: 8px; }
.mini { padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; background: var(--blue); color: #fff; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; display: block; margin: 16px auto 12px; box-shadow: 0 2px 8px rgba(10, 22, 40, 0.25); }
.frow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.frow:last-child { border-bottom: none; }
.frow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--blue); flex: none; margin: 0; }
.mini.red { background: #fee2e2; color: var(--red); }
.voidbox { margin-top: 8px; display: flex; gap: 8px; }

/* Laporan */
.kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi .card { margin-bottom: 0; text-align: center; }
.kpi .num { font-size: 20px; font-weight: 800; color: var(--blue); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 8px; }
.bar { background: var(--blue); border-radius: 6px 6px 0 0; min-height: 4px; width: 100%; }
.barwrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.barwrap span { font-size: 11px; color: var(--grey); }
.pbar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 4px 0 10px; }
.pbar i { display: block; height: 100%; background: var(--blue); }
.pbar i.alt { background: #60a5fa; }
.empty { text-align: center; color: var(--grey); padding: 24px 12px; }

/* Stok */
.stockrow { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stockrow:last-child { border-bottom: none; }
.flag { font-size: 12px; font-weight: 700; color: var(--red); }
.filter-ico { display: inline-flex; align-items: center; flex: none; }
.filter-ico svg { width: 22px; height: 22px; fill: var(--grey); display: block; }
.pstock { font-size: 12px; color: var(--grey); margin-top: 2px; }
.pstock.out { color: var(--red); font-weight: 700; }
.stepper button:disabled, .addbtn:disabled { opacity: .35; }
.stockstep { display: flex; gap: 6px; align-items: center; flex: none; }
.row-actions { display: flex; gap: 2px; flex: none; align-items: flex-start; }
.iconbtn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; padding: 0; flex: none; border-radius: 8px; }
.iconbtn svg { width: 22px; height: 22px; fill: var(--grey); }
.iconbtn.danger svg { fill: var(--red); }
.iconbtn.armed { background: #fee2e2; }
.iconbtn.armed svg { fill: var(--red); }

/* Tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 420px; background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 10; }
.tabbar button { flex: 1; padding: 10px 0 12px; font-size: 11px; font-weight: 600; color: var(--grey); }
.tabbar button.on { color: var(--blue); }
.tabbar .ico { display: block; margin-bottom: 2px; }
.tabbar .ico svg { width: 24px; height: 24px; fill: currentColor; display: block; margin: 0 auto; }

/* Manage products */
.mrow { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: none; }
.mrow input { flex: 1; min-width: 0; }
.switch { font-size: 13px; font-weight: 700; color: var(--blue); }

/* Login gate + app header */
.appbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.who-line .ico svg { width: 18px; height: 18px; fill: var(--grey); flex: none; display: block; }
.whoami { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch { color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-select { width: auto; max-width: 180px; border: none; background: transparent; padding: 0; font-size: 13px; font-weight: 600; color: var(--grey); }
.branch-select:disabled { opacity: .6; }
.appbar-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.iconbtn:active { background: var(--surface2); }.rolebadge { background: #eef2ff; color: var(--blue); border-radius: 999px; padding: 2px 8px; font-size: 12px; margin-left: 6px; }
.phone.gated main, .phone.gated .tabbar, .phone.gated .appbar { display: none; }
#screen-login { display: none; padding: 12px 16px 96px; }
.phone.gated #screen-login { display: block; }

/* Staff rows */
.srow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: none; }
