@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/jakarta.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Lilita One"; src: url("/fonts/lilita.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Anton"; src: url("/fonts/anton.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("/fonts/baloo.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Serif Display"; src: url("/fonts/dmserif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Pacifico"; src: url("/fonts/pacifico.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #F5F7F4;
  --card: #FFFFFF;
  --ink: #1B2730;
  --muted: #566670;
  --line: #D9DFDA;
  --pandan: #0F6B4F;
  --link: #0F6B4F;
  --sambal: #B8322A;
  --pos: #0F6B4F;
  --warn-bg: #FFF4D6;
  --warn-ink: #6B4A00;
  --bad-bg: #FBE4E1;
  --bad-ink: #7A1D16;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: var(--sans); /* angka uang memakai font yang sama, dengan lebar angka seragam */
  color-scheme: light;
}
:root[data-theme="dark"] {
    --paper: #11171A;
    --card: #192125;
    --ink: #E7EDEA;
    --muted: #9BA9AF;
    --line: #2A353B;
    --link: #5FD3A8;
    --sambal: #FF8F80;
    --pos: #5FD3A8;
    --warn-bg: #3A2E10;
    --warn-ink: #F3D68A;
    --bad-bg: #3C1A17;
    --bad-ink: #FFC9C1;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171A;
    --card: #192125;
    --ink: #E7EDEA;
    --muted: #9BA9AF;
    --line: #2A353B;
    --link: #5FD3A8;
    --sambal: #FF8F80;
    --pos: #5FD3A8;
    --warn-bg: #3A2E10;
    --warn-ink: #F3D68A;
    --bad-bg: #3C1A17;
    --bad-ink: #FFC9C1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 20px 16px 8px; }
h3 { font-size: 1rem; margin: 24px 16px 8px; }
h3.in-panel { margin: 0 0 4px; }
h4 { margin: 0 0 6px; font-size: 1rem; }
a { color: var(--link); }

:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* ---------- elemen dasar form ---------- */
label { display: block; margin: 12px 0 4px; font-size: .875rem; color: var(--muted); }
input, select, button {
  font-family: inherit;
}
input, select {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
input.money { font-family: var(--mono); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.grid3 label { margin-top: 4px; font-size: .8rem; }
.group { margin: 12px 0 0; font-size: .875rem; color: var(--muted); }

.btn {
  min-height: 44px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.btn.primary { color: #fff; background: var(--pandan); border-color: var(--pandan); }
.btn.block { display: block; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .6; cursor: default; }
.link {
  min-height: 36px; padding: 4px 6px; font: inherit; color: var(--link); background: none; border: 0;
  text-decoration: underline; cursor: pointer;
}
.link.danger { color: var(--sambal); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.hint { margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
.msg { min-height: 1.5em; margin: 12px 0 0; color: var(--sambal); font-size: .9rem; }
.empty { margin: 12px 16px; color: var(--muted); }
td.empty { margin: 0; padding: 12px 6px; }

.money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.total strong, .plat-price strong { font-family: var(--display); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--sambal); }
.num { text-align: right; }

/* ---------- masuk / daftar ---------- */
#auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { margin: 0 0 8px; font-size: 1.75rem; }
.lead { margin: 0; color: var(--muted); }
.tabs { display: flex; margin: 20px 0 0; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; min-height: 44px; font: inherit; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs button.on { color: var(--link); border-bottom-color: var(--pandan); }

/* ---------- kerangka aplikasi ---------- */
header.top, .banner, .monthbar, main { max-width: 720px; margin-left: auto; margin-right: auto; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.who { min-width: 0; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 8px; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; }
.badge.bad { color: var(--bad-ink); background: var(--bad-bg); border-color: transparent; }
.banner { padding: 10px 16px; font-size: .9rem; color: var(--warn-bg); background: var(--warn-ink); }
.banner { color: var(--warn-ink); background: var(--warn-bg); }
.banner.bad { color: var(--bad-ink); background: var(--bad-bg); }
.banner a { font-weight: 600; }
.monthbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.monthbar label { margin: 0; }
.monthbar input { width: auto; flex: 0 1 180px; }
.monthbar a { margin-left: auto; }
main { padding-bottom: 96px; }

.panel { margin: 12px 16px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
details.panel > summary { cursor: pointer; font-weight: 600; }
.scroll { margin: 0 16px; overflow-x: auto; }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line);
}
.bottom button {
  flex: 1; max-width: 240px; min-height: 56px; font: inherit; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-top: 3px solid transparent; cursor: pointer;
}
.bottom button[aria-current="page"] { color: var(--link); border-top-color: var(--pandan); }

#toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 10; max-width: calc(100% - 32px); padding: 10px 16px;
  color: var(--paper); background: var(--ink); border-radius: 10px; transform: translateX(-50%);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
#toast.err { color: #fff; background: #B8322A; }

/* ---------- ringkasan: struk ---------- */
.struk {
  position: relative; margin: 16px 16px 24px; padding: 4px 18px 22px; background: var(--card);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .18));
}
.struk::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px;
  background:
    linear-gradient(135deg, var(--card) 4px, transparent 0) 0 0 / 8px 8px repeat-x,
    linear-gradient(225deg, var(--card) 4px, transparent 0) 0 0 / 8px 8px repeat-x;
}
.struk h2 { margin: 14px 0 4px; font-size: 1rem; text-align: center; font-weight: 600; color: var(--muted); }
.lines { margin: 0; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lines div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.lines dt { color: var(--muted); }
.lines dd { margin: 0; }
.total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; }
.total span { font-weight: 600; }
.total strong { font-size: 2rem; line-height: 1.1; }
.total strong.pos { color: var(--pos); }
.total strong.neg { color: var(--sambal); }
.insight { margin: 0 16px; padding: 10px 12px; font-size: .95rem; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; }

/* ---------- tabel ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { padding: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); }
.tbl th.num { text-align: right; }
.tbl td { padding: 8px 6px; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl small { display: block; color: var(--muted); }
.tbl .acts { margin-top: 2px; }
.tbl .acts .link { min-height: 32px; padding: 2px 8px 2px 0; font-size: .85rem; }

/* ---------- transaksi ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg label { position: relative; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 100%; height: 100%; min-height: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; padding: 10px; font-weight: 600; text-align: center; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
}
.seg input:checked + span { color: #fff; background: var(--pandan); border-color: var(--pandan); }
.seg input:focus-visible + span { outline: 3px solid var(--link); outline-offset: 2px; }

.txs { margin: 0 16px; padding: 0; list-style: none; }
.tx { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx-cat { font-weight: 600; }
.tx-sub { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.tx-amt { text-align: right; }
.tag { margin-left: 4px; padding: 0 6px; font-size: .75rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; }

/* ---------- kalkulator ---------- */
.plat-grid { display: grid; gap: 12px; margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.plat { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.lbl { display: block; font-size: .8rem; color: var(--muted); }
.plat-price strong { display: block; font-size: 1.4rem; line-height: 1.2; }
.up { font-size: .8rem; color: var(--muted); }
.plat .row { display: flex; justify-content: space-between; margin-top: 6px; }
.warn { margin-top: 8px; padding: 8px 10px; font-size: .85rem; color: var(--warn-ink); background: var(--warn-bg); border-radius: 8px; }

/* daftar produk */
.prods { margin: 0 16px; padding: 0; list-style: none; }
.prod-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.prod-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prod-head .link { min-height: 32px; font-size: .85rem; }
.prod-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.prod-cells .money { display: block; font-size: .95rem; white-space: nowrap; }
.prod-cells small { display: block; font-size: .75rem; color: var(--muted); }
.prod-cells small.neg { color: var(--sambal); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- foto produk ---------- */
.photo-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.thumb, .pthumb {
  flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--muted); font-size: .75rem; background: var(--paper); border: 1px dashed var(--line); border-radius: 10px;
}
.thumb { width: 72px; height: 72px; }
.pthumb { width: 40px; height: 40px; border-radius: 8px; border-style: solid; }
.thumb img, .pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pname strong { overflow-wrap: anywhere; }
.prodpick { margin-top: 4px; }

/* ---------- banner ---------- */
#b-canvas {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 70vh; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
}
#b-info { text-align: center; }
details.panel > summary { margin: -4px 0 4px; min-height: 32px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.theme {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; font: inherit; font-size: .75rem;
  color: var(--ink); cursor: pointer; background: none; border: 2px solid var(--line); border-radius: 10px;
}
.theme[aria-checked="true"] { border-color: var(--pandan); background: var(--paper); }
.theme .sw { position: relative; display: block; width: 100%; height: 36px; border-radius: 6px; }
.theme .sw i { position: absolute; right: 6px; bottom: 6px; width: 18px; height: 8px; border-radius: 4px; }
.chk { display: flex; align-items: flex-end; }
.chk label { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--ink); }
.chk input { width: 20px; min-height: 20px; height: 20px; }
.mrows, .saved { margin: 12px 0 0; padding: 0; list-style: none; }
.mrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.mrow-top { display: flex; gap: 10px; }
.mrow-top .thumb { width: 64px; height: 64px; }
.mrow-fields { flex: 1; min-width: 0; display: grid; gap: 6px; }
.mrow-acts { display: flex; flex-wrap: wrap; gap: 0 6px; margin-top: 2px; }
.mrow-acts .link { min-height: 36px; font-size: .85rem; }
.mrow-acts .link:disabled { opacity: .4; cursor: default; text-decoration: none; }
.mrow-acts .danger { margin-left: auto; }
.saved { margin: 0 16px; }
.saved li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.saved li.cur .s-name { font-weight: 700; }
.s-name { min-width: 0; overflow-wrap: anywhere; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.actions.tight { margin-top: 8px; }

/* ---------- akun, lupa password, impor ---------- */
.seg.three { grid-template-columns: repeat(3, 1fr); }
.credits { margin: 4px 0 0; font-family: var(--display); }
.credits strong { font-size: 2.25rem; line-height: 1; }
.panel .btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#auth .panel { margin: 12px 0; }
#forgot-wrap { margin-top: 4px; }
#auth:has(#tab-register.on) #forgot-wrap, #auth:has(#tab-register.on) #forgot-box { display: none; }
.inline-check { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; color: var(--ink); font-size: .9rem; }
.inline-check input { flex: none; width: 20px; min-height: 20px; height: 20px; margin: 1px 0 0; }
.chklist { margin: 4px 0 0; padding: 4px 10px 8px; border: 1px solid var(--line); border-radius: 8px; }
.imp-preview { margin-top: 12px; }
.imp-preview p { margin: 6px 0; }
.imp-sample { margin: 0; padding: 0; list-style: none; font-size: .9rem; }
.imp-sample li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.imp-sample small { color: var(--muted); overflow-wrap: anywhere; }
.imp-preview .ok { color: var(--pos); }
#forgot-box .btn, #ak-renew { margin-top: 12px; }
