:root {
  --zamrud: #0f7b5f;
  --zamrud-dark: #0b6350;
  --hutan: #0b3d30;
  --emas: #f2b431;
  --emas-soft: #fdf1d3;
  --krem: #fbf8f1;
  --putih: #ffffff;
  --tinta: #1b2a25;
  --abu: #5d6b66;
  --garis: #e4ded0;
  --bahaya: #b3261e;
  --bahaya-soft: #fdecea;
  --ok-soft: #e3f4ee;
  --r: 14px;
  --tab-h: 62px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--krem);
  color: var(--tinta);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 3px solid var(--emas); outline-offset: 2px; }

/* ---- kerangka ---- */
#app { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--krem); }
.top { background: var(--hutan); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.net { display: none; font-size: 12px; font-weight: 600; background: var(--emas); color: var(--hutan); border-radius: 999px; padding: 2px 10px; }
.net.on { display: inline-block; }
.notices:empty { display: none; }
.notice { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14px; }
.notice span { flex: 1; }
.notice.info { background: var(--ok-soft); }
.notice.warn { background: var(--emas-soft); }
.main { flex: 1; overflow-y: auto; position: relative; padding-bottom: 16px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--putih); border-top: 1px solid var(--garis); padding-bottom: env(safe-area-inset-bottom); }
.tab { border: 0; background: none; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--abu); }
.tab .ic { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--zamrud); }
.tab.on .ic { stroke-width: 2.3; }

.ic { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- tombol dan kolom ---- */
.btn { min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--putih); text-decoration: none; }
.btn.primary { background: var(--zamrud); color: #fff; }
.btn.primary:active { background: var(--zamrud-dark); }
.btn.ghost { background: var(--putih); border-color: var(--garis); color: var(--hutan); }
.btn.danger { background: var(--bahaya); color: #fff; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: 0.5; }
.danger-text { color: var(--bahaya) !important; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; color: var(--hutan); }
.icon-btn.sm { width: 38px; height: 38px; background: var(--putih); border: 1px solid var(--garis); }
.icon-btn.tool { background: var(--putih); border: 1px solid var(--garis); flex: none; }
.link-btn { background: none; border: 0; color: var(--zamrud); font-weight: 700; padding: 8px 0; text-decoration: underline; }

.inp, .sel { width: 100%; min-height: 46px; border: 1.5px solid var(--garis); border-radius: 12px; padding: 0 12px; background: var(--putih); }
.inp:focus, .sel:focus { border-color: var(--zamrud); outline: none; box-shadow: 0 0 0 3px rgba(15, 123, 95, 0.18); }
.inp.money { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.inp.area { padding: 10px 12px; resize: vertical; min-height: 80px; }
.inp.qty { width: 62px; text-align: center; padding: 0 4px; min-height: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sel.unit { width: auto; min-height: 38px; padding: 0 6px; }
.pin-input { text-align: center; font-size: 26px; letter-spacing: 0.4em; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.lbl { font-size: 13px; font-weight: 700; color: var(--abu); }
.hint { font-size: 12px; color: var(--abu); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; }
.check input { width: 22px; height: 22px; accent-color: var(--zamrud); }
.msg { color: var(--abu); margin-bottom: 12px; }
.msg.pre-line { white-space: pre-line; color: var(--tinta); }
.err { color: var(--bahaya); font-weight: 600; margin: 4px 0 8px; min-height: 0; }
.err:empty { display: none; }
.warn { background: var(--emas-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.note { background: var(--emas-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.ok-text { color: var(--zamrud); font-weight: 700; }
.bad-text { color: var(--bahaya); font-weight: 700; }
.sub { font-size: 14px; font-weight: 800; color: var(--hutan); margin: 14px 0 8px; }
.card .sub:first-child { margin-top: 0; }
.more { text-align: center; color: var(--abu); font-size: 13px; padding: 12px 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.with-tool { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.with-tool .field { margin-bottom: 12px; }
.with-tool .icon-btn { margin-bottom: 12px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.badge.ok { background: var(--ok-soft); color: var(--zamrud-dark); }
.badge.warn { background: var(--emas-soft); color: #7a5600; }
.badge.bad { background: var(--bahaya-soft); color: var(--bahaya); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--garis); background: var(--putih); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--hutan); color: #fff; border-color: var(--hutan); }
.seg { display: flex; background: #efeadc; border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg-btn { flex: 1; min-height: 40px; border: 0; background: none; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--abu); }
.seg-btn.on { background: var(--putih); color: var(--hutan); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.empty { text-align: center; padding: 48px 24px; }
.empty-title { font-weight: 800; font-size: 18px; color: var(--hutan); margin-bottom: 6px; }
.empty-text { color: var(--abu); margin-bottom: 16px; }
.empty .row-actions { justify-content: center; }
.card { background: var(--putih); border: 1px solid var(--garis); border-radius: var(--r); padding: 14px; margin: 0 12px 12px; }
.srow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.srow.total { font-weight: 800; font-size: 18px; border-top: 1px dashed var(--garis); margin-top: 6px; padding-top: 10px; }

/* ---- lembar (dialog) ---- */
.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--krem); max-height: 92dvh; color: var(--tinta); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: up 0.18s ease-out; }
.sheet.full { height: 92dvh; }
.sheet::backdrop { background: rgba(11, 61, 48, 0.55); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 18px; }
.sheet-title { font-size: 18px; font-weight: 800; color: var(--hutan); }
.sheet-body { padding: 8px 16px 16px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--garis); background: var(--putih); }
.sheet-foot .btn { flex: none; }
.sheet-foot .grow { flex: 1; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: var(--hutan); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; max-width: 88vw; opacity: 0; transition: 0.2s; z-index: 50; pointer-events: none; text-align: center; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bahaya); }

/* ---- kasir ---- */
.topbar { display: flex; gap: 8px; padding: 10px 12px 6px; }
.searchbox { flex: 1; position: relative; display: flex; align-items: center; }
.searchbox .ic { position: absolute; left: 12px; color: var(--abu); }
.inp.search { padding-left: 38px; }
.grid-wrap { padding: 4px 12px 96px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: var(--putih); border: 1px solid var(--garis); border-radius: var(--r); padding: 8px; min-height: 44px; }
.pcard:active { transform: scale(0.98); border-color: var(--zamrud); }
.thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #efeadc; }
.thumb.sm { width: 48px; height: 48px; flex: none; aspect-ratio: auto; }
.thumb.ph { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 28px; color: var(--hutan); }
.thumb.sm.ph { font-size: 20px; }
.c0 { background: #d9efe6; } .c1 { background: #fdf1d3; } .c2 { background: #fbe0d8; } .c3 { background: #dde8f6; } .c4 { background: #ece0f3; } .c5 { background: #e9ecd2; }
.pname { font-weight: 700; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pprice { font-weight: 800; color: var(--zamrud-dark); font-variant-numeric: tabular-nums; font-size: 14.5px; }
.psub { font-size: 12.5px; color: var(--abu); }
.cartbar { position: sticky; bottom: 0; margin-top: -84px; display: flex; gap: 10px; padding: 10px 12px calc(10px + 2px); background: linear-gradient(to top, var(--krem) 70%, rgba(251, 248, 241, 0)); align-items: center; }
.cartbar.empty { justify-content: center; pointer-events: none; }
.bar-hint { color: var(--abu); font-size: 13px; background: var(--krem); padding: 4px 12px; border-radius: 999px; }
.bar-open { flex: 1; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--hutan); background: var(--hutan); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-weight: 700; }
.bar-total { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--emas); }
.bar-pay { min-height: 52px; }

.clist { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; }
.crow { background: var(--putih); border: 1px solid var(--garis); border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.crow-main { grid-column: 1 / -1; }
.crow-name { font-weight: 700; }
.crow-price { background: none; border: 0; padding: 2px 0; color: var(--zamrud-dark); font-size: 13px; text-decoration: underline; font-variant-numeric: tabular-nums; text-align: left; }
.crow-price.manual { color: #7a5600; }
.crow-qty { display: flex; align-items: center; gap: 6px; }
.crow-sum { font-weight: 800; align-self: center; font-variant-numeric: tabular-nums; }
.unit-txt { color: var(--abu); font-size: 13px; }
.tier-row, .disc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tier-row .seg, .disc-row .seg { margin-bottom: 0; flex: 1; }
.disc-row .inp { width: 40%; }
.csum { margin-top: 8px; }

.pay-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.pay-total strong { font-size: 30px; color: var(--hutan); font-variant-numeric: tabular-nums; }
.change { font-size: 20px; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.qris { display: block; max-width: 100%; max-height: 52dvh; margin: 0 auto 12px; border-radius: 12px; border: 1px solid var(--garis); background: #fff; }

.sheet.success .sheet-head { padding-top: 14px; }
.rise { position: relative; height: 84px; margin: 4px auto 6px; width: 120px; }
.rise::before { content: ''; position: absolute; left: 14px; top: 4px; bottom: 6px; width: 10px; border-radius: 6px; background: var(--zamrud); }
.rise::after { content: ''; position: absolute; left: 14px; bottom: 6px; width: 88px; height: 10px; border-radius: 6px; background: var(--zamrud); }
.rise-line { position: absolute; left: 30px; bottom: 22px; width: 82px; height: 7px; border-radius: 6px; background: var(--emas); transform-origin: left center; transform: rotate(-32deg) scaleX(0); animation: naik 0.7s 0.1s ease-out forwards; }
@keyframes naik { to { transform: rotate(-32deg) scaleX(1); } }
.ok-total { text-align: center; font-size: 34px; font-weight: 800; color: var(--hutan); font-variant-numeric: tabular-nums; }
.ok-change { text-align: center; display: flex; flex-direction: column; margin: 6px 0; color: var(--abu); }
.ok-change strong { font-size: 26px; color: var(--zamrud); font-variant-numeric: tabular-nums; }
.sheet.success .msg { text-align: center; margin-top: 8px; }

/* ---- produk dan daftar ---- */
.filter-row { padding: 0 12px; }
.list-wrap { padding-bottom: 96px; }
.plist { display: flex; flex-direction: column; background: var(--putih); border-top: 1px solid var(--garis); border-bottom: 1px solid var(--garis); }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--garis); text-align: left; min-height: 64px; width: 100%; }
.prow:last-child { border-bottom: 0; }
.prow-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prow-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.fab { position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--zamrud); color: #fff; box-shadow: 0 6px 16px rgba(11, 61, 48, 0.35); display: flex; align-items: center; justify-content: center; z-index: 5; }
.photo-box { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.photo-prev { width: 92px; height: 92px; border-radius: 16px; object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: var(--hutan); }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-card { background: var(--putih); border: 1px solid var(--garis); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.stock-now { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stock-now strong { flex: 1; font-variant-numeric: tabular-nums; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item { text-align: left; background: var(--putih); border: 1px solid var(--garis); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.menu-item span { color: var(--abu); font-size: 13px; }
.imp-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--garis); }
.import-out { margin-top: 12px; }

/* ---- kasbon ---- */
.summary-card { margin: 12px; background: var(--hutan); color: #fff; border-radius: var(--r); padding: 14px 16px; display: flex; justify-content: space-between; align-items: baseline; }
.summary-card .lbl { color: #bfe3d5; }
.summary-card strong { font-size: 24px; color: var(--emas); font-variant-numeric: tabular-nums; }
.debt-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 12px; }
.debt-head strong { font-size: 32px; font-variant-numeric: tabular-nums; }
.ledger { background: var(--putih); border: 1px solid var(--garis); border-radius: 12px; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--garis); }
.lrow:last-child { border-bottom: 0; }
.lrow > div:first-child { flex: 1; }
.lamt { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- laporan ---- */
.report-body { padding: 4px 0 24px; }
.report-body > .btn, .report-body > .note { margin: 0 12px 12px; width: calc(100% - 24px); }
.hero-stat { margin: 4px 12px 12px; background: var(--hutan); color: #fff; border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.hero-stat .lbl { color: #bfe3d5; }
.hero-stat strong { font-size: 32px; font-variant-numeric: tabular-nums; }
.hero-stat .psub { color: #bfe3d5; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 12px 12px; }
.stat { background: var(--putih); border: 1px solid var(--garis); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat.good strong { color: var(--zamrud); }
.stat.warn strong { color: #8a5f00; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar { width: 100%; background: var(--zamrud); border-radius: 4px 4px 0 0; min-height: 3px; }
.bar.zero { background: var(--garis); }
.bar-lbl { font-size: 10.5px; color: var(--abu); height: 16px; white-space: nowrap; }
.srow-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--garis); padding: 10px 0; text-align: left; min-height: 56px; }
.srow-btn:last-child { border-bottom: 0; }
.srow-btn.void .pprice { text-decoration: line-through; color: var(--abu); }
.srow-l { display: flex; flex-direction: column; gap: 2px; }

/* ---- struk, pemindai, kunci, onboarding, pengaturan ---- */
.receipt-wrap { background: #fff; border: 1px dashed #cfc7b4; border-radius: 8px; padding: 12px; overflow-x: auto; margin-bottom: 12px; }
.receipt { margin: 0; font: 13px/1.35 ui-monospace, 'Courier New', monospace; white-space: pre; }
.scan-box { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60dvh; margin: 0 auto 10px; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 3px; background: var(--emas); box-shadow: 0 0 12px var(--emas); }
.scan-hint { text-align: center; color: var(--abu); font-variant-numeric: tabular-nums; }
.lockscreen { position: fixed; inset: 0; z-index: 100; background: var(--hutan); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lock-card { background: var(--krem); border-radius: 20px; padding: 24px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.lock-title { font-size: 22px; color: var(--hutan); }
.lock-sub { color: var(--abu); }
.onboard { min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; justify-content: center; padding: 28px 22px; max-width: 460px; margin: 0 auto; }
.onboard h1 { font-size: 26px; color: var(--hutan); line-height: 1.15; }
.settings { padding: 12px 0 24px; }
.settings > .btn { margin: 0 12px 12px; width: calc(100% - 24px); }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.setrow-t { display: flex; flex-direction: column; }
.qris-box { margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  .rise-line { animation: none; transform: rotate(-32deg) scaleX(1); }
  .toast { transition: none; }
}

/* ---- Larisa Cloud ---- */
.invite-code { font: 800 30px/1.2 ui-monospace, 'Courier New', monospace; letter-spacing: 0.12em; text-align: center; background: var(--putih); border: 2px dashed var(--zamrud); border-radius: 14px; padding: 14px; margin: 12px 0 6px; user-select: all; }
.mono { font-family: ui-monospace, 'Courier New', monospace; word-break: break-all; color: var(--tinta); }
.hero-stat.inline { margin: 0 0 12px; }
.admin-inv { margin: 0 0 10px; }
.admin-inv .amount { font-size: 20px; color: var(--hutan); font-variant-numeric: tabular-nums; }
