/* Ledger — design system
   Light and dark themes share one set of tokens. Dark is chosen by the OS
   unless the person picked a theme (html[data-theme]). */

:root {
  color-scheme: light;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f4f5f8;
  --surface-3: #e9ebf0;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #111522;
  --text-2: #454c5c;
  --text-3: #687082;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #4338ca;
  --accent-soft: #eef0ff;
  --on-accent: #ffffff;
  --ring: rgba(79, 70, 229, .28);

  --pos: #13804a;
  --neg: #d1342b;
  --warn: #9a5b00;
  --pos-soft: #e8f6ee;
  --neg-soft: #fdeeed;
  --warn-soft: #fff5e1;

  /* entry-type tones (icons and tints only; text stays on text tokens) */
  --t-expense: #e0483e;
  --t-income: #149a58;
  --t-transfer: #5b6b85;
  --t-card: #7c4dff;
  --t-loan: #c27803;
  --t-repay: #0d9488;
  --t-adjust: #6b7280;

  --chart: #5b52eb;
  --chart-wash: rgba(91, 82, 235, .10);
  --grid: #eceef3;

  --hero-a: #3d34c8;
  --hero-b: #6a4cf0;
  --hero-c: #2a2390;

  --shadow-sm: 0 1px 2px rgba(17, 21, 34, .05);
  --shadow: 0 1px 2px rgba(17, 21, 34, .04), 0 6px 20px rgba(17, 21, 34, .06);
  --shadow-lg: 0 16px 48px rgba(17, 21, 34, .18);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sidebar: 256px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d12;
    --surface: #13161d;
    --surface-2: #181c24;
    --surface-3: #222733;
    --border: #232835;
    --border-strong: #323949;
    --text: #e9ecf2;
    --text-2: #b6bdcb;
    --text-3: #8a93a6;
    --accent: #5b5ff0;
    --accent-hover: #6b6ff5;
    --accent-ink: #a9adff;
    --accent-soft: rgba(124, 128, 255, .14);
    --ring: rgba(124, 128, 255, .38);
    --pos: #4ad991;
    --neg: #ff7a70;
    --warn: #f3b34c;
    --pos-soft: rgba(74, 217, 145, .12);
    --neg-soft: rgba(255, 122, 112, .12);
    --warn-soft: rgba(243, 179, 76, .12);
    --t-expense: #ff7a70;
    --t-income: #4ad991;
    --t-transfer: #9aa8bf;
    --t-card: #b69cff;
    --t-loan: #f3b34c;
    --t-repay: #3fd1c0;
    --t-adjust: #9aa3b2;
    --chart: #8b8fff;
    --chart-wash: rgba(139, 143, 255, .12);
    --grid: #1f2430;
    --hero-a: #3a32b8;
    --hero-b: #5e43dc;
    --hero-c: #1d1870;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #13161d;
  --surface-2: #181c24;
  --surface-3: #222733;
  --border: #232835;
  --border-strong: #323949;
  --text: #e9ecf2;
  --text-2: #b6bdcb;
  --text-3: #8a93a6;
  --accent: #5b5ff0;
  --accent-hover: #6b6ff5;
  --accent-ink: #a9adff;
  --accent-soft: rgba(124, 128, 255, .14);
  --ring: rgba(124, 128, 255, .38);
  --pos: #4ad991;
  --neg: #ff7a70;
  --warn: #f3b34c;
  --pos-soft: rgba(74, 217, 145, .12);
  --neg-soft: rgba(255, 122, 112, .12);
  --warn-soft: rgba(243, 179, 76, .12);
  --t-expense: #ff7a70;
  --t-income: #4ad991;
  --t-transfer: #9aa8bf;
  --t-card: #b69cff;
  --t-loan: #f3b34c;
  --t-repay: #3fd1c0;
  --t-adjust: #9aa3b2;
  --chart: #8b8fff;
  --chart-wash: rgba(139, 143, 255, .12);
  --grid: #1f2430;
  --hero-a: #3a32b8;
  --hero-b: #5e43dc;
  --hero-c: #1d1870;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- app shell ---------- */
.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: 6px;
  padding: 18px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; color: var(--text); font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; }
.side-cta { margin: 14px 4px 10px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nav-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 8px 12px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-link .ic { width: 19px; height: 19px; color: var(--text-3); transition: color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link:hover .ic { color: var(--text-2); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-link.active .ic { color: var(--accent-ink); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.side-user { flex: 1; min-width: 0; line-height: 1.25; }
.side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user span { font-size: 12px; color: var(--text-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--hero-b), var(--hero-a));
  color: #fff; font-weight: 700; font-size: 14px;
}
.avatar:hover { text-decoration: none; }
.side-foot form { margin: 0; }

.main { min-width: 0; padding: 32px 40px 72px; }
.container { max-width: 1160px; margin: 0 auto; }

.topbar, .tabbar { display: none; }

@media (max-width: 1023px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(16px); backdrop-filter: saturate(1.8) blur(16px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; font-size: 16px; }
  .topbar .logo { width: 28px; height: 28px; }
  .topbar-actions { display: flex; align-items: center; gap: 6px; }
  .main { padding: 18px 16px calc(104px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(16px); backdrop-filter: saturate(1.8) blur(16px);
    border-top: 1px solid var(--border);
  }
  .tabbar.tabbar-admin { grid-template-columns: repeat(2, 1fr); }
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 2px; font-size: 11px; font-weight: 650; color: var(--text-3); }
.tab .ic { width: 22px; height: 22px; }
.tab:hover { text-decoration: none; color: var(--text-2); }
.tab.active { color: var(--accent-ink); }
.tab-add-btn {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--hero-b), var(--hero-a));
  color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, .4), 0 0 0 4px var(--bg);
  transition: transform .15s;
}
.tab-add-btn .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.tab-add:active .tab-add-btn { transform: scale(.94); }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; line-height: 1.2; font-weight: 750; letter-spacing: -.025em; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.lede { color: var(--text-2); margin-top: 6px; max-width: 62ch; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.back-link .ic { width: 16px; height: 16px; }
.back-link:hover { color: var(--text); text-decoration: none; }
@media (max-width: 640px) {
  .page-head { margin-bottom: 18px; align-items: stretch; }
  .page-head h1 { font-size: 23px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 20px; }
.split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.mt { margin-top: 20px; }
.mb { margin-bottom: 20px; }
@media (max-width: 900px) {
  .split, .halves { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.card-head + .rows, .card-head + .table-wrap { border-top: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 13px; color: var(--text-3); font-weight: 500; }
.card-link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.card-link .ic { width: 16px; height: 16px; }
.card-body { padding: 20px; }
.card-head + .card-body { padding-top: 4px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 14px; color: var(--text-2); }
.card-foot b { color: var(--text); font-variant-numeric: tabular-nums; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 650; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; background: none;
  font-weight: 650; font-size: 14px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(17, 21, 34, .12), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--neg-soft); color: var(--neg); }
.btn-danger:hover { background: color-mix(in srgb, var(--neg) 18%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.optional { font-weight: 500; color: var(--text-3); margin-left: 4px; }
.help { font-size: 12.5px; color: var(--text-3); min-height: 1em; }
.input {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--text-3); opacity: .8; }
.input:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="date"].input { min-width: 0; }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 180px; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .input { font-size: 16px; } /* no zoom on iOS */
  .form-actions .btn-lg { width: 100%; }
}

/* amount */
.amount { position: relative; display: block; }
.amount .cur { position: absolute; left: 16px; top: 50%; transform: translateY(-52%); font-size: 22px; font-weight: 650; color: var(--text-3); pointer-events: none; }
.amount .input { height: 58px; padding-left: 40px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.help.calc { color: var(--accent-ink); font-weight: 600; }

/* chips (radio pills) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip > span {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 14px; font-weight: 550;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.chip > span .ic { width: 16px; height: 16px; }
.chip > span:hover { border-color: color-mix(in srgb, var(--text-3) 70%, var(--border-strong)); color: var(--text); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.chip-new > span { border-style: dashed; }

/* Phones pick category and method from a dropdown instead of a wall of
   chips. The dropdown has no name: app.js mirrors it into the radios, which
   stay the submitted field. The swap waits for app.js to mark the field
   .pick-on, so a slow or failed script leaves the working chips in place. */
.pick-select { display: none; }
@media (max-width: 640px) {
  .pick-on .pick-chips, .pick-on .pick-hint { display: none; }
  .pick-on .pick-select { display: block; }
}

/* entry type picker */
.type-picker { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.type-picker legend { padding: 0; margin-bottom: 8px; }
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip { position: relative; display: inline-flex; }
.type-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.type-chip > span {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px 0 11px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.type-chip > span .ic { width: 17px; height: 17px; color: var(--tone); }
.type-chip > span:hover { color: var(--text); border-color: color-mix(in srgb, var(--tone) 45%, var(--border-strong)); }
.type-chip input:checked + span {
  background: color-mix(in srgb, var(--tone) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--tone) 70%, transparent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 70%, transparent);
}
.type-chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.type-hint { margin-top: 10px; font-size: 13px; color: var(--text-3); min-height: 1.5em; }
@media (max-width: 640px) {
  .type-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .type-chips::-webkit-scrollbar { display: none; }
  .type-chip { scroll-snap-align: start; }
}

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-2); font-weight: 550; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  position: relative; width: 38px; height: 22px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  cursor: pointer; transition: background .2s, border-color .2s;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }

/* ---------- callouts & toasts ---------- */
.callout {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 14px; color: var(--text);
}
.callout > .ic { color: var(--accent-ink); }
.callout-body { flex: 1 1 260px; min-width: 0; }
.callout-body b { font-weight: 650; }
.callout-body p + p { margin-top: 4px; }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.callout-warn > .ic { color: var(--warn); }
.callout-error { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); margin-bottom: 18px; }
.callout-error > .ic { color: var(--neg); }
.callout-ok { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 28%, transparent); }
.callout-ok > .ic { color: var(--pos); }
.callout.subtle { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.callout.subtle > .ic { color: var(--text-3); }

.toast-wrap { position: fixed; z-index: 60; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 440px; padding: 12px 10px 12px 14px;
  border-radius: 14px; background: #161a23; color: #f1f3f7;
  box-shadow: var(--shadow-lg); font-weight: 550; font-size: 14px;
  animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2);
}
:root[data-theme="dark"] .toast { background: #eef0f5; color: #12151d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #eef0f5; color: #12151d; } }
.toast > .ic { color: #34c77b; }
.toast-error > .ic { color: #ff6b61; }
.toast span { flex: 1; }
.toast-x { border: 0; background: none; padding: 4px; border-radius: 8px; opacity: .6; cursor: pointer; color: inherit; }
.toast-x:hover { opacity: 1; }
.toast-x .ic { width: 16px; height: 16px; }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1023px) {
  .toast-wrap { left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge .ic { width: 13px; height: 13px; }
.badge-pos { background: var(--pos-soft); color: var(--pos); }
.badge-neg { background: var(--neg-soft); color: var(--neg); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- hero & stats ---------- */
.dash-top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .dash-top { grid-template-columns: minmax(0, 1fr); } }
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 228px; padding: 24px 26px 26px;
  border-radius: var(--r-xl); color: #fff;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%),
    linear-gradient(135deg, var(--hero-b) 0%, var(--hero-a) 52%, var(--hero-c) 100%);
  box-shadow: 0 14px 34px rgba(61, 52, 200, .28);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-label { font-size: 14px; font-weight: 600; opacity: .85; }
.hero-change { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 13px; font-weight: 650; }
.hero-change .ic { width: 15px; height: 15px; }
.hero-change small { opacity: .75; font-weight: 550; }
.hero-value { font-size: 46px; font-weight: 760; letter-spacing: -.035em; line-height: 1.1; margin: 10px 0 0; }
.hero-split { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 22px 0 0; }
.hero-split div { min-width: 0; }
.hero-split dt { font-size: 12px; opacity: .72; font-weight: 550; }
.hero-split dd { margin: 2px 0 0; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hero-spark { position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; }
.spark-line { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { fill: rgba(255, 255, 255, .08); }
@media (max-width: 640px) {
  .hero { padding: 20px; min-height: 0; }
  .hero-value { font-size: 36px; }
  .hero-split { gap: 10px 20px; margin-top: 18px; }
}

.month-card { display: flex; flex-direction: column; }
.month-rows { padding: 0 8px 8px; }
.month-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: var(--text); }
a.month-row:hover { background: var(--surface-2); text-decoration: none; }
.month-row > span:nth-child(2) { flex: 1; color: var(--text-2); font-weight: 550; }
.month-row b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-row .ic { width: 16px; height: 16px; color: var(--text-3); }
.dot { width: 10px; height: 10px; border-radius: 4px; background: var(--text-3); flex: none; }
.dot-neg { background: var(--t-expense); }
.dot-pos { background: var(--t-income); }
.meter-wrap { margin-top: auto; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.meter-cap { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; gap: 8px; }
.meter-cap b { color: var(--text-2); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--chart); }
.meter.over > span { background: var(--neg); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
a.stat { color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat-label .ic { width: 16px; height: 16px; }
.stat-value { font-size: 23px; font-weight: 750; letter-spacing: -.025em; margin-top: 4px; white-space: nowrap; }
.stat-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 19px; }
}

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-stat { padding: 16px 18px; min-width: 0; }
.mini-stat + .mini-stat { border-left: 1px solid var(--border); }
.mini-stat span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.mini-stat b { display: block; font-size: 18px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- rows (entries, accounts) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--text); min-width: 0; }
.rows > li:first-child > .row, .rows > .row:first-child { border-top: 0; }
a.row:hover, .row.hoverable:hover { background: var(--surface-2); text-decoration: none; }
.row-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  color: var(--tone, var(--text-3));
  background: color-mix(in srgb, var(--tone, var(--text-3)) 13%, transparent);
}
.row-ic .ic { width: 19px; height: 19px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.row-title:hover { color: var(--accent-ink); text-decoration: none; }
.row-meta { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-note { font-size: 13px; color: var(--text-3); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.row-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows > li.row { position: relative; }
.row-actions {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; padding: 4px 4px 4px 28px;
  background: linear-gradient(90deg, transparent, var(--surface-2) 26px);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.row:hover, .row:focus-within { background: var(--surface-2); }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; pointer-events: auto; }
.row-actions form { margin: 0; }
@media (hover: none) { .row-actions { display: none; } }
@media (max-width: 640px) {
  .row { padding: 12px 16px; gap: 12px; }
  .row-ic { width: 36px; height: 36px; border-radius: 11px; }
  .row-actions { display: none; }
}
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 650; color: var(--text-3); position: sticky; top: 0; }
.group-head:first-child { border-top: 0; }
.group-head a { color: var(--text-2); }
.group-head b { font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) { .group-head { top: calc(56px + env(safe-area-inset-top)); } }

/* tones */
.t-expense { --tone: var(--t-expense); }
.t-income { --tone: var(--t-income); }
.t-transfer { --tone: var(--t-transfer); }
.t-card { --tone: var(--t-card); }
.t-loan { --tone: var(--t-loan); }
.t-repay { --tone: var(--t-repay); }
.t-adjust { --tone: var(--t-adjust); }
.a-bank { --tone: var(--accent); }
.a-cash { --tone: var(--t-income); }
.a-wallet { --tone: var(--t-repay); }
.a-credit_card { --tone: var(--t-card); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table tfoot tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.table tfoot tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }
.cell-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-name .row-ic { width: 32px; height: 32px; border-radius: 10px; }
.cell-name .row-ic .ic { width: 16px; height: 16px; }

/* ---------- bars (ranked categories) ---------- */
.bars { list-style: none; margin: 0; padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: baseline; }
.bar-name { font-weight: 550; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-val { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val small { font-weight: 550; color: var(--text-3); margin-left: 6px; font-size: 12.5px; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--chart); min-width: 4px; }

/* ---------- charts ---------- */
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: var(--h, 220px) 24px; column-gap: 10px; padding: 8px 20px 14px 12px; }
.chart-y { position: relative; grid-row: 1; grid-column: 1; min-width: 44px; }
.chart-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-plot { position: relative; grid-row: 1; grid-column: 2; }
.chart-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--grid); }
.chart-plot > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--chart-wash); }
.chart-dot, .chart-hover-dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--chart); box-shadow: 0 0 0 2px var(--surface);
  transform: translate(-50%, -50%); pointer-events: none;
}
.chart-hover-dot { display: none; width: 12px; height: 12px; }
.chart-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); display: none; pointer-events: none; }
.chart-x { position: relative; grid-row: 2; grid-column: 2; }
.chart-x span { position: absolute; top: 7px; transform: translateX(-50%); font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.chart-x span.first { transform: none; }
.chart-x span.last { transform: translateX(-100%); }
.chart-hits { position: absolute; inset: 0; display: flex; }
.chart-hits > span { flex: 1; cursor: crosshair; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.chart-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; min-width: 0; cursor: default; }
.chart-col i { display: block; width: 100%; max-width: 24px; background: var(--chart); border-radius: 4px 4px 0 0; }
.chart-col:hover i, .chart-col.on i { background: var(--accent-hover); }
.chart-tip {
  position: absolute; z-index: 5; display: none; pointer-events: none;
  padding: 6px 10px; border-radius: 8px;
  background: #161a23; color: #f1f3f7; font-size: 12.5px; font-weight: 650; white-space: nowrap;
  box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 12px));
}
:root[data-theme="dark"] .chart-tip { background: #eef0f5; color: #12151d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chart-tip { background: #eef0f5; color: #12151d; } }
.chart-empty { padding: 0 20px 20px; }

/* ---------- empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 24px 40px; }
.empty-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); margin-bottom: 8px; border: 1px solid var(--border); }
.empty-ic .ic { width: 24px; height: 24px; }
.empty h3 { font-size: 15px; font-weight: 700; }
.empty p { color: var(--text-3); font-size: 14px; max-width: 40ch; }
.empty .btn { margin-top: 12px; }

/* ---------- onboarding steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.step { display: flex; flex-direction: column; gap: 8px; padding: 18px; color: var(--text); }
a.step:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.step-n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 750; font-size: 13px; }
.step b { font-size: 15px; }
.step span { font-size: 13.5px; color: var(--text-3); }
.step.done .step-n { background: var(--pos-soft); color: var(--pos); }
@media (max-width: 900px) { .steps { grid-template-columns: minmax(0, 1fr); } }

/* ---------- date / month navigator ---------- */
.datenav { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.datenav input[type="date"] { height: 32px; border: 0; background: none; padding: 0 6px; font-weight: 650; font-size: 14px; color: var(--text); min-width: 0; }
.datenav input[type="date"]:focus { outline: none; }
.datenav .label-month { padding: 0 10px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.datenav .btn-icon { width: 32px; height: 32px; }
@media (max-width: 640px) { .datenav { width: 100%; justify-content: space-between; } }

/* ---------- day page ---------- */
.day-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
@media (max-width: 1100px) { .day-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- accounts ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.acct { display: flex; flex-direction: column; padding: 18px; gap: 16px; transition: border-color .15s, box-shadow .15s; }
.acct:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.acct-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acct-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-type { font-size: 12.5px; color: var(--text-3); }
.acct-bal { font-size: 24px; font-weight: 750; letter-spacing: -.025em; white-space: nowrap; }
.acct-bal small { font-size: 13px; font-weight: 550; color: var(--text-3); letter-spacing: 0; margin-left: 4px; }
.acct-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.acct-links { display: flex; gap: 14px; font-weight: 600; }
.acct.inactive { opacity: .62; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font-size: 16px; font-weight: 700; }
.section-title span { font-size: 13.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.section-title:first-child { margin-top: 0; }

/* ---------- reconcile ---------- */
.recon-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 180px 150px; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.recon-row.head { border-top: 0; padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); }
.recon-row.head + .recon-row { border-top: 0; }
.recon-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.recon-row .input { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.recon-diff { display: flex; justify-content: flex-end; }
.recon-label { display: none; }
@media (max-width: 760px) {
  .recon-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
  .recon-row.head { display: none; }
  .recon-row > :first-child { grid-column: 1 / -1; }
  .recon-row .num { text-align: left; }
  .recon-label { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: none; letter-spacing: 0; }
  .recon-diff { grid-column: 1 / -1; justify-content: flex-start; }
}
.recon-card + .recon-card { margin-top: 16px; }
.adjust-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.adjust-form .input { flex: 1 1 200px; height: 36px; font-size: 14px; }

/* ---------- editable list (categories, methods, contacts) ---------- */
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--border); margin: 0; }
.edit-row.with-note { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(120px, auto) auto auto; }
.edit-row .input { height: 36px; font-size: 14px; }
.edit-row .uses { font-size: 12.5px; color: var(--text-3); white-space: nowrap; min-width: 64px; text-align: right; }
.edit-row form { margin: 0; }
.edit-row.inactive .input { color: var(--text-3); }
.add-row { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.loan-cell { font-size: 13px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.loan-cell b { display: block; font-size: 14px; }
@media (max-width: 640px) {
  .edit-row, .edit-row.with-note { grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 16px; }
  .edit-row .uses { display: none; }
  .edit-row.with-note .note-input { grid-column: 1 / -1; grid-row: 2; }
  .edit-row.with-note .loan-cell { grid-column: 1 / -1; grid-row: 3; text-align: left; }
  .edit-row.with-note .loan-cell b { display: inline; margin-right: 10px; }
}

/* ---------- details / disclosure ---------- */
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; font-weight: 700; font-size: 15px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .ic { transition: transform .2s; color: var(--text-3); }
details.card[open] > summary .ic { transform: rotate(180deg); }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.inline-details > summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 13px; list-style: none; }
details.inline-details > summary::-webkit-details-marker { display: none; }

/* ---------- menu list (More page) ---------- */
.menu { list-style: none; margin: 0; padding: 0; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--text); font-weight: 550; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font-size: 15px; }
.menu > li:first-child .menu-item { border-top: 0; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .row-ic { width: 34px; height: 34px; border-radius: 10px; }
.menu-item .row-ic .ic { width: 18px; height: 18px; }
.menu-item .chev { margin-left: auto; color: var(--text-3); width: 18px; height: 18px; }
.menu-item form { margin: 0; }
.menu-title { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 22px 4px 8px; }
.theme-picker { display: flex; gap: 8px; padding: 14px 18px; }
.theme-picker .chip { flex: 1; }
.theme-picker .chip > span { width: 100%; justify-content: center; }

/* ---------- auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(50% 40% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; padding: 32px; border-radius: var(--r-xl); box-shadow: var(--shadow); }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; margin-bottom: 26px; }
.auth-brand .logo { width: 52px; height: 52px; filter: drop-shadow(0 8px 18px rgba(79, 70, 229, .35)); }
.auth-brand h1 { font-size: 23px; font-weight: 750; }
.auth-brand p { color: var(--text-3); margin-top: 4px; font-size: 14px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-3); }
.auth .callout { margin-bottom: 18px; }
@media (max-width: 640px) { .auth-card { padding: 24px 20px; } }

/* ---------- admin ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .avatar { width: 32px; height: 32px; font-size: 13px; }
.user-cell b { display: block; font-weight: 650; }
.user-cell span { font-size: 12.5px; color: var(--text-3); }
.admin-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.admin-actions form { margin: 0; }
.admin-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.admin-edit .input { height: 36px; font-size: 14px; }
@media (max-width: 760px) { .admin-edit { grid-template-columns: minmax(0, 1fr); } }

/* ---------- edit entry ---------- */
.danger-zone { border-color: color-mix(in srgb, var(--neg) 30%, var(--border)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 550; text-align: right; }

/* ---------- theme toggle icon swap ---------- */
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: inline; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-dark { display: inline; }
  :root:not([data-theme="light"]) .when-light { display: none; }
}

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

@media print {
  .sidebar, .topbar, .tabbar, .toast-wrap, .head-actions, .row-actions { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
