:root {
  --bg: #eef8f6; --card: #ffffff; --ink: #0f2e2c; --muted: #4c6b68; --line: #cfe5e1;
  --pri: #08766d; --pri-ink: #ffffff; --pri-soft: #d7f1ec; --nav: #08766d; --nav-ink: #eafaf7;
  --bio: #0b7a55; --bio-soft: #e2f6ee;
  --warn: #b7791f; --warn-soft: #fdf3dd; --bad: #c53030; --bad-soft: #fde8e8; --ok: #2f855a; --ok-soft: #e6f4ea;
  --r: 18px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h3 { font-size: 1.05rem; }
a { color: var(--pri); }

/* ---------- Tombol & form ---------- */
.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .55rem .9rem; border-radius: 12px;
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; justify-content: center; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #8fc4bb; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); font-weight: 600; }
.btn.bio { background: var(--bio); border-color: var(--bio); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); border-color: #f1b5b5; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: .3rem .6rem; font-size: .87rem; }
.btn.lg { padding: .85rem 1.1rem; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.icon { padding: .4rem .6rem; font-size: 1.2rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.on { background: var(--pri-soft); border-color: var(--pri); color: var(--pri); font-weight: 600; }
label { display: grid; gap: .25rem; font-size: .88rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri-soft); border-color: var(--pri); }
textarea { min-height: 70px; resize: vertical; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: transparent; cursor: pointer;
  font-size: 1.1rem; padding: .3rem .5rem; border-radius: 6px; line-height: 1; }
.pw-toggle:hover { background: var(--pri-soft); }
.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .95rem; }
.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.form-grid .full { grid-column: 1 / -1; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack { display: grid; gap: .75rem; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #08766d, #0b9488); }
.login-card { background: #fff; padding: 2rem; border-radius: 16px; width: min(360px, 100%); display: grid; gap: .8rem; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-card label { text-align: left; }
.login-card h1 { margin: 0; color: var(--pri); }
.login-card p { margin: 0; }

/* ---------- Kerangka ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.nav { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: .6rem; align-items: center; padding: 1rem; border-bottom: 1px solid rgba(255,255,255,.2); }
.brand b { display: block; color: #fff; font-size: 1.1rem; }
.brand-logo { background: #fff; border-radius: 10px; padding: 3px; flex: none; }
.login-logo { justify-self: center; }
.brand small { color: #d3f0eb; font-size: .75rem; }
#menu { padding: .5rem; display: grid; gap: 2px; }
#menu a { color: var(--nav-ink); text-decoration: none; padding: .6rem .75rem; border-radius: 12px; display: flex; gap: .6rem; align-items: center; }
#menu a:not(.active):hover { background: rgba(255,255,255,.12); }
#menu a.active { background: #fff; color: var(--pri); font-weight: 600; }
#menu .badge { margin-left: auto; }
.nav-foot { margin-top: auto; padding: .75rem; display: grid; gap: .25rem; border-top: 1px solid rgba(255,255,255,.2); }
.nav-foot .btn { color: var(--nav-ink); justify-content: flex-start; }
.who { font-size: .85rem; padding: .25rem .5rem; }
.who small { display: block; color: #d3f0eb; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 1.15rem; flex: 1; }
#btn-menu { display: none; }
#page { padding: 1.25rem; display: grid; gap: 1rem; align-content: start; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .nav { transform: none; }
  .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  #btn-menu { display: inline-flex; }
  #page { padding: 16px; }
  .topbar { padding: .6rem 16px; }
  #clock { display: none; }
}

/* ---------- Kartu, tabel, badge ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow); min-width: 0; }
.card > h3 { display: flex; align-items: center; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; box-shadow: var(--shadow); }
.stat small { color: var(--muted); display: block; font-size: .8rem; }
.stat b { font-size: 1.35rem; display: block; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.bio { border-color: #9fdcc4; background: var(--bio-soft); }
.stat.warn { border-color: #f0d49a; background: var(--warn-soft); }
.stat.bad { border-color: #f1b5b5; background: var(--bad-soft); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f3fbf9; }
tr.batal td { color: #9aa6b2; text-decoration: line-through; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #e8f1ef; color: var(--muted); white-space: nowrap; }
.badge.pri { background: var(--pri-soft); color: var(--pri); }
.badge.bio { background: var(--bio-soft); color: var(--bio); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.empty { color: var(--muted); padding: 1rem 0; text-align: center; }
.list { display: grid; gap: .5rem; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: .65rem .75rem; display: grid; gap: .35rem; background: #fff; }
.item.warn { border-left: 4px solid var(--warn); }
.item.bad { border-left: 4px solid var(--bad); }
.item.ok { border-left: 4px solid var(--ok); }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.bar { height: 8px; background: var(--pri-soft); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--pri); }
.bar.bio > i { background: var(--bio); }
.alert { padding: .7rem .9rem; border-radius: 12px; background: var(--warn-soft); border: 1px solid #f0d49a; color: #7a4f0d; }
.alert.info { background: var(--pri-soft); border-color: #a5d8cf; color: #07534d; }
.alert.bio { background: var(--bio-soft); border-color: #9fdcc4; color: #075e40; }

/* ---------- Kasir ---------- */
.pos { display: grid; grid-template-columns: 1fr 420px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } }
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.mode .btn { padding: .8rem; font-size: 1rem; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.prod { border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 18px; padding: .8rem; text-align: left; cursor: pointer; font: inherit; display: grid; gap: .2rem; min-height: 92px; position: relative; }
.prod:hover { border-color: var(--pri); }
.prod b { font-size: 1rem; }
.prod .price { font-size: 1.1rem; font-weight: 700; color: var(--pri); font-variant-numeric: tabular-nums; }
.prod small { color: var(--muted); font-size: .78rem; }
.prod.unggulan { grid-column: span 2; min-height: 110px; }
.prod.unggulan .price { font-size: 1.35rem; }
.prod.unggulan b { font-size: 1.2rem; }
.prod .tag { position: absolute; top: .5rem; right: .5rem; }
.prod:disabled { opacity: .45; cursor: not-allowed; }
.cart { position: sticky; top: 70px; display: grid; gap: .75rem; }
.cart-lines { display: grid; gap: .4rem; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.cart-line .nm { font-weight: 600; }
.cart-line small { color: var(--muted); display: block; font-weight: 400; }
.qty { display: flex; align-items: center; gap: .25rem; }
.qty input { width: 52px; text-align: center; padding: .35rem; }
.qty .btn { padding: .3rem .55rem; }
.total-box { background: var(--pri); color: #fff; border-radius: 10px; padding: .85rem 1rem; display: flex; justify-content: space-between; align-items: center; }
.total-box b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.quick-cash { display: flex; gap: .35rem; flex-wrap: wrap; }
.cust-box { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; display: grid; gap: .3rem; }
.kupon-progress { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.dots { display: flex; gap: 3px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #d5e6e3; display: block; }
.dots i.on { background: var(--bio); }

/* ---------- Modal & toast ---------- */
dialog { border: none; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5,50,46,.5); }
.modal-box { padding: 1.25rem; display: grid; gap: .9rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: .5rem; z-index: 100; max-width: calc(100vw - 32px); }
.toast { background: #0f2e2c; color: #fff; padding: .7rem 1rem; border-radius: 12px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* ---------- Undian ---------- */
.draw-box { text-align: center; padding: 2rem 1rem; border-radius: 14px; background: linear-gradient(160deg, #05443f, #08766d); color: #fff; display: grid; gap: .5rem; }
.draw-box .kode { font-size: clamp(2rem, 8vw, 4rem); font-weight: 800; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.draw-box .nm { font-size: 1.4rem; font-weight: 700; }

/* ---------- Tema Segar Tirta ---------- */
.prod.unggulan .tag { background: #fff; color: #17612f; }
/* Warna produk air */
.w-sae { --w: #17612f; --w-bg: #d9f7cf; --w-line: #7cc96a; }
.w-ro { --w: #0f2e2c; --w-bg: #ffffff; --w-line: #b9c9c6; }
.w-mineral { --w: #0b4a94; --w-bg: #cfe4ff; --w-line: #5b9be6; }
.w-baku { --w: #7a3200; --w-bg: #ffd3a3; --w-line: #ee8a2b; }
.stat[class*=" w-"], .prod[class*=" w-"] { background: var(--w-bg); border-color: var(--w-line); }
.stat[class*=" w-"] b, .prod[class*=" w-"] .price { color: var(--w); }
.stat[class*=" w-"] small, .stat[class*=" w-"] .sub, .prod[class*=" w-"] small { color: #2f4745; }
.prod[class*=" w-"]:hover { border-color: var(--w); }
.stat.hero { grid-column: 1 / -1; background: var(--pri); border-color: var(--pri); color: #fff; }
.stat.hero small, .stat.hero .sub { color: #e6f7f4; }
.stat.hero b { font-size: 1.9rem; }
.check input { flex: none; width: 22px; height: 22px; accent-color: var(--pri); }
:focus-visible { outline: 3px solid #0b9488; outline-offset: 2px; }
.bawah, .paybar { display: none; }
@media (max-width: 900px) {
  #page { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .bawah { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bawah a { flex: 1; min-width: 0; min-height: 58px; display: grid; place-content: center; justify-items: center; font-size: .78rem; color: var(--muted); text-decoration: none; }
  .bawah a span { font-size: 1.25rem; line-height: 1.2; }
  .bawah a.active { color: var(--pri); font-weight: 700; box-shadow: inset 0 3px var(--pri); }
  .paybar.ada { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 15; min-height: 52px; box-shadow: 0 4px 14px rgba(5,50,46,.3); }
  #toasts { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .btn { min-height: 44px; }
  .btn.sm, .qty .btn { min-height: 40px; }
  .qty .btn { min-width: 40px; }
  input, select, textarea { font-size: 16px; }
  .table-wrap table { min-width: 560px; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .75rem; }
  .stat b { font-size: 1.12rem; overflow-wrap: anywhere; }
  .stat.hero b { font-size: 1.7rem; }
  .products { grid-template-columns: 1fr 1fr; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  #cari { flex: 1 1 100%; max-width: none !important; }
}

/* ---------- Cetak (struk & kupon 58mm) ---------- */
#print-area { display: none; }
.paper { width: 58mm; padding: 2mm 3mm; font-family: "Courier New", monospace; font-size: 11px; color: #000; line-height: 1.35; }
.paper .c { text-align: center; }
.paper .b { font-weight: 700; }
.paper .big { font-size: 15px; font-weight: 700; }
.paper .huge { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.paper hr { border: none; border-top: 1px dashed #000; margin: 2mm 0; }
.paper table { font-size: 11px; width: 100%; }
.paper td { padding: 0; border: none; }
.paper .r { text-align: right; }
.paper .kupon { border: 2px solid #000; padding: 2mm; margin: 2mm 0; }
.paper .logo-cetak { height: 16mm; width: auto; margin-bottom: 1mm; }
.paper.cut { page-break-after: always; break-after: page; }
.a4 { width: 100%; font-family: system-ui, sans-serif; font-size: 12pt; color: #000; page: a4; }
.a4 .tbl th, .a4 .tbl td { border-bottom: 1px solid #999; padding: 4px 6px; color: #000; text-transform: none; font-size: 11pt; }
@page a4 { size: A4; margin: 15mm; }
@media print {
  @page { size: 58mm auto; margin: 0; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
}

/* Kartu produk */
.produk-grid { margin-top: 1rem; align-items: start; }
@media (min-width: 900px) { .produk-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
