/* QRIS Dinamis — satu kolom, putih bersih, minimalis. Brand: logo TB + navy #00366E, cyan #29E0FF untuk fokus. */

:root {
  color-scheme: light dark;
  --navy: #00366E;
  --navy-press: #002A57;
  --cyan: #29E0FF;
  --bg: #FFFFFF;
  --fill: #F4F5F7;
  --fill-2: #EAECEF;
  --line: #E3E5E9;
  --ink: #0E1116;
  --ink-2: #4B5260;
  --ink-3: #626A78;
  --primary: var(--navy);
  --primary-press: var(--navy-press);
  --on-primary: #FFFFFF;
  --focus: #00366E;
  --accent: #00366E;
  --tint: #EEF4FB;
  --tint-line: #D5E3F3;
  --ok: #0B6E4F;
  --danger: #B42318;
  --err-bg: #FDF0EE;
  --warn: #7A4A00;
  --warn-bg: #FFF6E0;
  --r: 12px;
  --f: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0F14;
    --fill: #151A21;
    --fill-2: #1D232C;
    --line: #232A34;
    --ink: #ECEFF3;
    --ink-2: #A9B1BD;
    --ink-3: #8D96A3;
    --primary: #29E0FF;
    --primary-press: #12C4E6;
    --on-primary: #00254D;
    --focus: #29E0FF;
    --accent: #29E0FF;
    --tint: rgba(41, 224, 255, .08);
    --tint-line: rgba(41, 224, 255, .2);
    --ok: #4FD8A0;
    --danger: #FF8B7E;
    --err-bg: rgba(255, 105, 85, .12);
    --warn: #FFD486;
    --warn-bg: rgba(255, 190, 70, .1);
  }
}
:root[data-theme="dark"] {
  --bg: #0B0F14;
  --fill: #151A21;
  --fill-2: #1D232C;
  --line: #232A34;
  --ink: #ECEFF3;
  --ink-2: #A9B1BD;
  --ink-3: #8D96A3;
  --primary: #29E0FF;
  --primary-press: #12C4E6;
  --on-primary: #00254D;
  --focus: #29E0FF;
  --accent: #29E0FF;
  --tint: rgba(41, 224, 255, .08);
  --tint-line: rgba(41, 224, 255, .2);
  --ok: #4FD8A0;
  --danger: #FF8B7E;
  --err-bg: rgba(255, 105, 85, .12);
  --warn: #FFD486;
  --warn-bg: rgba(255, 190, 70, .1);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--f); -webkit-font-smoothing: antialiased;
}
h1, h2, p, figure, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { font-size: 16px; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--bg); padding: 8px 12px; border-radius: 8px; }

/* Satu kolom */
.wrap {
  max-width: 520px; margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.top { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; text-decoration: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--navy); }
.top-act { display: flex; gap: 4px; }
.top .icon-btn { color: var(--ink-2); text-decoration: none; }
.top .icon-btn .i { width: 20px; height: 20px; }

.intro { padding: 24px 0 8px; text-align: center; }
.intro h1 em { font-style: normal; color: var(--accent); }
.intro h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.intro > p:last-child { text-wrap: balance; margin-top: 8px; color: var(--ink-2); font-size: 15px; }

/* Langkah */
.step { display: grid; gap: 12px; padding: 28px 0; border-top: 1px solid var(--line); }
.intro + main .step:first-child { border-top: 0; padding-top: 20px; }
.tag { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.stack { display: grid; gap: 12px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: -6px; }
.label span { font-weight: 400; color: var(--ink-3); }
.hint { font-size: 14px; color: var(--ink-3); text-align: center; }

/* Isian */
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg); transition: border-color .15s ease;
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.paste { min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.4; word-break: break-all; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.amount { text-align: center; min-height: 64px; font-size: 32px; font-weight: 600; letter-spacing: -.02em; }
.amount::placeholder { font-weight: 400; }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, transform .1s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { border-color: transparent; background: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn-primary:active:not(:disabled) { background: var(--primary-press); }
.btn-dark { border-color: transparent; background: var(--primary); color: var(--on-primary); }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-block { width: 100%; min-height: 52px; font-size: 16px; }
@media (hover: hover) and (pointer: fine) {
  .top .icon-btn:hover { color: var(--accent); background: var(--fill); }
  .btn:not(.btn-primary):not(.btn-dark):hover:not(:disabled) { background: var(--fill); }
  .link:hover:not(:disabled) { color: var(--accent); }
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row-save { grid-template-columns: 1fr auto; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--ink-2); font-size: 14px; justify-self: start;
}
.link .i { width: 16px; height: 16px; }
.link:disabled { opacity: .45; cursor: not-allowed; }
.danger { color: var(--danger) !important; }
.stack > .link { justify-self: center; }

/* Chip */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); font-size: 14px; font-weight: 500;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--accent); }
.chip:active { transform: scale(.97); }
.chip-product { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; }
.chip-product > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-price { color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .chip:hover:not([aria-pressed="true"]) { background: var(--fill); } }

/* Kamera */
.camera { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r); background: #000; }

/* Merchant */
.merchant { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--tint-line); border-radius: var(--r); background: var(--tint); }
.merchant > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.merchant dt { color: var(--ink-3); }
.merchant dd { text-align: right; overflow-wrap: anywhere; }
.merchant .m-name { justify-content: center; font-size: 18px; color: var(--accent); font-weight: 600; letter-spacing: -.01em; }
.merchant .m-name dd { text-align: center; }
.ok { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; color: var(--ok); }
.ok .i { width: 16px; height: 16px; }

/* Catatan */
.note { padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.note-err { background: var(--err-bg); color: var(--danger); }
.note-warn { background: var(--warn-bg); color: var(--warn); }

/* Tab */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: var(--r); background: var(--fill); }
.seg [role="tab"] {
  min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font-size: 15px; font-weight: 500;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.seg [aria-selected="true"] { background: var(--bg); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

/* Daftar (keranjang, produk, riwayat) */
.list > li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.list > li:last-child { border-bottom: 0; }
.list > li > span:not(.mono):not(.qty) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list > li.hint { justify-content: center; border: 0; color: var(--ink-3); font-size: 14px; }
.mono { font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; gap: 2px; }
.qty button, .icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--ink-2);
}
.qty button:active, .icon-btn:active { background: var(--fill); }
.qty .mono { min-width: 20px; text-align: center; }
.tx > li > .mono:first-child { color: var(--ink-3); font-size: 13px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 4px; font-size: 15px; color: var(--ink-2); }
.total strong { font-size: 22px; color: var(--accent); letter-spacing: -.01em; }

.manage summary {
  display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; font-size: 14px; color: var(--ink-2);
}
.manage summary::-webkit-details-marker { display: none; }
.manage summary::after { content: "+"; margin-left: 8px; font-size: 18px; line-height: 1; }
.manage[open] summary::after { content: "−"; }
.product-form { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-bottom: 8px; }

/* Tombol buat: menempel di bawah layar HP */
.cta {
  position: sticky; bottom: 0; z-index: 5; margin: 4px -16px 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.cta-sum { margin-left: auto; padding-left: 12px; font-weight: 500; opacity: .85; }
#btn-generate { justify-content: flex-start; }

/* Hasil */
.result { border-radius: var(--r); overflow: hidden; background: var(--fill); }
.result img { display: block; width: 100%; height: auto; }
#sec-result.feed .result { animation: rise .4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Mode kasir */
.cashier { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: var(--bg); }
.cs-in {
  display: grid; justify-items: center; gap: 6px; max-width: 440px; margin: 0 auto; text-align: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}
.cs-k { font-size: 14px; color: var(--ink-3); }
.cs-name { font-size: 22px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cs-nmid { font-size: 13px; color: var(--ink-3); }
.cs-amount { margin-top: 10px; font-size: 40px; font-weight: 600; letter-spacing: -.02em; }
.cs-qr { width: min(100%, 340px); aspect-ratio: 1; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; image-rendering: pixelated; }
.cs-scan { font-weight: 500; }
.cs-warn { font-size: 14px; color: var(--ink-3); }
.cs-in .btn { margin-top: 16px; }

/* Panel pengaturan: lembar dari kanan (desktop) / dari bawah (HP) */
.panel {
  width: min(420px, 100%); max-width: 100%; height: 100%; max-height: 100%; margin: 0 0 0 auto; padding: 0;
  border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.panel::backdrop { background: rgba(10, 14, 20, .4); }
.panel[open] { display: flex; flex-direction: column; animation: slide-in .3s var(--ease); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.panel-top {
  display: flex; align-items: center; justify-content: space-between; min-height: 60px;
  padding: max(8px, env(safe-area-inset-top)) 8px 0 20px; border-bottom: 1px solid var(--line);
}
.panel-title { font-weight: 600; }
.panel-body { overflow-y: auto; }
.panel-sec { display: grid; gap: 12px; align-content: start; padding: 20px; border-bottom: 1px solid var(--line); }
.panel-sec:last-child { border-bottom: 0; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg [role="radio"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.seg [role="radio"] .i { width: 16px; height: 16px; }
.seg [aria-checked="true"] { background: var(--bg); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
.about p { font-size: 14px; color: var(--ink-2); }
.about a { color: var(--accent); }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-h h2 { font-size: 16px; font-weight: 600; }
.panel .hint { text-align: left; }
.panel .links { justify-content: flex-start; }
@media (max-width: 599px) {
  .panel { inset: auto 0 0 0; width: 100%; height: auto; max-height: 85dvh; margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .panel[open] { animation-name: sheet-up; }
  .panel-top { padding-top: 8px; }
  .panel-sec:last-child { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
}

/* Popup Telegram */
.lead {
  width: min(400px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: 16px;
  background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .4);
}
.lead::backdrop { background: rgba(10, 14, 20, .45); }
.lead[open] { display: grid; gap: 12px; animation: rise .3s var(--ease); }
.lead h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.lead p { color: var(--ink-2); font-size: 15px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); }
@media (max-width: 599px) {
  .lead { margin: auto auto max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px); }
}

/* Toast */
.toast {
  position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); z-index: 80;
  max-width: calc(100% - 32px); width: max-content; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; text-align: center;
  transform: translateX(-50%); transition: opacity .2s ease, transform .25s var(--ease);
}
.toast:empty { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; padding: 0; }

@media (min-width: 600px) {
  .intro { padding-top: 40px; }
  .intro h1 { font-size: 30px; }
  .cta { position: static; margin: 4px 0 0; padding: 0; background: none; }
}
@media (max-width: 359px) {
  .row3 { grid-template-columns: 1fr; }
  .product-form { grid-template-columns: 1fr 1fr; }
  .product-form .btn { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
