/* KOPI KOGO POS — tampilan hijau-putih, dioptimalkan untuk iPad (Safari) */
:root {
  --brand: #0f6b43;
  --brand-600: #12804f;
  --brand-700: #0b5435;
  --brand-50: #ecf7f1;
  --brand-100: #d3ede0;
  --brand-200: #a9dbc2;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --ink: #13261c;
  --ink-2: #3f5248;
  --muted: #6b7c73;
  --line: #dde6e1;
  --line-2: #eef3f0;
  --danger: #c0392b;
  --danger-50: #fdeeec;
  --warn: #a86600;
  --warn-50: #fff5e0;
  --good: #0f6b43;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 28, .06), 0 4px 16px rgba(16, 40, 28, .06);
  --shadow-lg: 0 12px 40px rgba(16, 40, 28, .18);
  --nav-w: 216px;
  --tap: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pos-val { color: var(--good); }
.neg-val { color: var(--danger); }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--brand); z-index: 50; }
.boot-logo { color: #fff; font-weight: 800; font-size: 32px; letter-spacing: .3em; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- Auth ---------- */
.auth {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-700) 100%);
}
.auth-card { width: min(440px, 100%); background: var(--surface); border-radius: 24px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card .logo-mark { width: 64px; height: 64px; font-size: 32px; border-radius: 18px; margin-bottom: 16px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card p.muted { margin-bottom: 22px; }
.auth-card form { display: grid; gap: 14px; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100dvh; min-height: 100vh; }
.nav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px calc(14px + var(--safe-b)) calc(12px + var(--safe-l));
  gap: 8px; overflow-y: auto;
}
.nav-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 22px;
}
.logo-img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; flex: none; display: block; }
.auth-card .logo-img { width: auto; height: auto; max-width: 260px; max-height: 110px; border-radius: 0; margin-bottom: 18px; background: none; }
.nav-brand.has-logo { justify-content: center; }
.nav-brand.has-logo #nav-logo { width: 100%; }
.nav-brand.has-logo .logo-img { width: 100%; height: auto; max-height: 64px; border-radius: 0; background: none; }
.nav-brand.has-logo .nav-brand-text { display: none; }
.photo-picker .logo-ph img { object-fit: contain; background: #fff; }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.nav-brand-text strong { font-size: 16px; letter-spacing: .06em; color: var(--brand); }
.nav-brand-text span { font-size: 12px; color: var(--muted); letter-spacing: .3em; }
.nav-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 0 14px;
  border: 0; border-radius: var(--radius-sm); background: none;
  font-size: 16px; font-weight: 600; color: var(--ink-2); text-align: left; text-decoration: none;
}
.nav-link:active { background: var(--brand-50); }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link .ico { width: 24px; height: 24px; flex: none; }
.nav-user { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.nav-user-info { padding: 0 14px; display: flex; flex-direction: column; min-width: 0; }
.nav-user-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-info span { font-size: 13px; color: var(--muted); }

.view { overflow-y: auto; -webkit-overflow-scrolling: touch; outline: none; padding: 24px 28px calc(32px + var(--safe-b)); }
.view.full { padding: 0; overflow: hidden; }

.ico { display: inline-block; width: 22px; height: 22px; }
.ico svg { width: 100%; height: 100%; display: block; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 650; white-space: nowrap;
  transition: transform .06s ease, background .15s ease;
  user-select: none; -webkit-user-select: none; text-decoration: none;
}
a { color: var(--brand-700); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-700); }
.btn.soft { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.btn.danger { background: var(--surface); border-color: #f0c4be; color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.lg { min-height: 64px; font-size: 19px; border-radius: var(--radius); }
.btn.sm { min-height: 42px; padding: 0 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: var(--tap); }
.btn .ico { width: 20px; height: 20px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 17px; /* >=16px agar Safari tidak zoom otomatis */
  appearance: none; -webkit-appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7c73' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 40px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.input.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.input-prefix { position: relative; }
.input-prefix > b { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-prefix > .input { padding-left: 46px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-error { color: var(--danger); background: var(--danger-50); border-radius: 10px; padding: 10px 12px; font-size: 15px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px;
  background: transparent; font-weight: 650; color: var(--ink-2);
}
.seg button.active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.block { display: flex; }
.seg.block button { flex: 1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 46px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 650; color: var(--ink-2);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9d3ce; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(22px); }

/* ---------- Cards / tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { color: var(--muted); font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.stack { display: grid; gap: 16px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.tile .t-label { font-size: 14px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tile .t-value { font-size: 26px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.tile .t-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tile.hero { background: var(--brand); border-color: var(--brand); color: #fff; }
.tile.hero .t-label, .tile.hero .t-sub { color: var(--brand-100); }
.tile.accent { background: var(--brand-50); border-color: var(--brand-100); }

.meter { height: 12px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.meter-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

.kv { display: grid; gap: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.kv-row:last-child { border-bottom: 0; }
.kv-row > span:first-child { color: var(--ink-2); }
.kv-row > b, .kv-row > span:last-child { font-variant-numeric: tabular-nums; text-align: right; }
.kv-row.total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; font-size: 18px; }
.kv-row.total > span:first-child { color: var(--ink); font-weight: 700; }
.kv-row.sub > span:first-child { padding-left: 14px; color: var(--muted); }
.kv-row.minus > b::before { content: "− "; }

.note { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.note.warn { background: var(--warn-50); border-color: #f2d9a6; color: var(--warn); }

.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--brand-50); color: var(--brand-700); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.amber { background: var(--warn-50); color: var(--warn); }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:active td { background: var(--brand-50); }
.table tr.voided td { color: var(--muted); }
.table tr.voided td .strike { text-decoration: line-through; }

.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); min-height: 64px; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; }
.list-item .sub { font-size: 14px; color: var(--muted); }
.list-item button.row-btn { all: unset; flex: 1; min-width: 0; cursor: pointer; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 48px; height: 48px; color: var(--brand-200); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Chart (bar, satu seri) ---------- */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; height: 180px; padding-top: 24px; border-bottom: 1px solid var(--line); position: relative; }
.bar { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; border: 0; background: none; padding: 0; }
.bar > i { display: block; width: min(44px, 100%); background: var(--brand-600); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.today > i { background: var(--brand-700); }
.bar.zero > i { background: var(--line); }
.bar .bar-tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; font-variant-numeric: tabular-nums;
}
.bar:hover .bar-tip, .bar:focus .bar-tip, .bar.show .bar-tip { opacity: 1; }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.bar-labels b { display: block; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100%; }
.pos-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-top { padding: 18px 20px 12px; display: grid; gap: 12px; background: var(--bg); }
.pos-top .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.pos-top .chips::-webkit-scrollbar { display: none; }
.pos-top .chip { flex: none; }
.search { position: relative; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search .input { padding-left: 44px; }
.products {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 20px calc(24px + var(--safe-b));
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-content: start;
}
.product {
  position: relative; display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 0; overflow: hidden; min-height: 190px;
  transition: transform .06s ease, border-color .15s;
  user-select: none; -webkit-user-select: none;
}
.product:active { transform: scale(.96); border-color: var(--brand); }
.product .ph { aspect-ratio: 4 / 3; width: 100%; background: var(--brand-50); display: grid; place-items: center; overflow: hidden; }
.product .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product .ph .initial { font-size: 36px; font-weight: 800; color: var(--brand-600); }
.product .p-body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.product .p-name { font-weight: 650; font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .p-price { color: var(--brand-700); font-weight: 750; font-variant-numeric: tabular-nums; }
.product .qty-badge {
  position: absolute; top: 8px; right: 8px; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px;
  background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.cart { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 18px 20px 10px; display: flex; align-items: center; justify-content: space-between; }
.cart-head { gap: 10px; }
.cart-title { all: unset; display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cart-title h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-title > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-title.is-bill { cursor: pointer; }
.btn .ico { flex: none; }
.cart-title.is-bill h2 { color: var(--brand-700); }
.cart-head .head-actions { flex-wrap: nowrap; gap: 6px; }
.cart-head .btn.sm.icon { width: 42px; }
.foot-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.foot-actions .btn { padding: 0 4px; font-size: 13.5px; gap: 5px; }
.foot-actions .btn .ico { width: 17px; height: 17px; }
.cart-items { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 20px; min-height: 80px; }
.cart-empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.cart-line .cl-name { font-weight: 650; }
.cart-line .cl-price { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cart-line .cl-total { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 46px; height: 44px; border: 0; background: var(--surface); font-size: 22px; font-weight: 700; color: var(--brand-700); }
.stepper button:active { background: var(--brand-50); }
.stepper span { min-width: 40px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.cart-foot { border-top: 1px solid var(--line); padding: 14px 20px calc(16px + var(--safe-b)); display: grid; gap: 12px; background: var(--surface); }
.sum-row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.sum-row.total { font-size: 24px; font-weight: 800; }
.sum-row.disc { color: var(--danger); }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-methods button {
  min-height: 56px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface);
  font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.pay-methods button.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-cash button { min-height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; padding: 0 2px; white-space: nowrap; letter-spacing: -.01em; }
.quick-cash button:active { background: var(--brand-50); }
.change-row { display: flex; justify-content: space-between; align-items: center; font-weight: 700; padding: 10px 14px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); font-variant-numeric: tabular-nums; }
.change-row.short { background: var(--danger-50); color: var(--danger); }
.cart-toggle { display: none; }

/* ---------- Menu admin ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.menu-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: left; width: 100%; }
.menu-card.inactive { opacity: .55; }
.menu-card .ph { width: 76px; height: 76px; border-radius: 12px; background: var(--brand-50); flex: none; overflow: hidden; display: grid; place-items: center; }
.menu-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.menu-card .ph .initial { font-size: 28px; font-weight: 800; color: var(--brand-600); }
.menu-card .mc-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.menu-card .mc-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-card .mc-meta { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.photo-picker { display: flex; gap: 16px; align-items: center; }
.photo-picker .ph { width: 110px; height: 110px; border-radius: 16px; background: var(--brand-50); overflow: hidden; display: grid; place-items: center; flex: none; border: 1.5px dashed var(--brand-200); }
.photo-picker .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-picker .actions { display: grid; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; font-size: 200px; cursor: pointer; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 30, 20, .45);
  display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
.modal.wide { width: min(760px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 1; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px 24px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 20px 24px; display: grid; gap: 16px; }
.modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.success-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 4px auto 6px; }
.success-icon .ico { width: 42px; height: 42px; }
.big-amount { font-size: 34px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; width: min(520px, calc(100% - 32px)); }
.toast > div { background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .2s ease; text-align: center; }
.toast > div.error { background: var(--danger); }
.toast > div.ok { background: var(--brand); }

/* ---------- Report ---------- */
.report-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav .input { width: auto; min-width: 170px; }
.period-title { font-size: 15px; color: var(--muted); margin-bottom: 14px; }
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  :root { --nav-w: 92px; }
  .nav { padding-left: calc(8px + var(--safe-l)); padding-right: 8px; }
  .nav-brand { justify-content: center; padding: 4px 0 12px; }
  .nav-brand-text, .nav-user-info { display: none; }
  .nav-link { flex-direction: column; justify-content: center; gap: 4px; padding: 8px 4px; min-height: 64px; font-size: 12px; text-align: center; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .view { padding: 18px 16px calc(28px + var(--safe-b)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) 330px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding-left: 14px; padding-right: 14px; }
  .pos-top { padding-left: 14px; padding-right: 14px; }
  .cart-head, .cart-items, .cart-foot { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .nav { order: 2; flex-direction: row; padding: 6px 6px calc(6px + var(--safe-b)); border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; }
  .nav-brand { display: none; }
  .nav-links { flex-direction: row; flex: 1; }
  .nav-user { border: 0; padding: 0; }
  .nav-link { min-width: 64px; flex: 1; }
  .view { order: 1; }
  .tiles, .tiles.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .t-value { font-size: 21px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr); position: relative; }
  .cart { position: absolute; inset: 0; z-index: 5; transform: translateX(100%); transition: transform .2s ease; border-left: 0; }
  .cart.open { transform: none; }
  .cart-toggle { display: flex; position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 4; }
  .products { padding-bottom: 90px; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  body.printing > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  body.print-receipt #print-area { width: 72mm; font-size: 12px; }
  .print-only { display: block; }
}
#print-area { display: none; }
.receipt { font-family: "Courier New", ui-monospace, monospace; font-size: 12px; color: #000; line-height: 1.35; }
.receipt .c { text-align: center; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt h2 { font-size: 16px; margin: 0; }
.receipt .r-logo { display: block; max-width: 50mm; max-height: 22mm; margin: 0 auto 4px; object-fit: contain; filter: grayscale(1) contrast(1.2); }

/* Invoice A4 */
.invoice { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; font-size: 13px; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.invoice .inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 14px; border-bottom: 3px solid #0f6b43; }
.invoice .inv-brand { display: flex; gap: 14px; align-items: center; }
.invoice .inv-brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.invoice .inv-brand img { width: auto; height: auto; max-width: 220px; max-height: 80px; object-fit: contain; }
.invoice .inv-store { font-size: 20px; font-weight: 800; color: #0f6b43; }
.invoice .inv-title { text-align: right; }
.invoice .inv-word { font-size: 26px; font-weight: 800; letter-spacing: .08em; color: #0f6b43; }
.invoice .inv-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.invoice .inv-meta span { display: block; font-size: 11px; color: #555; text-transform: uppercase; letter-spacing: .05em; }
.invoice .inv-status.lunas { color: #0f6b43; }
.invoice .inv-status.belum, .invoice .inv-status.batal { color: #c0392b; }
.invoice .inv-table { width: 100%; border-collapse: collapse; }
.invoice .inv-table th { background: #ecf7f1; text-align: left; padding: 8px; font-size: 12px; }
.invoice .inv-table td { padding: 8px; border-bottom: 1px solid #ddd; }
.invoice .num, .invoice .inv-table th.num { text-align: right; white-space: nowrap; }
.invoice .inv-sum { width: 300px; margin: 12px 0 0 auto; }
.invoice .inv-sum .r { display: flex; justify-content: space-between; padding: 4px 0; }
.invoice .inv-total { border-top: 2px solid #000; margin-top: 4px; padding-top: 8px !important; font-size: 17px; font-weight: 800; }
.invoice .inv-foot { margin-top: 30px; text-align: center; color: #555; }
.print-report { color: #000; font-size: 12px; }
.print-report h1 { font-size: 20px; }
.print-report h2 { font-size: 15px; margin: 16px 0 6px; }
.print-report table { width: 100%; border-collapse: collapse; }
.print-report th, .print-report td { border-bottom: 1px solid #bbb; padding: 4px 6px; text-align: left; }
.print-report td.num, .print-report th.num { text-align: right; }
.print-report .two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
