/* ============================================================================
   Rukos — "Warm Ledger" design system
   Calm, trustworthy finance tool with Indonesian warmth.
   Fraunces (display) + Plus Jakarta Sans (UI / tabular numbers).
   ============================================================================ */

:root {
  /* paper & surfaces */
  --paper: #fbf8f1;
  --paper-2: #f4eee1;
  --card: #ffffff;
  --line: #ece4d4;
  --line-strong: #ddd2bc;

  /* ink / brand */
  --ink: #1b3a2f;
  --ink-2: #46544c;
  --ink-3: #7d8a82;
  --brand: #1b4332;
  --brand-soft: #e7efe9;

  /* action */
  --clay: #c2410c;
  --clay-press: #9a3208;
  --clay-soft: #fbeadf;

  /* money semantics */
  --pos: #2d6a4f;       /* paid / income */
  --pos-soft: #e3f0e8;
  --neg: #b3261e;       /* unpaid / overdue / expense */
  --neg-soft: #fbe6e3;
  --warn: #b0790f;      /* upcoming / attention */
  --warn-soft: #f8eed6;
  --deposit: #3f5e6c;   /* deposit / liability (kept distinct from income) */
  --deposit-soft: #e6eef1;

  /* type */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* shape */
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgba(27, 58, 47, 0.04), 0 8px 24px -12px rgba(27, 58, 47, 0.18);
  --shadow-lg: 0 12px 40px -12px rgba(27, 58, 47, 0.28);

  --maxw: 480px;
  --nav-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* faint warm grain + soft top glow */
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(64, 145, 108, 0.10), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  min-height: 100dvh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul { list-style: none; }
a { color: inherit; }

/* default inline-icon size (specific components override below) */
svg { width: 20px; height: 20px; flex: none; }
.fab svg { width: 26px; height: 26px; }
.iconbtn svg { width: 20px; height: 20px; }
.row .av svg { width: 20px; height: 20px; }
.toast svg { width: 18px; height: 18px; }
.btn svg { width: 19px; height: 19px; }

/* ---- App frame (phone-like column) ---- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  position: relative;
}
@media (min-width: 520px) {
  body { padding: 24px 0; }
  .app {
    min-height: calc(100dvh - 48px);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
    border-radius: 28px;
    border: 1px solid var(--line);
    overflow: clip;
  }
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 12px;
  background: linear-gradient(var(--paper) 70%, rgba(251, 248, 241, 0));
  backdrop-filter: saturate(1.1);
}
.topbar .brand { font-family: var(--display); font-weight: 600; font-size: 1.45rem; color: var(--brand); letter-spacing: -0.01em; }
.topbar .brand .dot { color: var(--clay); }
.topbar .spacer { flex: 1; }
.topbar .greeting { font-size: .82rem; color: var(--ink-3); }
.topbar .greeting strong { color: var(--ink); font-weight: 600; }

/* subscription banner (trial / grace / expired) */
.subbanner {
  display: block; width: 100%; text-align: center; cursor: pointer; border: none;
  padding: 9px 16px; font-size: .82rem; font-weight: 600; line-height: 1.35;
}
.subbanner.trial { background: var(--brand-soft); color: var(--brand); }
.subbanner.grace { background: var(--warn-soft); color: #7a5407; }
.subbanner.expired { background: var(--neg-soft); color: var(--neg); }
.subbanner b { font-weight: 800; text-decoration: underline; }

.iconbtn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line);
  transition: transform .12s ease, background .15s ease;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn.avatar {
  background: var(--brand); border-color: var(--brand); color: #fff;
  font-family: var(--display); font-weight: 600; font-size: .92rem; letter-spacing: .02em;
}

/* ---- Screen + headings ---- */
.screen { padding: 4px 18px 24px; }
.screen-title { font-family: var(--display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.screen-sub { color: var(--ink-3); font-size: .9rem; margin-top: 2px; }
.section-label { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 22px 2px 10px; }

/* staggered entrance */
.screen > * { animation: rise .42s cubic-bezier(.2,.7,.2,1) backwards; }
.screen > *:nth-child(1){animation-delay:.02s} .screen > *:nth-child(2){animation-delay:.06s}
.screen > *:nth-child(3){animation-delay:.10s} .screen > *:nth-child(4){animation-delay:.14s}
.screen > *:nth-child(5){animation-delay:.18s} .screen > *:nth-child(6){animation-delay:.22s}
.screen > *:nth-child(n+7){animation-delay:.26s}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen > * { animation: none; } }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 1rem; font-weight: 700; }

/* hero balance card */
.hero {
  background:
    radial-gradient(120% 120% at 100% 0%, #245a43 0%, var(--brand) 55%, #14352a 100%);
  color: #f4f1e8; border: none; border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
}
.hero .label { font-size: .78rem; opacity: .8; letter-spacing: .02em; }
.hero .amount { font-family: var(--display); font-size: 2.1rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero .meta { display: flex; gap: 18px; margin-top: 14px; }
.hero .meta div { font-size: .78rem; opacity: .9; }
.hero .meta b { display: block; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Stat tiles ---- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 12px; text-align: center; box-shadow: var(--shadow);
}
.stat .num { font-family: var(--display); font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.stat .cap { font-size: .72rem; color: var(--ink-3); margin-top: 6px; }
.stat.pos .num { color: var(--pos); } .stat.neg .num { color: var(--neg); }

/* ---- Numbers ---- */
.num, .amount, .ledger td:last-child, .money { font-variant-numeric: tabular-nums; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 13px; font-weight: 700; font-size: .95rem;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--clay); color: #fff; box-shadow: 0 8px 18px -8px rgba(194,65,12,.6); }
.btn-primary:active { background: var(--clay-press); }
.btn-success { background: var(--pos); color: #fff; box-shadow: 0 8px 18px -8px rgba(45,106,79,.6); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-quiet { background: var(--paper-2); color: var(--ink-2); height: 40px; padding: 0 14px; border-radius: 11px; font-size: .85rem; }
.btn-sm { height: 38px; padding: 0 14px; font-size: .85rem; border-radius: 11px; }
.btn-danger-ghost { background: var(--neg-soft); color: var(--neg); }
.btn-google {
  background: #fff; color: #1f1f1f; border: 1px solid var(--line-strong);
  box-shadow: 0 2px 8px -4px rgba(0,0,0,.18); font-weight: 600;
}
.btn-google:active { background: #f6f6f6; }
.btn-google svg { flex-shrink: 0; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.paid { background: var(--pos-soft); color: var(--pos); }
.badge.unpaid { background: var(--warn-soft); color: var(--warn); }
.badge.overdue { background: var(--neg-soft); color: var(--neg); }
.badge.upcoming { background: var(--brand-soft); color: var(--brand); }
.badge.deposit { background: var(--deposit-soft); color: var(--deposit); }
.badge.empty { background: var(--paper-2); color: var(--ink-3); }
.badge.muted { background: var(--paper-2); color: var(--ink-3); }
.badge.na { background: #efe9dc; color: #9a8f78; }
.badge.plain::before { display: none; }

/* ---- Rows / list items ---- */
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); transition: transform .12s ease, border-color .15s ease;
}
button.row:active { transform: scale(.99); border-color: var(--line-strong); }
.row + .row { margin-top: 9px; }
.row .av {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-family: var(--display);
  background: var(--brand-soft); color: var(--brand); font-size: 1rem;
}
.row .av.clay { background: var(--clay-soft); color: var(--clay); }
.row .av.slate { background: var(--deposit-soft); color: var(--deposit); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .desc { font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.amt.pos { color: var(--pos); } .amt.neg { color: var(--neg); } .amt.dep { color: var(--deposit); }
.chev { color: var(--ink-3); flex: none; }

/* ---- Periode nav (Laporan filter): ‹ Mei 2026 ›  +  picker sheet ---- */
.periode-nav {
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.periode-step {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line);
  transition: background .12s ease, border-color .12s ease;
}
.periode-step:active { transform: scale(.94); }
.periode-step svg { width: 18px; height: 18px; }
.periode-label {
  flex: 1; max-width: 280px; height: 42px; padding: 0 18px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  font-family: var(--display); font-weight: 600; font-size: 1.05rem; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.periode-label:active { background: var(--paper-2); }
.periode-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px;
}
.periode-chip {
  padding: 14px 10px; border-radius: 11px; background: var(--paper-2);
  font-size: .9rem; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); text-align: center;
}
.periode-chip.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

/* ---- Segmented control / chips ---- */
.segmented { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented button { padding: 7px 14px; border-radius: 9px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; flex: none;
}
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- Alert / callout ---- */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px; border-radius: var(--r); font-size: .87rem;
  background: var(--neg-soft); color: #7c2018; border: 1px solid #f3cfca;
}
.alert.note { background: var(--deposit-soft); color: #2c4651; border-color: #cfdde3; }
.alert.warn { background: var(--warn-soft); color: #7a5407; border-color: #ecd9ab; }
.alert .ico { flex: none; margin-top: 1px; }
.alert b { font-weight: 700; }

/* ---- Empty state ---- */
.empty { text-align: center; color: var(--ink-3); padding: 34px 16px; }
.empty .big { font-size: 2rem; }
.empty p { margin-top: 8px; font-size: .9rem; }

/* ---- Ledger (cash report) ---- */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger tr { border-bottom: 1px dashed var(--line); }
.ledger td { padding: 9px 0; font-size: .9rem; vertical-align: top; }
.ledger td:last-child { text-align: right; font-weight: 600; white-space: nowrap; padding-left: 12px; }
.ledger .grp td { padding-top: 16px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); border-bottom: none; }
.ledger .total td { font-weight: 800; border-top: 1.5px solid var(--line-strong); border-bottom: none; padding-top: 11px; }
.ledger .net td { font-family: var(--display); font-size: 1.05rem; font-weight: 600; }
.ledger td .muted { color: var(--ink-3); font-weight: 400; font-size: .78rem; }
.ledger .neg td:last-child { color: var(--neg); }

.report-card.deposit-block { border-color: #cfdde3; background: linear-gradient(180deg, #fbfdfe, #fff); }
.deposit-block .ledger .grp td { color: var(--deposit); }
.deposit-block .ledger .total td { color: var(--deposit); }

.kpi-row { display: flex; gap: 10px; }
.kpi { flex: 1; background: var(--paper-2); border-radius: var(--r-sm); padding: 12px; text-align: center; }
.kpi .v { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
.kpi .k { font-size: .72rem; color: var(--ink-3); margin-top: 2px; }

/* progress bar */
.bar { height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--pos); border-radius: 999px; }

/* ---- Bottom nav ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); font-size: .68rem; font-weight: 600; transition: color .15s ease;
}
.bottomnav button svg { width: 23px; height: 23px; transition: transform .18s ease; }
.bottomnav button.active { color: var(--brand); }
.bottomnav button.active svg { transform: translateY(-2px); }
.bottomnav button.active span { position: relative; }

/* ---- FAB ---- */
.fab {
  position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  left: 50%; transform: translateX(calc(var(--maxw)/2 - 50% - 18px));
  z-index: 41; width: 54px; height: 54px; border-radius: 18px;
  background: var(--clay); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 24px -8px rgba(194,65,12,.7);
  transition: transform .14s ease;
}
.fab:active { transform: translateX(calc(var(--maxw)/2 - 50% - 18px)) scale(.92); }
@media (max-width: 519px) { .fab { transform: none; right: 18px; left: auto; } .fab:active { transform: scale(.92); } }

/* ---- Bottom sheet / modal ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 30, 25, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease; backdrop-filter: blur(2px);
}
.sheet-backdrop.closing { animation: fade .2s ease reverse forwards; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: var(--maxw); background: var(--paper);
  border-radius: 26px 26px 0 0; padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: slideup .32s cubic-bezier(.2,.8,.2,1);
}
.sheet-backdrop.closing .sheet { animation: slideup .26s ease reverse forwards; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet .handle { width: 42px; height: 5px; border-radius: 999px; background: var(--line-strong); margin: 6px auto 14px; }
.sheet h2 { font-family: var(--display); font-size: 1.35rem; font-weight: 600; }
.sheet .sub { color: var(--ink-3); font-size: .85rem; margin-top: 2px; margin-bottom: 6px; }

/* ---- Forms ---- */
.field { margin-top: 14px; }
.field > label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--card); border: 1.5px solid var(--line-strong); transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; padding: 12px 14px; min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
}
.field .hint { font-size: .76rem; color: var(--ink-3); margin-top: 5px; }
.field-row { display: flex; gap: 12px; } .field-row > * { flex: 1; }

/* toggle add-on rows */
.toggle-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 10px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
}
.toggle-row .grow { flex: 1; }
.toggle-row .t-name { font-weight: 600; font-size: .92rem; }
.toggle-row .t-price { font-size: .8rem; color: var(--ink-3); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background .18s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--pos); }
.switch input:checked + .track::after { transform: translateX(18px); }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }

/* detail rows */
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-3); } .kv .v { font-weight: 600; text-align: right; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 28px); transform: translateX(-50%);
  z-index: 80; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px;
  font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastin .3s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toastout .3s ease forwards; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastout { to { opacity: 0; transform: translate(-50%, 14px); } }

/* auth screen */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 26px; max-width: var(--maxw); margin: 0 auto; }
.auth .logo { font-family: var(--display); font-size: 2.6rem; font-weight: 600; color: var(--brand); letter-spacing: -0.02em; }
.auth .logo .dot { color: var(--clay); }
.auth .tag { color: var(--ink-2); margin-top: 6px; margin-bottom: 26px; font-size: .98rem; }
.auth .card { padding: 20px; }
.auth .switch-link { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--ink-3); }
.auth .switch-link button { color: var(--clay); font-weight: 700; }
.demo-hint { margin-top: 14px; font-size: .8rem; color: var(--ink-3); text-align: center; }

.mt { margin-top: 14px; } .mt-s { margin-top: 8px; } .muted-text { color: var(--ink-3); }
.center { text-align: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Admin Panel accent (distinct from Owner App green) ---- */
.admin-theme .brand { color: var(--deposit); }
.admin-theme .bottomnav button.active { color: var(--deposit); }
.admin-theme .bottomnav button.active svg { transform: translateY(-2px); }
.admintag { font-family: var(--sans); font-size: .58rem; font-weight: 800; letter-spacing: .12em; color: #fff; background: var(--deposit); padding: 3px 6px; border-radius: 6px; vertical-align: middle; margin-left: 6px; }
.hero.admin { background: radial-gradient(120% 120% at 100% 0%, #4d6f7e 0%, var(--deposit) 55%, #2a4350 100%); }
.auth .logo .admintag { font-size: .7rem; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: none; }
.table td.r, .table th.r { text-align: right; }

/* ============================================================================
   Responsive — 3 tiers: smartphone (default), tablet, desktop
   ============================================================================ */

/* Card-list wrapper: 1 column by default, multi-column on wide screens. */
.cards { display: grid; gap: 9px; }
.cards .row + .row { margin-top: 0; }

/* ---- Tablet: wider column, bottom nav stays ---- */
@media (min-width: 700px) and (max-width: 1023px) {
  :root { --maxw: 660px; }
  .screen { padding: 8px 24px 28px; }
  .stat-grid { gap: 14px; }
}

/* ---- Desktop: left sidebar nav + wide content ---- */
@media (min-width: 1024px) {
  body { padding: 0; background-attachment: fixed; }
  .app {
    max-width: 1280px; width: 100%; margin: 0 auto; min-height: 100dvh;
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "side top" "side main";
    background: transparent; border: none; border-radius: 0; box-shadow: none;
    overflow: visible; padding-bottom: 0;
  }

  .topbar {
    grid-area: top; position: sticky; top: 0; z-index: 30;
    padding: 18px 40px; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
  }
  .topbar .brand { display: none; }

  .content { grid-area: main; min-width: 0; }
  #view { width: 100%; }
  .screen { max-width: 1020px; margin: 0 auto; padding: 24px 40px 60px; }
  .screen-title { font-size: 1.9rem; }
  /* Full-width block buttons inside the main content area look oversized on desktop;
     cap them so primary CTAs (Catat Pengeluaran, etc.) sit at a comfortable size. */
  .screen .btn-block { max-width: 320px; margin-left: auto; margin-right: auto; }

  /* sidebar (reuse .bottomnav DOM) */
  .bottomnav {
    grid-area: side; position: sticky; top: 0; left: auto; transform: none;
    width: 256px; max-width: none; height: 100dvh;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 22px 14px; border-top: none; border-right: 1px solid var(--line);
    background: var(--card); backdrop-filter: none;
  }
  .bottomnav::before {
    content: "Rukos"; font-family: var(--display); font-weight: 600; font-size: 1.55rem;
    color: var(--brand); padding: 4px 14px 22px; letter-spacing: -0.01em;
  }
  .admin-theme .bottomnav::before { content: "Rukos · Admin"; color: var(--deposit); font-size: 1.3rem; }
  .bottomnav button {
    flex-direction: row; justify-content: flex-start; gap: 13px;
    padding: 12px 14px; border-radius: 12px; font-size: .96rem; font-weight: 600;
  }
  .bottomnav button svg { width: 21px; height: 21px; }
  .bottomnav button.active { background: var(--brand-soft); }
  .admin-theme .bottomnav button.active { background: var(--deposit-soft); }
  .bottomnav button.active svg { transform: none; }

  /* multi-column card lists. minmax(0, 1fr) — NOT plain 1fr — so columns can shrink
     below their content's natural min-width; rows then truncate titles via the existing
     ellipsis. Plain 1fr lets rows force the grid wider than its container (overflow). */
  .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

  /* FAB anchored to viewport corner */
  .fab, .fab:active { position: fixed; right: 36px; bottom: 36px; left: auto; transform: none; }
  .fab:active { transform: scale(.92); }

  /* bottom sheets become centered modals */
  .sheet-backdrop { align-items: center; }
  .sheet { max-width: 540px; border-radius: 22px; max-height: 86dvh; }
  .sheet .handle { display: none; }
}

/* Wider desktop: 3-column card lists for dense views.
   Deferred to 1700px so that the 1440-1600px range (very common 15" laptops) gets a
   generous 2-column layout with breathing room rather than cramped 3-column rows. */
@media (min-width: 1700px) {
  .app { max-width: 1480px; }
  .screen { max-width: 1180px; }
  .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
}
