/* Palette from design-refs pantau-abu-v4 (cream, ink, orange, teal). Warm paper because the page is built around one receipt. */
:root {
  --bg: #F4F1EA;
  --ink: #1B1A17;
  --muted: #5F594E;
  --line: #D9D3C5;
  --accent: #E5673A;
  --accent-text: #B8431B;
  --on-accent: #1B1A17;
  --teal: #1F6F78;
  --on-teal: #F4F1EA;
  --on-teal-soft: #E3EEEC;
  --band: #1B1A17;
  --on-band: #F4F1EA;
  --on-band-soft: #CFC8B8;
  --paper: #FBF8F0;
  --paper-ink: #1B1A17;
  --paper-muted: #5F594E;
  --paper-rule: #B9B2A2;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 22px;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --body: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --pad: clamp(1rem, 4vw, 3rem);
  --max: 74rem;
}
:root[data-theme='dark'] {
  --bg: #171512;
  --ink: #F1EDE3;
  --muted: #B3AB9C;
  --line: #3A352D;
  --accent: #F0804F;
  --accent-text: #F0804F;
  --on-accent: #171512;
  --teal: #14464C;
  --on-teal: #F1EDE3;
  --on-teal-soft: #D2E2E0;
  --band: #2A2620;
  --on-band: #F1EDE3;
  --on-band-soft: #C4BCAB;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--body);
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute; left: var(--pad); top: -4rem;
  background: var(--ink); color: var(--bg);
  padding: .75rem 1rem; border-radius: var(--r-sm); z-index: 10;
}
.skip:focus { top: .75rem; }

/* Header */
.top {
  position: relative;
  display: flex; align-items: center; gap: 1.5rem;
  max-width: var(--max); margin: 0 auto;
  padding: 1rem var(--pad);
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 44px; text-decoration: none;
  font: 800 1.25rem/1 var(--display);
}
.brand-mark { color: var(--ink); }
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 .85rem; border-radius: var(--r-sm);
  text-decoration: none; font-weight: 600; font-size: .98rem;
}
.nav a:hover { background: var(--line); }
.nav .nav-out { border: 1.5px solid var(--ink); margin-left: .5rem; }
.nav .nav-out:hover { background: var(--ink); color: var(--bg); }
.top-tools { display: flex; gap: .25rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  background: none; border: 1.5px solid transparent; border-radius: var(--r-md);
}
.icon-btn:hover { background: var(--line); }
.menu-btn { display: none; }
.i-sun { display: none; }
:root[data-theme='dark'] .i-sun { display: block; }
:root[data-theme='dark'] .i-moon { display: none; }

/* Hero */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) var(--pad) clamp(3rem, 8vw, 6rem);
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem); align-items: start;
}
.h1-lead {
  display: block;
  font: 500 clamp(1.5rem, 3.4vw, 2.4rem)/1.1 var(--display);
  color: var(--muted);
  margin-bottom: .35rem;
}
.amount-row {
  display: flex; align-items: baseline; gap: .15em;
  border-bottom: 4px solid var(--accent);
  padding-bottom: .1em;
  font-family: var(--display); font-weight: 800;
  line-height: 1;
}
.rp { font-size: .5em; color: var(--muted); font-weight: 500; }
.amount-row { font-size: 5rem; }
.amount {
  flex: 1 1 auto; min-width: 0; width: 100%;
  background: none; border: 0; padding: 0;
  font: inherit; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  border-radius: 0;
}
.amount::placeholder { color: var(--muted); opacity: .6; }
.amount:focus-visible { outline: 0; }
.amount-row:focus-within { box-shadow: 0 4px 0 0 var(--bg), 0 7px 0 0 var(--accent-text); }
.hero-sub { margin-top: 1.5rem; max-width: 34rem; font-size: 1.15rem; }
.amount-info {
  margin-top: 1rem; min-height: 1.6em;
  font-family: var(--display); font-weight: 500; font-size: 1.2rem;
  color: var(--ink);
}
.amount-info.warn { color: var(--accent-text); }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; }
.presets-label { color: var(--muted); margin-right: .25rem; }
.presets button {
  min-height: 44px; padding: 0 1rem;
  background: none; border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  font-weight: 600;
}
.presets button:hover, .presets button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }

/* Receipt */
.hero-receipt { filter: drop-shadow(0 18px 18px rgba(27, 26, 23, .18)); }
:root[data-theme='dark'] .hero-receipt { filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .5)); }
.receipt {
  background: var(--paper); color: var(--paper-ink);
  padding: 1.5rem 1.4rem 2.2rem;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
}
.receipt-head { padding-bottom: 1rem; border-bottom: 2px dashed var(--paper-rule); }
.receipt-head h2 { font: 800 1.5rem/1.1 var(--display); }
.receipt-meta { margin-top: .3rem; font-size: .92rem; color: var(--paper-muted); }
.receipt-body { padding: .5rem 0; }
.line { padding: .85rem 0; border-bottom: 1px dotted var(--paper-rule); }
.line:last-child { border-bottom: 0; }
.line-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; font-weight: 600; }
.line-price { font-weight: 400; font-size: .92rem; color: var(--paper-muted); white-space: nowrap; }
.line-qty {
  margin-top: .1rem;
  font: 800 1.75rem/1.15 var(--display);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.line-qty.zero { color: var(--paper-muted); font-weight: 500; }
.line-sub { font-size: .92rem; color: var(--paper-muted); }
.receipt-foot { padding-top: 1rem; border-top: 2px dashed var(--paper-rule); }
.foot-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.foot-label { font-weight: 600; }
.foot-total { font: 800 1.3rem/1.2 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.foot-words { margin-top: .35rem; font-size: .92rem; color: var(--paper-muted); }
.state { padding: 1.25rem 0; }
.state strong { display: block; font: 800 1.2rem/1.25 var(--display); margin-bottom: .35rem; }
.state p { color: var(--paper-muted); }
.state button {
  margin-top: .9rem; min-height: 44px; padding: 0 1rem;
  background: var(--paper-ink); color: var(--paper); border: 0; border-radius: var(--r-sm); font-weight: 600;
}
.state button:hover { background: var(--accent-text); color: #fff; }
.state .bar { display: block; height: .7rem; margin: .7rem 0; background: var(--line); border-radius: 3px; }

/* Cilok stack: teal band, the one place the page goes loud */
.stack {
  background: var(--teal); color: var(--on-teal);
  padding: clamp(3rem, 8vw, 6.5rem) max(var(--pad), calc((100% - var(--max)) / 2 + var(--pad)));
}
.stack-title { font: 500 clamp(1.1rem, 2.4vw, 1.5rem)/1.2 var(--display); color: var(--on-teal-soft); }
.stack-line { margin-top: 1rem; max-width: 62rem; }
.stack-val {
  display: block;
  font: 800 clamp(2.4rem, 9vw, 7rem)/.95 var(--display);
  letter-spacing: -.02em; overflow-wrap: anywhere;
}
.stack-cmp { display: block; margin-top: 1rem; font: 500 clamp(1.2rem, 2.8vw, 2rem)/1.2 var(--display); }
.stack-note { margin-top: 2rem; font-size: .95rem; color: var(--on-teal-soft); }

/* Warga: narrow sticky head, wide ledger */
.warga {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--pad);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  gap: clamp(1.5rem, 5vw, 4rem); align-items: start;
}
.warga-head { position: sticky; top: 1.5rem; }
.warga-head h2 { font: 800 clamp(1.8rem, 3.6vw, 2.8rem)/1.05 var(--display); letter-spacing: -.01em; }
.warga-lead { margin-top: 1rem; color: var(--muted); }
.warga-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .15rem 1rem;
  padding: 1rem 0; border-bottom: 1.5px solid var(--line);
}
.warga-row:first-child { border-top: 1.5px solid var(--ink); }
.warga-name { font: 600 1.1rem/1.3 var(--body); }
.warga-pop { grid-column: 1; font-size: .92rem; color: var(--muted); }
.warga-share {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right;
  font: 800 clamp(1.4rem, 3vw, 2.1rem)/1.1 var(--display); font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.warga-row.all { border-bottom: 0; border-top: 1.5px solid var(--ink); margin-top: 1rem; }
.warga-src { grid-column: 2; margin-top: -1rem; font-size: .92rem; color: var(--muted); }
.warga-empty { padding: 1rem 0; border-top: 1.5px solid var(--ink); color: var(--muted); }
.warga-empty strong { display: block; font: 800 1.2rem/1.25 var(--display); color: var(--ink); margin-bottom: .3rem; }
.warga-empty button {
  margin-top: .8rem; min-height: 44px; padding: 0 1rem;
  background: none; border: 1.5px solid var(--ink); border-radius: var(--r-sm); font-weight: 600;
}
.warga-empty button:hover { background: var(--ink); color: var(--bg); }

/* Asal angka: plain, small */
.asal {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad) clamp(3rem, 8vw, 6rem);
}
.asal h2 { font: 800 1.4rem/1.2 var(--display); padding-top: 1.5rem; border-top: 1.5px solid var(--line); }
.asal-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-top: 1.25rem; }
.asal-list dt { font-weight: 600; margin-bottom: .3rem; }
.asal-list dd { color: var(--muted); font-size: .98rem; }

/* Closing band */
.tutup {
  background: var(--band); color: var(--on-band);
  width: min(calc(100% - 2 * var(--pad)), calc(var(--max) - 2 * var(--pad)));
  margin: 0 auto; border-radius: var(--r-lg);
  padding: clamp(1.75rem, 6vw, 4.5rem);
}
.tutup h2 { font: 800 clamp(1.7rem, 4vw, 3rem)/1.05 var(--display); max-width: 34rem; }
.tutup p { margin-top: 1rem; color: var(--on-band-soft); max-width: 34rem; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; margin-top: 1.5rem; padding: 0 1.4rem;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-md); font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--on-band); }
.tutup :focus-visible { outline-color: var(--accent); }

.foot {
  max-width: var(--max); margin: 0 auto;
  padding: 2rem var(--pad) 3rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: .95rem;
}
.foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .5rem; }

/* Tablet and down */
@media (max-width: 899px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .warga { grid-template-columns: minmax(0, 1fr); }
  .warga-head { position: static; }
  .warga-src { grid-column: 1; margin-top: 0; }
  .asal-list { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
}
@media (min-width: 900px) {
  .hero-receipt { transform: rotate(1.2deg); }
}
@media (max-width: 719px) {
  .menu-btn { display: inline-grid; }
  .top { gap: .5rem; }
  .top-tools { margin-left: auto; }
  .nav {
    display: none; position: absolute; left: var(--pad); right: var(--pad); top: calc(100% - .25rem);
    flex-direction: column; align-items: stretch; margin: 0; padding: .5rem;
    background: var(--bg); border: 1.5px solid var(--ink); border-radius: var(--r-md); z-index: 5;
  }
  .nav.open { display: flex; }
  .nav .nav-out { margin: .25rem 0 0; justify-content: center; }
  .amount-row { border-bottom-width: 3px; }
}
