/* ==========================================================================
   Kas DKM Al-Fatih — desain minimalis modern
   ========================================================================== */
:root {
  --bg: #f3f5f3;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #eef2ef;
  --line: #e4e9e6;
  --line-2: #d4dcd7;
  --text: #111a16;
  --text-2: #43504a;
  --muted: #7a8680;
  --primary: #0e7a52;
  --primary-2: #0b6544;
  --primary-soft: #e3f3ea;
  --on-primary: #ffffff;
  --in: #0e8a5a;
  --in-soft: #e2f5eb;
  --out: #d1453b;
  --out-soft: #fceae8;
  --gold: #b8860b;
  --gold-soft: #fbf3dc;
  --warn: #a86b12;
  --warn-soft: #fdf2df;
  --hero-1: #0b5e40;
  --hero-2: #0e7a52;
  --hero-3: #149463;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(17, 26, 22, .04), 0 2px 10px rgba(17, 26, 22, .04);
  --shadow-md: 0 8px 28px -10px rgba(17, 26, 22, .16);
  --shadow-lg: 0 30px 70px -20px rgba(17, 26, 22, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f0d; --surface: #111815; --surface-2: #151e1a; --surface-3: #1b2621; --line: #212c27; --line-2: #2c3933;
    --text: #e7eeea; --text-2: #b3c0b9; --muted: #7d8a84;
    --primary: #2ebf84; --primary-2: #26a571; --primary-soft: #12271e; --on-primary: #04120b;
    --in: #39cc8c; --in-soft: #11271d; --out: #ff6d62; --out-soft: #2c1513; --gold: #e2b43e; --gold-soft: #2a2312;
    --warn: #e7a23c; --warn-soft: #2a1f0f;
    --hero-1: #08402c; --hero-2: #0b5e40; --hero-3: #0f7450;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .6); --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f0d; --surface: #111815; --surface-2: #151e1a; --surface-3: #1b2621; --line: #212c27; --line-2: #2c3933;
  --text: #e7eeea; --text-2: #b3c0b9; --muted: #7d8a84;
  --primary: #2ebf84; --primary-2: #26a571; --primary-soft: #12271e; --on-primary: #04120b;
  --in: #39cc8c; --in-soft: #11271d; --out: #ff6d62; --out-soft: #2c1513; --gold: #e2b43e; --gold-soft: #2a2312;
  --warn: #e7a23c; --warn-soft: #2a1f0f;
  --hero-1: #08402c; --hero-2: #0b5e40; --hero-3: #0f7450;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .6); --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 700; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.25; }
p { margin: 0; }
small { font-size: 12.5px; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
::selection { background: var(--primary-soft); color: var(--primary); }

.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.ic-xs { width: 12px; height: 12px; }
.ic-xl { width: 40px; height: 40px; stroke-width: 1.5; }
.logo { width: 100%; height: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 24px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.in { color: var(--in); }
.out { color: var(--out); }
.spacer { flex: 1; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: block; }
  :root:not([data-theme="light"]) .only-light { display: none; }
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  padding: 22px 16px 16px; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; padding: 9px; flex: none;
  background: linear-gradient(145deg, var(--hero-2), var(--hero-1)); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(14, 122, 82, .6);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14.5px; position: relative;
  transition: background .2s, color .2s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link.active::before {
  content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.side-user {
  display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
}
.side-user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-user-info b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { color: var(--muted); }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 26px 36px 8px; max-width: 1240px; width: 100%;
}
.topbar-brand { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 26px; font-weight: 800; }
.topbar-title p { color: var(--muted); margin-top: 2px; font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.back-link:hover { color: var(--primary); }
.main { padding: 16px 36px 40px; max-width: 1240px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.foot { padding: 12px 36px 28px; color: var(--muted); font-size: 12.5px; max-width: 1240px; }
.foot a { color: var(--primary); font-weight: 600; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; border: 0; cursor: pointer;
}
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.role-admin { background: var(--gold-soft); color: var(--gold); }
.avatar.role-viewer { background: var(--surface-3); color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 18px -8px var(--primary); }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--out); }
.btn-danger:hover { background: var(--out-soft); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-icon {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; flex: none; transition: background .2s, color .2s, transform .15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon:active { transform: scale(.92); }
.btn-icon.danger:hover { background: var(--out-soft); color: var(--out); }
.link { display: inline-flex; align-items: center; gap: 2px; color: var(--primary); font-weight: 650; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head.wrap { flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.card-head.mt { margin-top: 22px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2.gap-lg { gap: 18px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px 30px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, var(--hero-3) 0%, var(--hero-2) 40%, var(--hero-1) 100%);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; box-shadow: var(--shadow-md);
}
.hero-pattern { position: absolute; right: -40px; top: -50px; width: 280px; height: 280px; opacity: .09; transform: rotate(-8deg); pointer-events: none; }
.hero-pattern .logo { color: #fff; }
.hero-body { position: relative; }
.hero-greet { font-weight: 600; opacity: .85; margin-bottom: 14px; font-size: 14px; }
.hero-label { display: flex; align-items: center; gap: 6px; opacity: .8; font-size: 13.5px; font-weight: 600; }
.hero-value { font-size: clamp(32px, 5vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.hero-sub { opacity: .75; font-size: 13px; }
.hero-spark { position: relative; width: 260px; max-width: 40%; color: #b9f3d5; text-align: right; }
.hero-spark small { opacity: .7; font-size: 11.5px; }
.spark { width: 100%; height: 70px; overflow: visible; }
.spark polyline { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1.6s .3s var(--ease) forwards; }
.spark polygon { opacity: 0; animation: fade .8s 1s forwards; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.stat-ic .ic { width: 18px; height: 18px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-foot { font-size: 12.5px; color: var(--muted); }
.tone-in .stat-ic { background: var(--in-soft); color: var(--in); }
.tone-out .stat-ic { background: var(--out-soft); color: var(--out); }
.tone-gold .stat-ic { background: var(--gold-soft); color: var(--gold); }
.tone-primary { background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); }
.tone-primary .stat-ic { background: var(--primary); color: var(--on-primary); }
.delta { font-weight: 700; }
.delta.good { color: var(--in); }
.delta.bad { color: var(--out); }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px dashed var(--line-2);
  background: transparent; cursor: pointer; font-weight: 650; font-size: 14px; text-align: left; transition: all .2s var(--ease);
}
.quick-btn:hover { border-style: solid; border-color: var(--primary); background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qi { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.qi.in { background: var(--in-soft); color: var(--in); }
.qi.out { background: var(--out-soft); color: var(--out); }
.qi.gold { background: var(--gold-soft); color: var(--gold); }

/* ---------- Bar chart ---------- */
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.dot.in { background: var(--in); }
.dot.out { background: var(--out); }
.bars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; height: 220px; align-items: end; padding-top: 10px; }
.bar-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; outline: none; }
.bar-col small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.bar-col.now small { color: var(--primary); font-weight: 800; }
.bar-pair { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-end; gap: 3px; border-radius: 8px; padding: 0 2px; transition: background .2s; }
.bar-col:hover .bar-pair, .bar-col:focus .bar-pair { background: var(--surface-2); }
.bar { width: min(14px, 42%); height: var(--h); min-height: 3px; border-radius: 5px 5px 2px 2px; transform-origin: bottom; animation: grow .9s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms + 150ms); }
.bar.in { background: linear-gradient(to top, var(--in), color-mix(in srgb, var(--in) 70%, #fff)); }
.bar.out { background: linear-gradient(to top, var(--out), color-mix(in srgb, var(--out) 70%, #fff)); }
.tip {
  position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translate(-50%, 6px); opacity: 0; pointer-events: none; z-index: 5;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 12px; white-space: nowrap;
  display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-lg); transition: opacity .18s, transform .18s var(--ease);
}
.tip span { display: flex; align-items: center; gap: 6px; }
.tip .tip-saldo { opacity: .7; margin-top: 2px; }
.bar-col:hover .tip, .bar-col:focus .tip { opacity: 1; transform: translate(-50%, 0); }
.bar-col:nth-child(-n+3) .tip { left: 0; transform: translate(0, 6px); }
.bar-col:nth-last-child(-n+3) .tip { left: auto; right: 0; transform: translate(0, 6px); }
.bar-col:nth-child(-n+3):hover .tip, .bar-col:nth-child(-n+3):focus .tip,
.bar-col:nth-last-child(-n+3):hover .tip, .bar-col:nth-last-child(-n+3):focus .tip { transform: none; }
.main-wrap { overflow-x: clip; }

/* ---------- Category bars ---------- */
.catbars { display: flex; flex-direction: column; gap: 14px; }
.catbar { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms + 200ms); }
.catbar-top { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.catbar-top span { color: var(--text-2); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catbar-top small { color: var(--muted); font-weight: 500; }
.catbar-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.catbar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.catbar-track span { display: block; height: 100%; width: var(--w); border-radius: 99px; transform-origin: left; animation: growx 1s var(--ease) both; animation-delay: calc(var(--i) * 60ms + 300ms); }
.catbar-track .in { background: var(--in); }
.catbar-track .out { background: var(--out); }
.catbar-pct { color: var(--muted); font-weight: 700; width: 36px; text-align: right; }

/* ---------- Transactions ---------- */
.trx-list { display: flex; flex-direction: column; }
.trx {
  display: flex; align-items: center; gap: 12px; padding: 11px 10px; margin: 0 -10px; border-radius: 14px;
  transition: background .18s; text-align: left; width: calc(100% + 20px);
}
.trx + .trx { border-top: 1px solid var(--line); }
.trx.is-edit { cursor: pointer; }
.trx.is-edit:hover { background: var(--surface-2); }
.trx.is-edit:hover + .trx, .trx.is-edit:hover { border-color: transparent; }
.trx-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.trx-ic .ic { width: 18px; height: 18px; }
.trx-ic.in { background: var(--in-soft); color: var(--in); }
.trx-ic.out { background: var(--out-soft); color: var(--out); }
.trx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trx-main b { font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trx-main small { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trx-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
a.trx-badge:hover { background: var(--primary-soft); color: var(--primary); }
.trx-amt { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14.5px; }
.trx-extra, .cell-extra { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; min-width: 0; }
.cell-extra { margin-top: 3px; }
.trx-note { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12.5px; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trx-note .ic { color: var(--muted); flex: none; }
.badge-txt { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-txt.warn { background: var(--warn-soft); color: var(--warn); }
.badge-txt.ok { background: var(--in-soft); color: var(--in); }

/* Talangan */
.talangan { border-top: 1px solid var(--line); margin-bottom: 4px; }
.talangan .switch-row { padding: 12px 0; }
.talangan-detail { animation: rise .3s var(--ease); }
.seg-tal { display: grid; width: 100%; }
.seg-tal span { padding: 0 8px; }
.seg-tal input[value="belum"]:checked + span { color: var(--warn); }
.seg-tal input[value="sudah"]:checked + span { color: var(--in); }
.hero-tal { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: 12.5px; font-weight: 600; }
.tal-card { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: linear-gradient(160deg, var(--warn-soft), var(--surface) 55%); }
.tal-ic { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--warn-soft); color: var(--warn); }
.tal-total { font-size: 20px; color: var(--warn); font-variant-numeric: tabular-nums; }
.tal-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.tag-lg { display: inline-flex; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.tal-list { display: flex; flex-direction: column; }
.tal-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line-2); }
.tal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tal-main b { font-weight: 650; }
.tal-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tal-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) {
  .tal-item { flex-wrap: wrap; }
  .tal-item form { width: 100%; }
  .tal-item .btn { width: 100%; }
}

.day + .day { margin-top: 18px; }
.day-head {
  display: flex; justify-content: space-between; align-items: center; padding: 0 0 6px; margin-bottom: 2px; font-size: 12.5px;
  font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line);
}
.day-tot { display: flex; gap: 10px; text-transform: none; letter-spacing: 0; }
.day-tot em { font-style: normal; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-end { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; width: 200px; }
.month-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 3px; box-shadow: var(--shadow); }
.mp { position: relative; }
.mp summary, .mp-static {
  list-style: none; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px;
  font-weight: 700; font-size: 14px; cursor: pointer; user-select: none; white-space: nowrap;
}
.mp summary::-webkit-details-marker { display: none; }
.mp summary:hover { background: var(--surface-2); }
.mp summary .ic:first-child, .mp-static .ic { color: var(--primary); width: 17px; height: 17px; }
.mp[open] summary .ic-sm { transform: rotate(180deg); }
.mp-panel {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 30; width: 260px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .22s var(--spring);
}
.mp-year { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mp-grid a { text-align: center; padding: 9px 0; border-radius: 10px; font-weight: 600; font-size: 13.5px; }
.mp-grid a:hover { background: var(--surface-2); }
.mp-grid a.now { color: var(--primary); }
.mp-grid a.on { background: var(--primary); color: var(--on-primary); }
.mp-today { display: block; text-align: center; margin-top: 8px; padding: 8px; font-size: 13px; font-weight: 700; color: var(--primary); border-radius: 10px; }
.mp-today:hover { background: var(--primary-soft); }
.tabs { display: inline-flex; background: var(--surface-3); border-radius: 13px; padding: 3px; }
.tabs a { padding: 7px 16px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); transition: all .2s; }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.sumbar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.sumbar > div { padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.sumbar > div + div { border-left: 1px solid var(--line); }
.sumbar small { color: var(--muted); font-weight: 600; }
.sumbar b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sumbar .strong { background: var(--primary-soft); }
.sumbar .strong b { color: var(--primary); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 650; color: var(--text-2); }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s; min-width: 0;
}
textarea.input { height: auto; padding: 11px 14px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8680' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:hover { border-color: var(--muted); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.input-sm { height: 36px; font-size: 13.5px; border-radius: 10px; padding: 0 12px; }
select.input-sm { padding-right: 32px; max-width: 220px; }
.input-lg { height: 50px; font-size: 16px; }
.input-plain { border-color: transparent; background: transparent; height: 38px; padding: 0 8px; font-weight: 600; }
.input-plain:hover { border-color: var(--line-2); }
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .btn-icon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 10px; margin-top: 4px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 180px; }
.copy-field { display: flex; gap: 8px; margin-top: 6px; }
.copy-field .input { color: var(--text-2); font-size: 13.5px; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-3); border-radius: 14px; padding: 4px; gap: 2px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); transition: all .22s var(--ease); white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg-sm span { height: 30px; font-size: 13px; padding: 0 12px; }
.seg-type { display: grid; width: 100%; margin-bottom: 18px; }
.seg-type input[value="masuk"]:checked + span { color: var(--in); }
.seg-type input[value="keluar"]:checked + span { color: var(--out); }

.switch-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row > span { display: flex; flex-direction: column; }
.switch-row small { color: var(--muted); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background .25s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .3s var(--spring); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.file-drop { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; transition: all .2s; }
.file-drop:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop.has { border-style: solid; border-color: var(--primary); color: var(--primary); }
.file-current { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13.5px; }
.file-current a { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 650; }

/* Kalender kustom */
.dp { position: relative; min-width: 0; }
.dp-btn { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; font-weight: 600; }
.dp-btn span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-btn .ic { color: var(--primary); width: 18px; height: 18px; }
.dp-btn .ic-sm { color: var(--muted); width: 16px; height: 16px; transition: transform .2s; }
.dp-btn.empty span { color: var(--muted); font-weight: 500; }
.dp-btn.open { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.dp-btn.open .ic-sm { transform: rotate(180deg); }
.dp-pop {
  position: fixed; z-index: 300; padding: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); animation: dpIn .22s var(--spring);
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-title { border: 0; background: none; font: inherit; font-weight: 700; font-size: 15px; padding: 6px 12px; border-radius: 10px; cursor: pointer; color: var(--text); }
.dp-title:hover { background: var(--surface-3); }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.dp-dow span.fri { color: var(--primary); }
.dp-day {
  aspect-ratio: 1; border: 0; background: none; border-radius: 11px; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; color: var(--text); display: grid; place-items: center; transition: background .15s, transform .12s;
}
.dp-day:hover { background: var(--surface-3); }
.dp-day:active { transform: scale(.9); }
.dp-day:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.dp-day.fri { color: var(--primary); }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.dp-day.sel { background: var(--primary); color: var(--on-primary); }
.dp-day:disabled { opacity: .28; cursor: not-allowed; background: none; transform: none; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dp-months .dp-day { aspect-ratio: auto; height: 44px; }
.dp-quick { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dp-quick button { flex: 1; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; color: var(--text-2); }
.dp-quick button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
@keyframes dpIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; animation: shake .4s; }
.alert-error { background: var(--out-soft); color: var(--out); }
.alert-success { background: var(--in-soft); color: var(--in); animation: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge-in { background: var(--in-soft); color: var(--in); }
.badge-lock { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }

/* ---------- Modal / sheet ---------- */
dialog { border: 0; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(8, 14, 11, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog[open]::backdrop { animation: fade .25s ease; }
dialog.closing::backdrop { animation: fade .2s ease reverse forwards; }
.modal { width: min(520px, calc(100vw - 32px)); margin: auto; overflow: visible; }
.modal[open] .modal-card { animation: modalIn .35s var(--spring); }
.modal.closing .modal-card { animation: modalOut .2s ease forwards; }
.modal-card { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 12px 20px 6px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }

.trx-form { --accent: var(--in); --accent-soft: var(--in-soft); }
.trx-form.is-out { --accent: var(--out); --accent-soft: var(--out-soft); }
.trx-form .btn-primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 18px -8px var(--accent); }
.amount-field { display: flex; align-items: baseline; gap: 8px; padding: 14px 18px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); transition: background .3s, color .3s; cursor: text; }
.amount-cur { font-size: 20px; font-weight: 700; opacity: .8; }
.amount-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.amount-field input::placeholder { color: inherit; opacity: .35; }
.amount-words { min-height: 18px; margin: 6px 4px 14px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.amount-field.locked { opacity: .65; }
.more { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.more summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 650; font-size: 14px; color: var(--text-2); padding: 4px 0 10px; }
.more summary::-webkit-details-marker { display: none; }
.more summary small { color: var(--muted); font-weight: 500; }
.more[open] summary { color: var(--primary); }

.sheet { width: 100%; max-width: 520px; margin: auto auto 0; }
.sheet[open] .sheet-card { animation: sheetIn .4s var(--spring); }
.sheet.closing .sheet-card { animation: sheetOut .22s ease forwards; }
.sheet-card { background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 0 auto 16px; }
.menu-user { display: flex; align-items: center; gap: 12px; padding: 0 4px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.menu-user div { display: flex; flex-direction: column; }
.menu-user small { color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.menu-grid a, .menu-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: 16px; background: var(--surface-2); border: 0; cursor: pointer; font-size: 12px; font-weight: 650; color: var(--text-2); text-align: center; }
.menu-grid a:active, .menu-grid button:active { transform: scale(.95); }
.menu-grid .ic { width: 22px; height: 22px; color: var(--primary); }
.menu-grid .danger .ic, .menu-grid .danger { color: var(--out); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border-radius: 16px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toastIn .5s var(--spring); }
.toast .ic { width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--in); color: #fff; stroke-width: 3; }
.toast-error .ic { background: var(--out); }
.toast.hide { animation: toastOut .3s ease forwards; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav { display: none; }
.show-sm { display: none !important; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th.c, .table td.c { text-align: center; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-edit { cursor: pointer; }
.table tfoot td { font-weight: 800; border-bottom: 0; background: var(--primary-soft); color: var(--primary); }
.table tfoot td:first-child { border-radius: 12px 0 0 12px; }
.table tfoot td:last-child { border-radius: 0 12px 12px 0; }
.table .actions { display: flex; gap: 2px; justify-content: flex-end; }
.table .actions form { display: contents; }
.report td.num { font-weight: 600; }
.report { min-width: 680px; }
.report td:nth-child(2) { white-space: nowrap; }
.report tr.pre td { color: var(--muted); }
.report .row-opening td { background: var(--surface-2); }

/* ---------- Summary list ---------- */
.summary { margin: 0; display: flex; flex-direction: column; }
.summary > div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.summary dt { color: var(--muted); font-weight: 600; font-size: 14px; }
.summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary .total { border-bottom: 0; padding-top: 14px; }
.summary .total dt { color: var(--text); font-weight: 750; }
.summary .total dd { font-size: 20px; font-weight: 800; color: var(--primary); }
.mini-note { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.mini-note > .ic { color: var(--gold); }
.mini-note div { display: flex; flex-direction: column; }
.mini-note small { color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty .ic-xl { color: var(--line-2); margin-bottom: 6px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 360px; font-size: 14px; margin-bottom: 8px; }

/* ---------- Kencleng ---------- */
.kc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.kc-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 20px; }
.denom { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); transition: background .2s; }
.card-head + .denom { border-top: 0; }
.note { display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; font-size: 13px; letter-spacing: -.01em; position: relative; overflow: hidden; transition: transform .3s var(--spring); }
.note.bill { width: 66px; height: 38px; border-radius: 8px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 65%, #000)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); }
.note.bill::after { content: ""; position: absolute; right: -10px; top: -10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.note.coin { width: 42px; height: 42px; margin: 0 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 70%, #000)); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25); font-size: 11.5px; }
.denom.has .note { transform: scale(1.06) rotate(-3deg); }
.denom-info { display: flex; flex-direction: column; min-width: 0; }
.denom-info b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.denom-info .sub { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; transition: color .2s; }
.denom.has .sub { color: var(--in); }
.denom.bump .sub { animation: bump .35s var(--spring); }
.stepper { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 3px; }
.stepper button { width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); transition: background .15s, transform .12s; }
.stepper button:hover { background: var(--surface); }
.stepper button:active { transform: scale(.88); background: var(--primary-soft); color: var(--primary); }
.stepper button .ic { width: 18px; height: 18px; }
.stepper input { width: 58px; height: 38px; text-align: center; border: 0; background: transparent; font: inherit; font-size: 17px; font-weight: 750; color: var(--text); outline: none; font-variant-numeric: tabular-nums; border-radius: 9px; }
.stepper input:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--primary); }
.kc-total { text-align: center; padding: 26px 20px; background: radial-gradient(120% 140% at 0% 0%, var(--hero-3), var(--hero-2) 45%, var(--hero-1)); color: #fff; border: 0; }
.kc-total small { opacity: .8; font-weight: 600; }
.kc-total-value { font-size: clamp(30px, 4vw, 40px); font-weight: 800; letter-spacing: -.035em; margin: 4px 0; font-variant-numeric: tabular-nums; }
.kc-words { font-size: 13px; opacity: .8; font-style: italic; min-height: 20px; }
.kc-pills { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.kc-pills span { padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: 12.5px; font-weight: 700; }
.kc-bar { display: none; }

/* ---------- Categories ---------- */
.cat-list { display: flex; flex-direction: column; }
.cat-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.cat-item:first-child { border-top: 0; }
.cat-item.off { opacity: .5; }
.cat-rename { flex: 1; min-width: 0; }

/* ---------- Users ---------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.user-card { display: flex; align-items: center; gap: 14px; }
.user-card.off { opacity: .55; }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-info small { color: var(--text-2); }
.user-info small.muted { color: var(--muted); }
.user-actions { display: flex; }
.user-actions form { display: contents; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.roles > div { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.roles small { color: var(--muted); }
.role-pick { display: flex; flex-direction: column; gap: 8px; }
.role-pick label { cursor: pointer; }
.role-pick input { position: absolute; opacity: 0; }
.role-pick span { display: flex; flex-direction: column; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); transition: all .2s; }
.role-pick small { color: var(--muted); }
.role-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.role-pick input:checked + span b { color: var(--primary); }

/* ---------- Settings, profile ---------- */
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.sticky-save { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; z-index: 5; }
.narrow { max-width: 620px; display: flex; flex-direction: column; gap: 18px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head div { display: flex; flex-direction: column; }
.profile-head b { font-size: 18px; }
.profile-head small { color: var(--muted); }
.lock-card { display: flex; align-items: center; gap: 16px; }
.lock-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex: none; }
.lock-text { flex: 1; display: flex; flex-direction: column; }
.lock-text small { color: var(--muted); }

/* ---------- Timeline (log) ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: 0; }
.tl-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tl-item.a-add .tl-ic { background: var(--in-soft); color: var(--in); }
.tl-item.a-delete .tl-ic { background: var(--out-soft); color: var(--out); }
.tl-item.a-edit .tl-ic { background: var(--warn-soft); color: var(--warn); }
.tl-body { min-width: 0; font-size: 14px; }
.tl-body small { color: var(--text-2); display: block; word-break: break-word; }
.tl-item time { white-space: nowrap; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }

/* ---------- Login ---------- */
.login-body { background: var(--bg); }
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-art { position: relative; overflow: hidden; color: #fff; background: radial-gradient(120% 120% at 0% 0%, var(--hero-3), var(--hero-2) 40%, var(--hero-1)); display: flex; align-items: flex-end; padding: 56px; }
.login-pattern { position: absolute; inset: -60px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 50px; opacity: .06; transform: rotate(-12deg); animation: drift 40s linear infinite alternate; }
.login-pattern .logo { width: 100%; aspect-ratio: 1; height: auto; color: #fff; }
.login-art-inner { position: relative; max-width: 440px; }
.login-mark { display: block; width: 86px; height: 86px; color: #fff; margin-bottom: 28px; animation: rise .8s var(--ease) both; }
.login-art h2 { font-size: 36px; font-weight: 800; letter-spacing: -.03em; animation: rise .8s .1s var(--ease) both; }
.login-art p { opacity: .8; margin-top: 6px; animation: rise .8s .2s var(--ease) both; }
.login-art blockquote { margin: 34px 0 0; padding-left: 16px; border-left: 3px solid rgba(255, 255, 255, .4); font-size: 16px; line-height: 1.6; opacity: .9; animation: rise .8s .3s var(--ease) both; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-form { width: 100%; max-width: 380px; }
.login-form h1 { font-size: 28px; font-weight: 800; }
.login-form > p { margin: 4px 0 28px; }
.login-form .check { margin: 2px 0 22px; }
.login-mark-sm { display: none; width: 52px; height: 52px; padding: 11px; border-radius: 16px; background: linear-gradient(145deg, var(--hero-2), var(--hero-1)); color: #fff; margin-bottom: 20px; }
.login-public { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; color: var(--primary); font-weight: 650; font-size: 14px; }
.install { width: 100%; max-width: 640px; padding: 28px; }
.install h3 { font-size: 15px; margin: 22px 0 12px; }
.install-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.install-head .login-mark-sm { display: block; margin: 0; flex: none; }
.install-head h1 { font-size: 22px; font-weight: 800; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.check-item span { flex: 1; }
.check-item.ok .ic { color: var(--in); }
.check-item.bad { background: var(--out-soft); }
.check-item.bad .ic { color: var(--out); }
.check-item.warn .ic { color: var(--warn); }

/* ---------- Public page ---------- */
.public { background: var(--bg); overflow-x: clip; }
.pub-wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.pub-hero { position: relative; overflow: hidden; color: #fff; padding: 28px 0 44px; background: radial-gradient(120% 140% at 0% 0%, var(--hero-3), var(--hero-2) 40%, var(--hero-1)); }
.pub-hero .hero-pattern { width: 420px; height: 420px; right: -60px; top: -80px; }
.pub-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; position: relative; }
.pub-brand .brand-mark { background: rgba(255, 255, 255, .14); box-shadow: none; }
.pub-brand div { display: flex; flex-direction: column; }
.pub-brand small { opacity: .75; }
.pub-hero .hero-label, .pub-hero .hero-value, .pub-hero .hero-sub { position: relative; }
.pub-main { display: flex; flex-direction: column; gap: 18px; margin-top: -22px; position: relative; padding-bottom: 20px; }
.public .foot { text-align: center; margin: 0 auto; }

/* ---------- Animations ---------- */
.reveal { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.96); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.95); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes drift { from { transform: rotate(-12deg) translateY(0); } to { transform: rotate(-12deg) translateY(-80px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 50%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .kc { grid-template-columns: minmax(0, 1fr); }
  .kc-side { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: calc(14px + env(safe-area-inset-top)) 16px 4px; gap: 12px; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .topbar-brand { display: block; width: 34px; height: 34px; padding: 7px; border-radius: 11px; background: linear-gradient(145deg, var(--hero-2), var(--hero-1)); color: #fff; flex: none; }
  .topbar-title h1 { font-size: 20px; }
  .topbar-title p { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .back-link { display: none; }
  .main { padding: 10px 16px calc(100px + env(safe-area-inset-bottom)); gap: 14px; }
  .foot { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .hide-sm { display: none !important; }
  .show-sm { display: grid !important; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; z-index: 40; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom)); height: 64px; padding: 0 6px; border-radius: 22px;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  }
  .bn-link { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 6px 0; cursor: pointer; transition: color .2s; }
  .bn-link .ic { width: 22px; height: 22px; transition: transform .3s var(--spring); }
  .bn-link.active { color: var(--primary); }
  .bn-link.active .ic { transform: translateY(-2px); }
  .bn-fab { justify-self: center; width: 54px; height: 54px; border-radius: 18px; border: 0; background: linear-gradient(145deg, var(--hero-3), var(--hero-1)); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 24px -8px var(--primary); transform: translateY(-14px); transition: transform .2s var(--spring); }
  .bn-fab:active { transform: translateY(-14px) scale(.92); }
  .bn-fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }

  .hero { padding: 22px 20px; border-radius: 22px; flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-greet { margin-bottom: 10px; }
  .hero-spark { width: 100%; max-width: none; text-align: left; display: flex; flex-direction: column; }
  .spark { height: 48px; }
  .hero-pattern { width: 200px; height: 200px; right: -50px; top: -40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > .stat:first-child:nth-last-child(3) { grid-column: 1 / -1; }
  .stat { padding: 14px; gap: 8px; }
  .stat-value { font-size: 18px; }
  .stat-ic { width: 30px; height: 30px; }
  .card { padding: 16px; border-radius: 18px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .bars { height: 180px; gap: 3px; }
  .bar { width: min(10px, 44%); }
  .toolbar { gap: 10px; }
  .toolbar-end { margin-left: 0; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .toolbar-end .btn { padding: 0 8px; font-size: 13px; }
  .filters { justify-content: flex-start; }
  .search { flex: 1; }
  .search .input { width: 100%; }
  .sumbar { grid-template-columns: repeat(2, 1fr); }
  .sumbar > div:nth-child(3) { border-left: 0; }
  .sumbar > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .sumbar b { font-size: 15px; }
  .grid-2, .grid-2.gap-lg { grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
  .grid-2.gap-lg { gap: 14px; }
  .roles { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: 1fr; }
  .lock-card { flex-wrap: wrap; }
  .lock-card form { width: 100%; }
  .lock-card .btn { width: 100%; }
  .modal { width: 100%; margin: auto auto 0; }
  .modal-card { border-radius: 26px 26px 0 0; max-height: calc(100dvh - 30px); padding-bottom: env(safe-area-inset-bottom); }
  .modal[open] .modal-card { animation: sheetIn .4s var(--spring); }
  .modal.closing .modal-card { animation: sheetOut .22s ease forwards; }
  .amount-field input { font-size: 30px; }
  .modal-foot .btn { flex: none; }
  .kc-bar {
    display: flex; position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30;
    justify-content: space-between; align-items: center; padding: 10px 16px; border-radius: 16px; color: #fff;
    background: linear-gradient(145deg, var(--hero-2), var(--hero-1)); box-shadow: var(--shadow-lg); transform: translateY(150%); transition: transform .4s var(--spring);
  }
  .kc-bar.show { transform: none; }
  .kc-bar span { opacity: .8; font-weight: 600; font-size: 13px; }
  .kc-bar b { font-size: 20px; font-variant-numeric: tabular-nums; }
  .denom { gap: 10px; }
  .note.bill { width: 54px; height: 34px; font-size: 12px; }
  .note.coin { width: 36px; height: 36px; margin: 0 9px; }
  .stepper input { width: 48px; }
  .stepper button { width: 36px; height: 36px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-mark-sm { display: block; }
  .checks { grid-template-columns: 1fr; }
  .pub-wrap { padding: 0 16px; }
  .tl-item { grid-template-columns: auto 1fr; }
  .tl-item time { grid-column: 2; }
  .sticky-save { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .sticky-save .btn { width: 100%; }
  .tabs a { padding: 7px 12px; }
}
@media (max-width: 380px) {
  .stat-value { font-size: 16px; }
  .denom-info b { font-size: 13px; }
  .stepper input { width: 40px; font-size: 15px; }
  .stepper button { width: 32px; }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  .sidebar, .topbar-actions, .bottomnav, .toolbar, .toasts, .quick, .lock-card, .foot { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}
