/* Taplay — gaya aplikasi. Motif: empat simbol tombol kontroler sebagai penanda kategori. */
:root {
  --ink: #14172b; --ink-2: #474d6d; --ink-3: #7a809c;
  --paper: #f0f1f7; --surface: #ffffff; --surface-2: #f6f7fb; --line: #e0e2ee;
  --primary: #2d4cff; --primary-ink: #ffffff; --primary-soft: #e7eaff;
  --ok: #0f8f64; --ok-soft: #dcf4e9; --bad: #d92c46; --bad-soft: #fde5e9; --warn: #9a6200; --warn-soft: #fff0cc;
  --tri: #17a673; --cir: #e5384f; --cro: #2d4cff; --squ: #d6559f;
  --nav: #14172b; --nav-ink: #b9bfdc; --nav-on: #ffffff;
  --shadow: 0 1px 2px rgba(20, 23, 43, .06), 0 6px 18px rgba(20, 23, 43, .06);
  --r: 12px; --r-sm: 8px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-d: 'Sora', 'Manrope', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eceefc; --ink-2: #b3b8d6; --ink-3: #868cab;
    --paper: #0d0f1f; --surface: #161930; --surface-2: #1c2040; --line: #2a2f55;
    --primary: #7389ff; --primary-ink: #0b0d1e; --primary-soft: #232a62;
    --ok: #3dd29d; --ok-soft: #12362b; --bad: #ff6b80; --bad-soft: #3d1621; --warn: #f3bb4a; --warn-soft: #3a2c0c;
    --nav: #0a0c1a; --nav-ink: #9aa1c6; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --ink: #eceefc; --ink-2: #b3b8d6; --ink-3: #868cab;
  --paper: #0d0f1f; --surface: #161930; --surface-2: #1c2040; --line: #2a2f55;
  --primary: #7389ff; --primary-ink: #0b0d1e; --primary-soft: #232a62;
  --ok: #3dd29d; --ok-soft: #12362b; --bad: #ff6b80; --bad-soft: #3d1621; --warn: #f3bb4a; --warn-soft: #3a2c0c;
  --nav: #0a0c1a; --nav-ink: #9aa1c6; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--font-d); margin: 0; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── tombol & form ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 650; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: .88rem; }
.btn.lg { min-height: 54px; font-size: 1.05rem; padding: 0 22px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > label, .lbl { font-size: .84rem; font-weight: 650; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--ink-3); }
.input, .select, textarea.input { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.input:focus, .select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
textarea.input { min-height: 72px; resize: vertical; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 0; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; min-height: 42px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 42px; padding: 0 16px; font-weight: 650; color: var(--ink-2); }
.seg button.on { background: var(--primary); color: var(--primary-ink); }
.step { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.step button { width: 40px; border: 0; background: var(--surface-2); font-size: 1.15rem; font-weight: 700; }
.step input { width: 64px; border: 0; text-align: center; background: transparent; min-height: 40px; -moz-appearance: textfield; }
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── pil, kartu, tabel ── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.blue { background: var(--primary-soft); color: var(--primary); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.card h2 { margin-bottom: 12px; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .78rem; font-weight: 700; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.tbl .r { text-align: right; } .tbl td.act { text-align: right; white-space: nowrap; }
.tbl tr.dim td { opacity: .5; }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 1.02rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 11px 16px; font-weight: 650; color: var(--ink-3); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--primary); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; font-size: .9rem; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.glyph { width: 14px; height: 14px; flex: none; }

/* ── beranda & laporan ── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .k { font-size: .84rem; font-weight: 650; color: var(--ink-3); }
.kpi .v { font-family: var(--font-d); font-size: 1.6rem; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.02em; }
.kpi .s { font-size: .82rem; color: var(--ink-3); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.list { display: grid; }
.list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list > div:last-child { border-bottom: 0; }
.bar { height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ── kasir ── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.pos-menu .tools { display: grid; gap: 12px; margin-bottom: 14px; position: sticky; top: 0; background: var(--paper); padding: 2px 0 10px; z-index: 5; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.mcard { text-align: left; display: flex; flex-direction: column; gap: 10px; min-height: 118px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); position: relative; transition: transform .08s, border-color .12s; }
.mcard:active { transform: scale(.98); }
.mcard:hover { border-color: var(--primary); }
.mcard .nm { font-weight: 700; line-height: 1.25; }
.mcard .pr { font-family: var(--font-d); font-weight: 700; margin-top: auto; font-size: 1.02rem; }
.mcard .badge { position: absolute; top: 10px; right: 10px; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.mcard .badge.low { background: var(--warn-soft); color: var(--warn); }
.mcard .qty-on { position: absolute; top: -8px; left: -8px; min-width: 28px; height: 28px; border-radius: 99px; background: var(--primary); color: var(--primary-ink); font-weight: 800; display: grid; place-items: center; padding: 0 7px; box-shadow: var(--shadow); }
.mcard[disabled] { opacity: .45; pointer-events: none; }
.mcard.in { border-color: var(--primary); }
.pos-cart { position: sticky; top: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.cart-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.cart-lines { overflow-y: auto; padding: 4px 16px; min-height: 64px; flex: 1; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: center; }
.cline:last-child { border: 0; }
.cline .step { justify-self: start; } .cline .step input { width: 56px; }
.cline .nm { font-weight: 650; } .cline .sub { font-size: .84rem; color: var(--ink-3); }
.cline .ln { text-align: right; font-weight: 700; }
.cart-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: grid; gap: 9px; background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.sum div { display: flex; justify-content: space-between; padding: 2px 0; }
.sum .total { font-family: var(--font-d); font-weight: 700; font-size: 1.5rem; padding-top: 6px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; } .quick button { flex: 1; min-width: 78px; white-space: nowrap; }
.cart-bar { display: none; }
@media (max-width: 960px) {
  .pos { grid-template-columns: 1fr; }
  .pos-cart { position: fixed; left: 0; right: 0; bottom: 60px; top: auto; max-height: 88vh; z-index: 50; border-radius: 18px 18px 0 0; transform: translateY(calc(100% - 62px)); transition: transform .22s ease; }
  .pos-cart.open { transform: none; bottom: 0; max-height: 94vh; z-index: 80; }
  .cart-bar { display: flex; justify-content: space-between; align-items: center; height: 62px; padding: 0 18px; background: var(--primary); color: var(--primary-ink); border-radius: 18px 18px 0 0; font-weight: 700; border: 0; width: 100%; flex: none; }
  .cart-bar b { font-family: var(--font-d); font-size: 1.1rem; }
  .cart-head { display: none; } .pos-cart.open .cart-head { display: flex; }
  .main.has-cart { padding-bottom: 150px; }
}
@media (min-width: 721px) and (max-width: 960px) { .pos-cart { bottom: 0; } }
.nota-big { text-align: center; padding: 6px 0 12px; }
.nota-big .tick { width: 54px; height: 54px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 10px; }
.nota-big .amt { font-family: var(--font-d); font-size: 2rem; font-weight: 800; }

/* ── modal, toast ── */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 28, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal.wide { width: min(860px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header button { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--ink-3); width: 36px; height: 36px; border-radius: 8px; }
.modal .body { padding: 18px 20px; overflow-y: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: grid; gap: 8px; z-index: 200; width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); font-weight: 600; box-shadow: var(--shadow); animation: fade .15s ease; }
.toast.bad { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
[data-theme="dark"] .toast.ok, [data-theme="dark"] .toast.bad { color: #0b0d1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.ok, :root:not([data-theme="light"]) .toast.bad { color: #0b0d1e; } }
@media (max-width: 720px) { .toasts { bottom: 150px; } .modal { max-height: calc(100vh - 16px); } .overlay { padding: 8px; align-items: end; } }

/* ── form dalam modal: baris item ── */
.lines { display: grid; gap: 10px; margin-bottom: 10px; }
.lrow { display: grid; grid-template-columns: minmax(0, 1.6fr) auto minmax(0, 1fr) 36px; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.lrow .calc { grid-column: 1 / -1; font-size: .82rem; color: var(--ink-3); }
.lrow.resep { grid-template-columns: minmax(0, 1.6fr) auto 36px; }
.xbtn { border: 0; background: transparent; width: 36px; height: 40px; font-size: 1.2rem; color: var(--ink-3); border-radius: 8px; } .xbtn:hover { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 640px) { .lrow { grid-template-columns: 1fr 36px; } .lrow > :nth-child(2), .lrow > :nth-child(3) { grid-column: 1 / 2; } }
.calcbox { padding: 14px; border-radius: var(--r-sm); background: var(--primary-soft); display: grid; gap: 4px; font-size: .92rem; }
.calcbox div { display: flex; justify-content: space-between; gap: 10px; }
.calcbox .big { font-family: var(--font-d); font-weight: 700; font-size: 1.1rem; }
.tag-low { color: var(--bad); font-weight: 700; }

/* ── cetak nota ── */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; width: 72mm; margin: 0 auto; color: #000; font: 12px/1.35 'Courier New', monospace; }
  #print-area .c { text-align: center; } #print-area hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
  #print-area .l { display: flex; justify-content: space-between; gap: 8px; }
  @page { margin: 4mm; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
