/* Boop Web Helper — styled after Boop for Mac (BoopMac/), token for token.
   Colours: Boop/Assets.xcassets Theme*, BoopMac MacComponents (inks, fills).
   Type: SF Pro Rounded (BoopTypography), Nunito where SF Rounded is missing.
   Metrics: BoopDesign + MacComponents (panel 18, hero 22, rows 38/11). */

:root {
  --bg: #F9F0E0;
  --card: #FFFFFF;
  --text: #4A2518;
  --text-2: #8B664F;
  --text-3: rgba(74, 37, 24, 0.45);
  --hair: rgba(74, 37, 24, 0.07);
  --hair-2: rgba(74, 37, 24, 0.12);
  --fill-soft: rgba(74, 37, 24, 0.05);
  --accent: #F5921E;
  --accent-fill: #AF5F00;
  --accent-ink: #9B5D13;
  --accent-soft: rgba(245, 146, 30, 0.13);
  --accent-ring: rgba(245, 146, 30, 0.35);
  --income: #2E7D32;
  --expense: #C62828;
  --income-fill: #138630;
  --expense-fill: #D4241A;
  --orange-fill: #AC6400;
  --blue-fill: #006FE9;
  --indigo-fill: #3F3CD6;
  --teal-fill: #127F93;
  --warning: #9A4400;
  --info: #2156B8;
  --on-accent: #FFFFFF;
  --sidebar-bg: rgba(250, 243, 231, 0.82);
  --sidebar-hair: rgba(74, 37, 24, 0.08);
  --sidebar-sel: rgba(245, 146, 30, 0.18);
  --toolbar-bg: rgba(249, 240, 224, 0.78);
  --glass: rgba(255, 255, 255, 0.66);
  --glass-hair: rgba(74, 37, 24, 0.1);
  --shadow-panel: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 18px 50px rgba(40, 18, 8, 0.22), 0 2px 6px rgba(40, 18, 8, 0.08);
  --row-alt: rgba(74, 37, 24, 0.028);
  --overlay: rgba(30, 14, 8, 0.28);
  --cover: url('assets/cover-sunny-meadow.jpg');
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sidebar-w: 236px;
  --radius-panel: 18px;
  --radius-hero: 22px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #130F11;
    --card: #1E191B;
    --text: #F4F2F0;
    --text-2: #877D82;
    --text-3: rgba(244, 242, 240, 0.4);
    --hair: rgba(244, 242, 240, 0.07);
    --hair-2: rgba(244, 242, 240, 0.12);
    --fill-soft: rgba(244, 242, 240, 0.06);
    --accent-ink: #F5921E;
    --accent-soft: rgba(245, 146, 30, 0.16);
    --income: #4CAF50;
    --expense: #E57373;
    --warning: #FF9F0A;
    --info: #7FB2FF;
    --sidebar-bg: rgba(28, 23, 25, 0.86);
    --sidebar-hair: rgba(244, 242, 240, 0.08);
    --sidebar-sel: rgba(245, 146, 30, 0.22);
    --toolbar-bg: rgba(19, 15, 17, 0.8);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-hair: rgba(255, 255, 255, 0.12);
    --shadow-panel: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
    --row-alt: rgba(255, 255, 255, 0.025);
    --overlay: rgba(0, 0, 0, 0.5);
    --cover: url('assets/cover-sunny-meadow-dark.jpg');
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #130F11;
  --card: #1E191B;
  --text: #F4F2F0;
  --text-2: #877D82;
  --text-3: rgba(244, 242, 240, 0.4);
  --hair: rgba(244, 242, 240, 0.07);
  --hair-2: rgba(244, 242, 240, 0.12);
  --fill-soft: rgba(244, 242, 240, 0.06);
  --accent-ink: #F5921E;
  --accent-soft: rgba(245, 146, 30, 0.16);
  --income: #4CAF50;
  --expense: #E57373;
  --warning: #FF9F0A;
  --info: #7FB2FF;
  --sidebar-bg: rgba(28, 23, 25, 0.86);
  --sidebar-hair: rgba(244, 242, 240, 0.08);
  --sidebar-sel: rgba(245, 146, 30, 0.22);
  --toolbar-bg: rgba(19, 15, 17, 0.8);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-hair: rgba(255, 255, 255, 0.12);
  --shadow-panel: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
  --row-alt: rgba(255, 255, 255, 0.025);
  --overlay: rgba(0, 0, 0, 0.5);
  --cover: url('assets/cover-sunny-meadow-dark.jpg');
  color-scheme: dark;
}

/* ---------- Base ---------- */

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.icon { display: inline-flex; flex: none; line-height: 0; }
.icon svg { display: block; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--card); padding: 8px 12px; border-radius: 10px; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.num, .amount { font-variant-numeric: tabular-nums; }
.income { color: var(--income); }
.expense { color: var(--expense); }
.accent-ink { color: var(--accent-ink); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--hair-2); margin: 12px 0; border: 0; }
.blur-amounts .amt { filter: blur(7px); transition: filter .2s; }
.blur-amounts .amt:hover { filter: none; }

/* ---------- Window shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar-bg);
  backdrop-filter: saturate(1.4) blur(30px);
  -webkit-backdrop-filter: saturate(1.4) blur(30px);
  border-right: 1px solid var(--sidebar-hair);
  padding: 14px 10px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mascot { width: 36px; height: 36px; }
.brand-name { display: block; font-weight: 800; font-size: 17px; line-height: 1.1; }
.brand-sub { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; }

.side-group-head {
  font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .02em;
  padding: 14px 10px 4px;
}
.side-item {
  display: flex; align-items: center; gap: 9px;
  min-height: 32px; padding: 5px 10px; border-radius: 8px;
  color: var(--text); font-size: 15px; font-weight: 500;
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.side-item:hover { background: var(--fill-soft); text-decoration: none; }
.side-item[aria-current="page"] { background: var(--sidebar-sel); font-weight: 600; }
.side-item .icon { color: var(--accent); }
.side-item .side-count { margin-left: auto; font-size: 12px; color: var(--text-2); font-weight: 600; }
.side-item.child { padding-left: 30px; }
.side-item .disclose {
  margin-left: auto; color: var(--text-3); display: inline-flex; padding: 2px; border-radius: 6px; transition: transform .18s;
}
.side-item .disclose:hover { background: var(--fill-soft); }
.side-collapsed .disclose { transform: rotate(-90deg); }
.side-children[hidden] { display: none; }
.side-item.plain .icon { color: var(--text-2); }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; display: flex; flex-direction: column; gap: 8px; }
.privacy-line { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; }
.privacy-line .icon { color: var(--accent); margin-top: 1px; }
.sidebar-links { font-size: 12px; color: var(--text-2); }

.detail { min-width: 0; display: flex; flex-direction: column; }
.toolbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 8px 20px;
  background: var(--toolbar-bg);
  backdrop-filter: saturate(1.4) blur(24px);
  -webkit-backdrop-filter: saturate(1.4) blur(24px);
  border-bottom: 1px solid var(--hair);
}
.toolbar-title { font-size: 15px; font-weight: 700; }
.toolbar-sub { font-size: 12px; color: var(--text-2); }
.toolbar .spacer { flex: 1; }
.toolbar-center { display: flex; align-items: center; gap: 8px; }
.menu-btn { position: relative; }
.mobile-menu { display: none; }

.main { flex: 1; min-width: 0; outline: none; }
.screen { min-height: calc(100vh - 52px); }

/* ---------- Pages ---------- */

.tab-page { position: relative; isolation: isolate; }
.tab-page::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 520px; z-index: -1;
  background: var(--cover) center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
  opacity: .95;
}
.page { max-width: 1240px; margin: 0 auto; padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head .lead, .page-sub { font-size: 15px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-head { display: flex; align-items: center; gap: 8px; }
.section-head h2 { font-size: 17px; font-weight: 600; }
.section-label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.title-icon { display: flex; align-items: center; gap: 10px; }
.title-icon .icon { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---------- Panels (MacPanel) ---------- */

.panel, .card {
  background: var(--card);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--hair);
  padding: 16px;
}
.card-flat { box-shadow: inset 0 0 0 1px var(--hair); }
.panel-title, .card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-title h2, .card-head h2 { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-title .icon, .card-head h2 .icon { color: var(--accent); }
.panel-title .spacer, .card-head .spacer { flex: 1; }
.card-head { justify-content: space-between; }
.link-btn { background: none; border: 0; color: var(--accent-ink); font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px 4px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }

/* Record rows (MacRecordGroup / MacRecordRow) */
.rec-group { display: flex; flex-direction: column; gap: 8px; }
.rec-group > .section-label { padding: 0 4px; }
.rec-list { background: var(--card); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--hair); overflow: hidden; }
.rec-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; position: relative;
  background: none; border: 0; width: 100%; text-align: left; color: inherit; cursor: pointer;
}
.rec-row + .rec-row::before { content: ""; position: absolute; left: 64px; right: 0; top: 0; height: 1px; background: var(--hair-2); }
.rec-row:hover { background: var(--fill-soft); }
.rec-row.dim { opacity: .6; }
.rec-row .tile {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: var(--tint, var(--accent));
  background: color-mix(in srgb, var(--tint, var(--accent)) 13%, transparent);
}
.rec-title { font-size: 15px; font-weight: 500; }
.rec-sub { font-size: 13px; font-weight: 500; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-trail { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rec-amount { font-size: 15px; font-weight: 600; }
.rec-amount.sm { font-size: 13px; }
.rec-row .progress { margin-top: 6px; }

/* Category badge */
.cat-badge {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: var(--tint, var(--accent)); background: color-mix(in srgb, var(--tint, var(--accent)) 14%, transparent);
}
.cat-badge.lg { width: 34px; height: 34px; }
.cat-badge.md { width: 32px; height: 32px; }

/* Transaction rows (MacOverviewPanels) */
.tx-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.tx-row + .tx-row { border-top: 1px solid var(--hair); }
.tx-title { font-size: 15px; }
.tx-sub { font-size: 12px; color: var(--text-2); }
.tx-amt { font-family: var(--mono); font-size: 14px; font-weight: 500; white-space: nowrap; }
.tx-amt.in { color: var(--income); }

/* Stat tile (MacStatTile) */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-tile { background: var(--card); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--hair); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-tile .label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.stat-tile .label .icon { color: var(--accent); }
.stat-tile .figure { font-size: 18px; font-weight: 700; }
.stat-tile .caption { font-size: 12px; color: var(--text-2); }

/* Hero / figure cards (macHeroCard) */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius-hero); padding: 20px;
  background: var(--hero, var(--accent-fill));
  box-shadow: 0 6px 12px color-mix(in srgb, var(--hero, var(--accent-fill)) 30%, transparent);
}
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.12)); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .hero-label { font-size: 14px; font-weight: 700; opacity: .92; display: flex; align-items: center; gap: 6px; }
.hero .hero-figure { font-size: 34px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin-top: 4px; }
.hero .hero-figure.sm { font-size: 28px; }
.hero .hero-caption { font-size: 13px; opacity: .88; }
.hero-pills { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-pill { background: rgba(255,255,255,.94); color: var(--text); border-radius: 999px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
:root[data-theme="dark"] .hero-pill { color: #4A2518; }
.hero-pill.in { color: #2E7D32; }
.hero-pill.out { color: #C62828; }
.hero-divider { height: 1px; background: rgba(255,255,255,.3); margin: 14px 0 10px; }
.figure-card { border-radius: var(--radius-panel); padding: 16px; color: #fff; background: var(--hero, var(--accent-fill)); position: relative; overflow: hidden; min-height: 96px; }
.figure-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.12)); }
.figure-card > * { position: relative; z-index: 1; }
.figure-card .label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.figure-card .figure { font-size: 22px; font-weight: 700; margin-top: 6px; }
.figure-card .caption { font-size: 12px; opacity: .85; margin-top: 2px; }

/* Progress (MacProgressBar) */
.progress { height: 6px; border-radius: 999px; background: var(--hair-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--bar, #4CAF50); }
.ring { --p: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.18) 0); }
.ring > span { width: 29px; height: 29px; border-radius: 50%; background: var(--hero, var(--accent-fill)); display: grid; place-items: center; color: #fff; }

/* Finance chips */
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--hair-2); color: var(--text);
  font-size: 12px; font-weight: 600; cursor: pointer; border: 0;
}
.nav-chip .icon { color: var(--accent); }
.nav-chip:hover { box-shadow: inset 0 0 0 1px var(--accent-ring); text-decoration: none; }
.nav-chip[aria-pressed="true"] { background: var(--accent-fill); color: #fff; }
.nav-chip[aria-pressed="true"] .icon { color: #fff; }

/* Segmented control (native .segmented) */
.seg { display: inline-flex; background: var(--fill-soft); border-radius: 9px; padding: 2px; gap: 2px; box-shadow: inset 0 0 0 1px var(--hair); }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Buttons: .glass and .glassProminent */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 6px 14px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none !important;
  background: var(--glass); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--glass-hair), 0 1px 2px rgba(0,0,0,.05);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .12s, filter .12s, background .12s;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary, .btn-prominent { background: var(--accent-fill); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.btn-primary:hover, .btn-prominent:hover { filter: brightness(1.06); }
.btn-secondary { }
.btn-ghost { background: none; box-shadow: none; backdrop-filter: none; color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger-soft, .btn-danger { color: var(--expense); }
.btn-danger { background: var(--expense-fill); color: #fff; box-shadow: none; }
.btn-sm { min-height: 26px; padding: 3px 10px; font-size: 12px; }
.btn-lg { min-height: 40px; padding: 9px 20px; font-size: 15px; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 26px; }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: 999px 0 0 999px; padding-right: 10px; }
.split .btn:last-child { border-radius: 0 999px 999px 0; padding: 0 8px; border-left: 1px solid rgba(255,255,255,.25); }

/* Chips / pills */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--fill-soft); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip-ok, .chip-income { background: color-mix(in srgb, var(--income) 14%, transparent); color: var(--income); }
.chip-expense, .chip-err { background: color-mix(in srgb, var(--expense) 14%, transparent); color: var(--expense); }
.chip-info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.chip-warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.chip-currency { font-family: var(--mono); font-size: 11px; }
.chip-tag { background: var(--accent-soft); color: var(--accent-ink); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-hair); font-size: 12px; font-weight: 600; }
.filter-chip button { border: 0; background: var(--fill-soft); border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }

/* Callouts */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--hair); font-size: 14px; }
.callout > .icon { color: var(--accent); margin-top: 1px; }
.callout p + p { margin-top: 6px; }
.callout-info { background: color-mix(in srgb, var(--info) 8%, var(--card)); }
.callout-info > .icon { color: var(--info); }
.callout-warn { background: color-mix(in srgb, var(--warning) 9%, var(--card)); }
.callout-warn > .icon { color: var(--warning); }
.callout-ok { background: color-mix(in srgb, var(--income) 9%, var(--card)); }
.callout-ok > .icon { color: var(--income); }
.callout-danger { background: color-mix(in srgb, var(--expense) 9%, var(--card)); }
.callout-danger > .icon { color: var(--expense); }

/* Empty state (MacSectionPage) */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 36px 16px; color: var(--text-2); }
.empty img { width: 76px; height: 76px; }
.empty h3 { color: var(--text); font-size: 17px; font-weight: 600; }
.empty .row { justify-content: center; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-2); }
.input, .select, textarea.input {
  width: 100%; min-height: 32px; padding: 6px 10px; border-radius: 8px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--hair-2); outline: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.select-sm { min-height: 26px; padding: 2px 8px; font-size: 13px; width: auto; }
textarea.input { min-height: 72px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent-fill); }
.search { position: relative; }
.search .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.search input { padding-left: 32px; border-radius: 999px; min-width: 240px; }
.amount-input { font-size: 28px; font-weight: 800; text-align: center; border: 0; background: none; width: 100%; color: var(--text); }

/* ---------- Tables ---------- */

.table-wrap { overflow: auto; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--hair); background: var(--card); }
.boop-table, .simple-table, .sample-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.boop-table th, .simple-table th, .sample-table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 8px 12px; position: sticky; top: 0; background: var(--card); z-index: 1;
  border-bottom: 1px solid var(--hair-2); white-space: nowrap;
}
.boop-table td, .simple-table td, .sample-table td { padding: 7px 12px; vertical-align: middle; }
.boop-table tbody tr:nth-child(even), .sample-table tbody tr:nth-child(even) { background: var(--row-alt); }
.boop-table tbody tr { cursor: default; }
.boop-table tbody tr:hover { background: var(--accent-soft); }
.boop-table tbody tr.selected { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.boop-table .num, .simple-table .num { text-align: right; }
.boop-table td.edit-cell { cursor: text; }
.boop-table td input.input { min-height: 26px; padding: 2px 6px; }
.table-foot { display: flex; gap: 16px; align-items: center; padding: 8px 16px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--hair-2); background: var(--card); position: sticky; bottom: 0; flex-wrap: wrap; }
.table-foot strong { color: var(--text); }

/* ---------- Split views (Transactions inspector, Debts list) ---------- */

.split-view { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; min-height: calc(100vh - 52px); }
.split-view.no-inspector { grid-template-columns: minmax(0, 1fr); }
.inspector { border-left: 1px solid var(--hair); background: var(--sidebar-bg); padding: 18px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto; }
.list-detail { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- Wallet card faces ---------- */

.wallet-card {
  position: relative; aspect-ratio: 85.6 / 53.98; border-radius: clamp(14px, 8%, 22px); padding: 16px 18px;
  color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, color-mix(in srgb, var(--wc) 100%, #fff 8%), color-mix(in srgb, var(--wc) 78%, #000 22%));
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 16px color-mix(in srgb, var(--wc) 25%, transparent), 0 2px 4px rgba(0,0,0,.12);
  transition: transform .18s, box-shadow .18s; cursor: pointer; border: 0; text-align: left; width: 100%;
}
.wallet-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,.22), transparent 55%); pointer-events: none; }
.wallet-card:hover { transform: scale(1.015); box-shadow: 0 8px 14px rgba(0,0,0,.16), 0 2px 4px rgba(0,0,0,.12); }
.wallet-card.light-ink { color: #3a2418; }
.wallet-card > * { position: relative; }
.wc-top { display: flex; align-items: center; gap: 8px; }
.wc-logo { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.wc-name { font-weight: 700; font-size: 15px; }
.wc-type { font-size: 11px; opacity: .85; font-weight: 600; }
.wc-amount { font-size: 22px; font-weight: 700; }
.wc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 12px; opacity: .92; }
.deck { position: relative; height: 230px; max-width: 440px; }
.deck .wallet-card { position: absolute; left: 0; top: 24px; width: calc(100% - 28px); }
.deck .wallet-card:nth-child(2) { transform: translate(14px, -12px) scale(.95); opacity: .75; z-index: -1; }
.deck .wallet-card:nth-child(3) { transform: translate(28px, -24px) scale(.9); opacity: .6; z-index: -2; }
.deck { isolation: isolate; }

/* ---------- Sheets (MacEditorFrame), drawers, dialogs, toasts ---------- */

.sheet-overlay, .drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 16px; animation: fade .18s ease; }
.sheet, .dialog {
  width: min(520px, 100%); max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-pop); overflow: hidden;
  animation: drop .22s cubic-bezier(.2,.8,.2,1);
}
.sheet.wide { width: min(760px, 100%); }
.sheet-head, .dialog-head { padding: 18px 20px 6px; }
.sheet-head h2, .dialog h2 { font-size: 17px; font-weight: 600; }
.sheet-body, .dialog-body { padding: 10px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot, .dialog-foot { padding: 12px 20px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--hair); background: var(--card); }
.sheet-foot .left { margin-right: auto; }
.form-card { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: inset 0 0 0 1px var(--hair); display: flex; flex-direction: column; gap: 12px; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(460px, 100%); background: var(--bg); box-shadow: var(--shadow-pop); z-index: 61; display: flex; flex-direction: column; animation: slide .22s ease; }
.drawer-head { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--hair); }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--hair); display: flex; gap: 8px; justify-content: flex-end; background: var(--card); }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toast-region { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 999px; background: #2a1d17; color: #fff; box-shadow: var(--shadow-pop); font-size: 14px; animation: drop .2s ease; }
.toast-action, .toast-close { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 999px; padding: 4px 10px; font-weight: 700; cursor: pointer; font-size: 13px; }
.toast-close { padding: 4px 8px; }
.menu { position: absolute; z-index: 70; min-width: 200px; background: var(--card); border-radius: 12px; padding: 5px; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--hair); }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; border-radius: 7px; font-size: 14px; text-align: left; cursor: pointer; color: var(--text); }
.menu button:hover { background: var(--accent-fill); color: #fff; }
.menu button:hover .icon { color: #fff; }
.menu .icon { color: var(--accent); }
.menu hr { border: 0; height: 1px; background: var(--hair-2); margin: 4px 6px; }

/* ---------- Quick-log bar (MacQuickLogBar) ---------- */

.quick-bar-wrap { position: sticky; bottom: 0; z-index: 15; padding: 8px 20px 14px; background: linear-gradient(to bottom, transparent, var(--bg) 40%); }
.quick-chips { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; justify-content: center; }
.quick-chip { font-size: 12px; font-weight: 600; color: var(--accent-ink); padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); border: 0; cursor: pointer; }
.quick-bar { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-radius: 999px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-hair), 0 6px 20px rgba(0,0,0,.08); backdrop-filter: saturate(1.6) blur(24px); -webkit-backdrop-filter: saturate(1.6) blur(24px); }
:root:not([data-theme="dark"]) .quick-bar { background: rgba(255,255,255,.78); }
.quick-bar img { width: 26px; height: 26px; }
.quick-bar input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; font-weight: 500; min-width: 0; }
.quick-bar .mode { font-size: 10px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.send-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--text-2) 35%, transparent); color: #fff; cursor: pointer; flex: none; }
.send-btn.ready { background: var(--accent-fill); }

/* ---------- Import / export / guide (kept screens) ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--card); border-radius: var(--radius-panel); padding: 14px 16px; box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--hair); display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-2); }
.dropzone { border: 2px dashed var(--hair-2); border-radius: 18px; padding: 34px 20px; text-align: center; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-active { border-color: var(--accent); background: var(--accent-soft); }
.dropzone img { width: 64px; height: 64px; }
.steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.step { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--fill-soft); color: var(--text-2); font-weight: 600; }
.step.is-active { background: var(--accent-fill); color: #fff; }
.step .n { font-weight: 800; }
.step-sep { color: var(--text-3); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.radio-card { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--hair-2); cursor: pointer; }
.radio-card:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.radio-card input { accent-color: var(--accent-fill); }
.mapper { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.issue-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.issue-list li + li { margin-top: 3px; }
.pre, pre.raw { font-family: var(--mono); font-size: 12px; background: var(--fill-soft); border-radius: 10px; padding: 10px 12px; overflow: auto; max-height: 260px; white-space: pre; margin: 0; }
.disclosure { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--hair); background: var(--card); }
.disclosure > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; }
.disclosure-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.source-badge { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.warn { color: var(--warning); }
.err { color: var(--expense); }
.error-panel { max-width: 760px; margin: 40px auto; padding: 20px; }
.guide-body h2 { font-size: 20px; margin-top: 8px; }
.guide-body h3 { font-size: 16px; margin-top: 6px; }
.guide-body p, .guide-body li { font-size: 15px; line-height: 1.55; }
.guide-body code { font-family: var(--mono); font-size: 13px; background: var(--fill-soft); padding: 1px 5px; border-radius: 5px; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; box-shadow: inset 0 -1px 0 var(--hair-2), inset 0 0 0 1px var(--hair-2); }

/* Charts */
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend-row .pct { color: var(--text-2); font-size: 12px; width: 38px; text-align: right; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 6px; }
.bars .bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar-pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.bars .bar { width: 14px; border-radius: 4px 4px 2px 2px; min-height: 2px; }
.bars .bar.in { background: var(--income); }
.bars .bar.out { background: var(--expense); }
.bars .bar-label { font-size: 11px; color: var(--text-2); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { font-size: 10px; color: var(--text-2); text-align: center; font-weight: 700; }
.cal-cell { aspect-ratio: 1; border-radius: 8px; background: var(--fill-soft); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--text-2); }
.cal-cell .v { font-size: 9px; font-weight: 700; color: var(--expense); }
.cal-cell.heat { background: color-mix(in srgb, var(--expense) calc(var(--h) * 1%), var(--fill-soft)); color: var(--text); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }

/* Photos */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; box-shadow: inset 0 0 0 1px var(--hair); background: var(--fill-soft); cursor: zoom-in; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .split-view { grid-template-columns: minmax(0, 1fr); }
  .inspector { position: static; height: auto; border-left: 0; border-top: 1px solid var(--hair); }
  .list-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-pop); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
  .mobile-menu { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 16px 16px 32px; }
  .toolbar { padding: 8px 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .search input { min-width: 0; width: 100%; }
  .toolbar .hide-sm { display: none; }
  .quick-bar-wrap { padding: 8px 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Native <dialog> (ui/dialog.mjs) */
dialog.dialog { border: 0; padding: 0; color: var(--text); }
dialog.dialog::backdrop { background: var(--overlay); }
dialog.dialog .dialog-body h2 { margin-bottom: 4px; }
dialog.dialog .dialog-body { padding-top: 18px; }

/* Guide */
.guide-body h2 { margin: 22px 0 8px; }
.guide-body ol, .guide-body ul { padding-left: 22px; margin: 8px 0; }
.guide-body li + li { margin-top: 6px; }
.guide-body table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
.guide-body th, .guide-body td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--hair-2); vertical-align: top; }
.guide-body th { font-size: 12px; color: var(--text-2); }
.guide-toc { margin-bottom: 4px; }
.guide-toc a:hover { text-decoration: none; }

/* Toolbar at phone width: the screen's own toolbar items move to a second row. */
@media (max-width: 860px) {
  .toolbar { flex-wrap: wrap; row-gap: 6px; }
  .toolbar-heading { min-width: 0; flex: 1; }
  .toolbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toolbar-center { order: 5; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .toolbar-center:empty { display: none; }
  .toolbar .spacer { display: none; }
}
