/* 月序 · YUE XU — a calm, local-first ledger */
:root {
  --bg: #f4f2ed;
  --bg-deep: #ece9e1;
  --surface: #fffefa;
  --surface-soft: #f8f6f0;
  --surface-raised: #ffffff;
  --ink: #1e211c;
  --ink-2: #4f534a;
  --muted: #777970;
  --faint: #a3a49a;
  --line: rgba(30, 33, 28, 0.075);
  --line-strong: rgba(30, 33, 28, 0.13);
  --primary: #2b5346;
  --primary-strong: #1f4035;
  --primary-soft: #e7efea;
  --primary-contrast: #f8f4ea;
  --accent: #d97757;
  --accent-soft: #f8e8e1;
  --danger: #bd5b52;
  --danger-soft: #f9e9e7;
  --good: #4c7b5e;
  --good-soft: #e8f1ea;
  --ring-track: #e9e5db;
  --chart-income: #a9c0b0;
  --hero-a: #244a3e;
  --hero-b: #3b644f;
  --hero-c: #517b61;
  --shadow-sm: 0 1px 2px rgba(36, 38, 31, 0.025), 0 8px 24px -20px rgba(36, 38, 31, 0.22);
  --shadow-md: 0 1px 2px rgba(36, 38, 31, 0.03), 0 22px 48px -30px rgba(36, 38, 31, 0.32);
  --shadow-float: 0 20px 60px -22px rgba(20, 25, 20, 0.38);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 13px;
  --sidebar: 248px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121410;
  --bg-deep: #0d0f0c;
  --surface: #1a1d18;
  --surface-soft: #20241e;
  --surface-raised: #20241e;
  --ink: #f1efe6;
  --ink-2: #c4c4b9;
  --muted: #92948a;
  --faint: #6e7168;
  --line: rgba(245, 243, 234, 0.08);
  --line-strong: rgba(245, 243, 234, 0.14);
  --primary: #6f9a83;
  --primary-strong: #86af98;
  --primary-soft: #24332a;
  --primary-contrast: #111812;
  --accent: #e08b6c;
  --accent-soft: #3a2720;
  --danger: #df7e75;
  --danger-soft: #382320;
  --good: #85ad90;
  --good-soft: #243329;
  --ring-track: #30352d;
  --chart-income: #526d5e;
  --hero-a: #1b382f;
  --hero-b: #2d5142;
  --hero-c: #416c56;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15), 0 8px 24px -20px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.2), 0 22px 48px -30px rgba(0, 0, 0, 0.7);
  --shadow-float: 0 20px 60px -22px rgba(0, 0, 0, 0.85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 650px at 88% -8%, rgba(217, 119, 87, 0.075), transparent 62%),
    radial-gradient(1000px 620px at -8% 108%, rgba(43, 83, 70, 0.075), transparent 62%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
::selection { background: rgba(217, 119, 87, 0.22); }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; padding: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; }
input, select, textarea { outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 58%, transparent);
  outline-offset: 2px;
}
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.svg-sprite symbol { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger) !important; }
.align-right { text-align: right; }
.nowrap { white-space: nowrap; }
.is-income { color: var(--good) !important; }
.is-expense { color: var(--ink) !important; }

/* ---------- Shell ---------- */
.app-shell {
  width: 100%;
  max-width: 1640px;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
}
.sidebar-top { display: flex; flex-direction: column; min-height: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  align-self: flex-start;
  text-align: left;
  padding: 0 6px;
}
.brand-mark { display: block; width: 38px; height: 38px; color: var(--primary); flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 20px; letter-spacing: 2px; font-weight: 650; }
.brand-copy em { margin-top: 6px; font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: 3.2px; color: var(--muted); }
.sidebar-add { width: 100%; margin: 30px 0 20px; height: 47px; justify-content: center; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--ink-2);
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.nav-item .icon { width: 19px; height: 19px; color: var(--muted); transition: color 160ms ease; }
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item:hover .icon { color: var(--ink-2); }
.nav-item.is-active { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 8px 20px -14px rgba(25, 57, 45, 0.65); }
.nav-item.is-active .icon { color: var(--primary-contrast); }
.nav-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.sidebar-budget {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 14px 15px 13px;
  box-shadow: var(--shadow-sm);
}
.sidebar-budget-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.sidebar-budget strong { display: block; font-size: 21px; margin-top: 8px; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.sidebar-budget strong small { font-size: 10px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.progress-track { width: 100%; height: 4px; margin-top: 11px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 600ms cubic-bezier(.2,.7,.2,1); }
.sidebar-budget p { margin: 8px 0 0; font-size: 10.5px; color: var(--muted); }
.mini-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--muted);
  transition: background 150ms ease, color 150ms ease;
}
.mini-icon .icon { width: 14px; height: 14px; }
.mini-icon:hover { background: var(--surface-soft); color: var(--ink); }
.mini-icon.bordered { border: 1px solid var(--line); background: var(--surface); }
.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 15px;
  text-align: left;
  transition: background 150ms ease;
}
.profile-chip:hover { background: var(--surface-soft); }
.profile-chip > .icon { width: 15px; height: 15px; color: var(--faint); margin-left: auto; }
.profile-copy { display: flex; flex-direction: column; min-width: 0; }
.profile-copy strong { font-size: 12.5px; font-weight: 600; }
.profile-copy em { font-style: normal; font-size: 10px; color: var(--muted); margin-top: 2px; }
.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--hero-b), var(--hero-a));
  color: #f5efe4;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.avatar.is-xl { width: 64px; height: 64px; font-size: 19px; border-radius: 22px; }
.avatar-button { border-radius: 50%; padding: 2px; transition: box-shadow 160ms ease; }
.avatar-button:hover { box-shadow: 0 0 0 3px var(--primary-soft); }

.app-main { min-width: 0; padding: 0 42px 70px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: 1160px;
  height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 58%, color-mix(in srgb, var(--bg) 0%, transparent));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.topbar-context { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.topbar-page { color: var(--ink-2); font-weight: 600; }
.context-separator { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.mobile-brand { display: none; align-items: center; gap: 8px; font-weight: 650; letter-spacing: 1px; }
.mobile-brand .brand-mark { width: 32px; height: 32px; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  transition: background 150ms ease, transform 150ms ease;
}
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-soft); transform: translateY(-1px); }
.icon-btn:disabled { opacity: 0.3; transform: none; }
.month-switcher {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.month-arrow { width: 30px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--muted); }
.month-arrow .icon { width: 15px; height: 15px; }
.month-arrow:hover:not(:disabled) { background: var(--surface-soft); color: var(--ink); }
.month-arrow:disabled { opacity: 0.25; }
.month-current {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
}
.month-current:hover { background: var(--surface-soft); }
.month-chevron { width: 12px !important; height: 12px !important; color: var(--faint); }
.month-short { display: none; }
.topbar-search { display: none; }

.page { width: 100%; max-width: 1160px; margin: 0 auto; padding-top: 22px; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.heading-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 11px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 2.2px;
  color: var(--muted);
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 0;
  font-size: clamp(30px, 3.1vw, 40px);
  line-height: 1.18;
  font-weight: 650;
  letter-spacing: -1.2px;
}
.lede { max-width: 660px; margin: 12px 0 0; font-size: 14px; line-height: 1.68; color: var(--muted); }
.heading-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.heading-pills { display: flex; gap: 8px; margin-top: 16px; }
.soft-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.soft-pill i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.soft-pill .live-dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.sample-pill { color: var(--ink-2); }
.sample-pill i { background: var(--accent); }
.sample-pill:hover { background: var(--surface); }
.dashboard-heading { margin-bottom: 0; }
.dashboard-heading .heading-pills { margin-top: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 580;
  letter-spacing: -0.05px;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.44; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 9px 22px -15px rgba(30, 65, 52, 0.7); }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-soft); color: var(--ink); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-soft); color: var(--ink); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 10%); }
.btn-dark { background: #1e211c; color: #fbf7ee; }
[data-theme="dark"] .btn-dark { background: #f1efe6; color: #151813; }
.btn-dark:hover:not(:disabled) { background: #10130f; }
[data-theme="dark"] .btn-dark:hover:not(:disabled) { background: #fffdf4; }
.btn-danger { background: var(--danger); color: #fff9f7; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { height: 35px; padding: 0 13px; border-radius: 11px; font-size: 12px; }
.btn-sm .icon { width: 14px; height: 14px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; transition: color 150ms ease; }
.text-link .icon { width: 13px; height: 13px; }
.text-link:hover { color: var(--ink); }

/* ---------- Dashboard ---------- */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 20px; margin-top: 28px; }
.spend-hero {
  position: relative;
  min-height: 304px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #f8f4e9;
  background:
    linear-gradient(90deg, rgba(17, 36, 25, 0.74) 0%, rgba(17, 36, 25, 0.44) 46%, rgba(17, 36, 25, 0.06) 100%),
    linear-gradient(180deg, rgba(8, 20, 12, 0.12) 0%, rgba(8, 20, 12, 0) 38%, rgba(8, 20, 12, 0.36) 100%),
    url("../assets/hero-daisies.webp") center 58% / cover no-repeat;
  box-shadow: 0 26px 58px -36px rgba(28, 57, 45, 0.8);
  isolation: isolate;
}
.spend-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 95% at 92% 4%, rgba(255, 238, 183, 0.34), transparent 62%),
    radial-gradient(90% 120% at 100% 100%, rgba(255, 206, 150, 0.16), transparent 58%);
  z-index: -1;
  pointer-events: none;
}
.hero-glow {
  display: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; letter-spacing: 0.5px; color: rgba(248, 244, 233, 0.72); }
.hero-label i { width: 6px; height: 6px; border-radius: 50%; background: #efb08f; box-shadow: 0 0 0 4px rgba(239, 176, 143, 0.13); }
.hero-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 10.5px;
  font-weight: 600;
  color: #f1c1a9;
  backdrop-filter: blur(8px);
}
.hero-change .icon { width: 12px; height: 12px; }
.hero-change em { font-style: normal; margin-left: 2px; font-size: 9px; font-weight: 450; opacity: 0.58; }
.hero-change.is-good { color: #bde0c7; }
.hero-change.is-high { color: #f4b9a2; }
.hero-amount { display: flex; align-items: baseline; margin: 27px 0 10px; line-height: 0.95; font-variant-numeric: tabular-nums; letter-spacing: -3px; }
.hero-amount .currency { font-size: 27px; font-weight: 470; margin-right: 7px; opacity: 0.68; letter-spacing: 0; }
.hero-amount strong { font-size: clamp(48px, 5.2vw, 68px); font-weight: 590; }
.hero-amount .decimal { font-size: clamp(22px, 2.4vw, 31px); font-weight: 470; opacity: 0.55; margin-left: 2px; letter-spacing: -1px; }
.hero-subline { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: rgba(248, 244, 233, 0.58); }
.spend-hero .hero-amount, .spend-hero .hero-label, .spend-hero .hero-stat strong { text-shadow: 0 1px 14px rgba(8, 18, 12, 0.38); }
.hero-dot { width: 3px; height: 3px; border-radius: 50%; background: rgba(248, 244, 233, 0.38); }
.hero-bottom { display: flex; align-items: flex-end; gap: 28px; margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.11); }
.hero-stat { display: flex; flex-direction: column; gap: 5px; }
.hero-stat span { font-size: 10px; letter-spacing: 0.3px; color: rgba(248, 244, 233, 0.5); }
.hero-stat strong { font-size: 14px; font-weight: 560; font-variant-numeric: tabular-nums; }
.hero-spark { width: 36%; max-width: 260px; margin-left: auto; opacity: 0.82; }
.sparkline { width: 100%; height: 58px; overflow: visible; filter: drop-shadow(0 1px 2px rgba(8, 18, 12, 0.35)); }
.budget-card {
  display: flex;
  flex-direction: column;
  padding: 25px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.budget-head, .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-kicker { margin: 0 0 6px; font-size: 8.5px; line-height: 1.2; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); }
.budget-head h3, .panel-head h3 { margin: 0; font-size: 18px; font-weight: 630; letter-spacing: -0.3px; }
.budget-body { display: flex; align-items: center; gap: 20px; margin: 24px 0 20px; }
.budget-ring {
  position: relative;
  width: 126px;
  height: 126px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--ring-track) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 700ms ease;
}
.budget-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.budget-ring.is-over { background: conic-gradient(var(--danger) calc(var(--pct) * 1%), var(--ring-track) 0); }
.budget-ring-inner { position: relative; z-index: 1; display: flex; align-items: baseline; flex-direction: column; align-items: center; }
.budget-ring-inner strong { font-size: 30px; line-height: 1; font-weight: 620; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.budget-ring-inner strong small { font-size: 12px; font-weight: 500; margin-left: 1px; color: var(--muted); }
.budget-ring-inner span { margin-top: 6px; font-size: 9px; color: var(--muted); letter-spacing: 0.5px; }
.budget-copy { min-width: 0; display: flex; flex-direction: column; }
.budget-copy > span { font-size: 10.5px; color: var(--muted); }
.budget-copy > strong { margin-top: 4px; font-size: 22px; font-weight: 610; letter-spacing: -0.7px; font-variant-numeric: tabular-nums; }
.budget-copy p { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 10.5px; color: var(--muted); }
.budget-copy p i { width: 5px; height: 5px; border-radius: 50%; }
.budget-copy p i.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.budget-copy p i.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.budget-footer { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; color: var(--muted); }
.budget-footer span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.budget-footer b { font-size: 12px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.budget-footer b.text-danger { color: var(--danger); }

.quick-capture {
  position: relative;
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(380px, 1.18fr);
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  padding: 21px 23px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(520px 120px at 8% 0%, rgba(217, 119, 87, 0.06), transparent 70%),
    linear-gradient(110deg, color-mix(in srgb, var(--primary-soft) 44%, var(--surface)), var(--surface) 62%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.quick-capture::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -70px;
  top: -90px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 30px color-mix(in srgb, var(--primary) 3%, transparent), 0 0 0 60px color-mix(in srgb, var(--primary) 2%, transparent);
  pointer-events: none;
}
.qc-intro { display: flex; align-items: flex-start; gap: 14px; }
.qc-icon { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 15px; color: #f2d7b1; background: linear-gradient(145deg, var(--hero-b), var(--hero-a)); box-shadow: 0 9px 20px -12px rgba(35, 69, 55, 0.8); }
.qc-icon .icon { width: 22px; height: 22px; }
.qc-kicker { margin: 0 0 4px; font-size: 8px; font-weight: 700; letter-spacing: 1.7px; color: var(--muted); }
.qc-intro h2 { margin: 0; font-size: 19px; font-weight: 630; letter-spacing: -0.35px; }
.qc-intro p:last-child { margin: 6px 0 0; font-size: 11px; line-height: 1.55; color: var(--muted); }
.qc-form { position: relative; z-index: 1; }
.qc-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 5px 5px 5px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 6px 16px -14px rgba(30, 33, 28, 0.3);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.qc-input-row:focus-within { border-color: color-mix(in srgb, var(--primary) 42%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 8%, transparent); }
.qc-input-icon { color: var(--accent); display: flex; }
.qc-input-icon .icon { width: 16px; height: 16px; }
.qc-input-row input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13.5px; }
.qc-submit { height: 42px; padding: 0 14px; border-radius: 11px; font-size: 12px; }
.qc-submit .icon { width: 14px; height: 14px; }
.qc-examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-left: 2px; }
.qc-examples > span { font-size: 9.5px; color: var(--faint); margin-right: 1px; }
.qc-examples button { padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--surface) 64%, transparent); font-size: 9.5px; color: var(--muted); transition: background 150ms ease, color 150ms ease; }
.qc-examples button:hover { background: var(--surface); color: var(--ink-2); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 20px; margin-top: 20px; }
.panel {
  padding: 23px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.category-overview { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 15px; }
.donut-shell { position: relative; width: var(--donut-size, 190px); height: var(--donut-size, 190px); flex: none; margin: 0 auto; }
.donut { width: 100%; height: 100%; overflow: visible; }
.donut-segment { transition: opacity 180ms ease; }
.donut-segment:hover { opacity: 0.72; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-eyebrow { font-size: 9px; color: var(--muted); letter-spacing: 0.5px; }
.donut-center strong { margin-top: 4px; font-size: 23px; font-weight: 620; letter-spacing: -0.9px; font-variant-numeric: tabular-nums; }
.donut-sub { margin-top: 4px; font-size: 9px; color: var(--faint); }
.category-legend { display: flex; flex-direction: column; gap: 1px; }
.category-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 41px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
  transition: background 130ms ease;
}
.category-legend-row:last-of-type { border-bottom: 0; }
.category-legend-row:hover { background: var(--surface-soft); }
.legend-name { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); min-width: 0; }
.legend-name i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.legend-amount { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.legend-percent { font-size: 10px; text-align: right; color: var(--faint); font-variant-numeric: tabular-nums; }
.legend-more { margin: 8px 4px 0; font-size: 9.5px; color: var(--faint); line-height: 1.5; }
.recent-list { display: flex; flex-direction: column; margin-top: 9px; }
.transaction-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 4px;
  border-radius: 13px;
  text-align: left;
  transition: background 150ms ease, padding 150ms ease;
}
.transaction-row:hover { background: var(--surface-soft); }
.transaction-row + .transaction-row { border-top: 1px solid var(--line); border-radius: 0 0 13px 13px; }
.transaction-main { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.transaction-note { font-size: 12.5px; font-weight: 540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaction-meta { font-size: 9.5px; color: var(--muted); letter-spacing: 0.1px; }
.transaction-amount { font-size: 13px; font-weight: 570; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.transaction-amount.is-income { color: var(--good); }
.cat-badge {
  width: 39px;
  height: 39px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--cat);
  background: color-mix(in srgb, var(--cat) 11%, transparent);
}
.cat-badge .icon { width: 18px; height: 18px; }
.cat-badge.is-large { width: 58px; height: 58px; border-radius: 19px; }
.cat-badge.is-large .icon { width: 26px; height: 26px; }
.recent-panel .transaction-row { padding: 9px 2px; }
.recent-panel .cat-badge { width: 36px; height: 36px; border-radius: 12px; }
.recent-panel .cat-badge .icon { width: 16px; height: 16px; }

/* ---------- Empty / lists ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 36px 20px; min-height: 220px; }
.empty-state.is-compact { min-height: 160px; padding: 24px 12px; }
.empty-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--surface-soft); color: var(--muted); margin-bottom: 13px; }
.empty-icon .icon { width: 21px; height: 21px; }
.empty-state h3 { margin: 0; font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 280px; margin: 6px 0 16px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.empty-state .btn { margin-top: 2px; }

/* ---------- Ledger ---------- */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.metric-item { display: flex; flex-direction: column; gap: 5px; padding: 18px 22px; min-width: 0; }
.metric-item + .metric-item { border-left: 1px solid var(--line); }
.metric-label { font-size: 10px; color: var(--muted); letter-spacing: 0.2px; }
.metric-value { font-size: 22px; line-height: 1.22; font-weight: 610; letter-spacing: -0.7px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value.is-income { color: var(--good); }
.metric-sub { font-size: 9.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-toolbar { display: flex; align-items: center; gap: 11px; margin: 23px 0 12px; }
.search-field {
  flex: 1;
  min-width: 150px;
  max-width: 430px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-field:focus-within { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 7%, transparent); }
.search-field .icon { width: 16px; height: 16px; color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 12.5px; }
.search-clear { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); }
.search-clear:hover { background: var(--surface-soft); }
.search-clear.is-hidden { display: none; }
.search-clear .icon { width: 12px; height: 12px; }
.type-filter { display: flex; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.type-filter-btn { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 11.5px; color: var(--muted); transition: background 150ms ease, color 150ms ease; }
.type-filter-btn.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.result-count { margin-left: auto; font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.filter-scroll { display: flex; gap: 7px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.filter-chip .icon { width: 13px; height: 13px; }
.filter-chip:hover { background: var(--surface); color: var(--ink-2); }
.filter-chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ledger-list { margin-top: 7px; }
.date-group { margin-top: 18px; }
.date-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.date-title { display: flex; align-items: center; gap: 7px; }
.date-title strong { font-size: 13px; font-weight: 600; }
.date-title > span { font-size: 10px; color: var(--muted); }
.date-title em { font-style: normal; padding: 2px 6px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: 8.5px; font-weight: 600; }
.date-total { display: flex; gap: 9px; font-size: 9.5px; color: var(--faint); }
.date-total .is-income { color: var(--good); }
.transaction-list { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 5px 18px; box-shadow: var(--shadow-sm); }
.transaction-list .transaction-row { padding: 11px 2px; border-radius: 0; }
.transaction-list .transaction-row:hover { background: transparent; padding-left: 6px; padding-right: 6px; }
.transaction-list .transaction-row + .transaction-row { border-top: 1px solid var(--line); }
.transaction-list .transaction-note { font-size: 13px; }
.transaction-list .cat-badge { width: 41px; height: 41px; }
.transaction-list .transaction-amount { font-size: 14px; }

/* ---------- Stats ---------- */
.insight-banner {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
  padding: 18px 21px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
  border-radius: 21px;
  background:
    radial-gradient(380px 100px at 0% 0%, rgba(217, 119, 87, 0.07), transparent 70%),
    linear-gradient(110deg, var(--primary-soft), color-mix(in srgb, var(--surface) 82%, var(--primary-soft)));
}
.insight-icon { width: 37px; height: 37px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary); color: var(--primary-contrast); }
.insight-icon .icon { width: 17px; height: 17px; }
.insight-copy { min-width: 0; }
.insight-copy > strong { display: block; font-size: 12px; font-weight: 630; margin-bottom: 4px; }
.insight-items { display: flex; flex-wrap: wrap; gap: 7px 18px; }
.insight-items span { position: relative; font-size: 11px; color: var(--muted); }
.insight-items span + span::before { content: ""; position: absolute; left: -9px; top: 6px; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.stats-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.stats-panel { min-height: 290px; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.panel-note { font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.comparison-chart { display: grid; grid-template-columns: minmax(0, 1fr) 36px; grid-template-rows: auto minmax(0, 1fr); gap: 7px 8px; margin-top: 15px; }
.comparison-legend { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 14px; font-size: 9.5px; color: var(--muted); }
.comparison-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 6px; height: 6px; border-radius: 2px; display: inline-block; }
.legend-dot.expense { background: var(--primary); }
.legend-dot.income { background: var(--chart-income); }
.comparison-plot { position: relative; min-height: 200px; height: 200px; display: flex; align-items: flex-end; justify-content: space-around; gap: 4px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.comparison-grid { position: absolute; inset: 10px 0 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.comparison-grid span { border-top: 1px dashed var(--line); }
.comparison-group { position: relative; z-index: 1; height: 100%; flex: 1; max-width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.comparison-bars { height: calc(100% - 22px); width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.chart-bar { width: 15px; max-width: 36%; position: relative; border-radius: 5px 5px 2px 2px; transition: filter 150ms ease; }
.chart-bar.income { background: var(--chart-income); }
.chart-bar.expense { background: var(--primary); opacity: 0.9; }
.comparison-group.is-current .chart-bar.expense { background: var(--accent); opacity: 1; }
.comparison-group.is-current .comparison-label { color: var(--ink); font-weight: 650; }
.chart-bar:hover { filter: brightness(1.08); }
.bar-tooltip { position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%) translateY(2px); padding: 5px 7px; border-radius: 7px; background: var(--ink); color: var(--bg); font-size: 8.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 130ms ease, transform 130ms ease; z-index: 3; }
.chart-bar:hover .bar-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }
.comparison-label { height: 22px; padding-top: 7px; font-size: 9.5px; color: var(--muted); }
.comparison-scale { height: 200px; padding: 10px 0 22px; display: flex; flex-direction: column; justify-content: space-between; font-size: 8.5px; color: var(--faint); text-align: right; }
.stats-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }
.stats-donut-wrap .donut-center strong { font-size: 20px; }
.mini-legend { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 2px; }
.mini-legend > div { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 9.5px; color: var(--muted); }
.mini-legend i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.mini-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-legend b { margin-left: auto; font-weight: 550; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.daily-chart { margin-top: 19px; }
.daily-plot { position: relative; height: 170px; border-bottom: 1px solid var(--line); }
.daily-bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--bar-count), minmax(0, 1fr)); gap: 4px; align-items: end; }
.daily-bar-wrap { position: relative; height: 100%; display: flex; align-items: flex-end; }
.daily-bar { width: 100%; background: var(--primary); opacity: 0.22; border-radius: 3px 3px 0 0; transition: opacity 150ms ease, background 150ms ease; }
.daily-bar.has-value { opacity: 0.82; }
.daily-bar-wrap.is-today .daily-bar { background: var(--accent); opacity: 1; }
.daily-bar-wrap:hover .daily-bar { opacity: 1; }
.daily-average { position: absolute; left: 0; right: 0; z-index: 2; border-top: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); pointer-events: none; }
.daily-average span { position: absolute; right: 0; top: -15px; padding-left: 5px; background: var(--surface); font-size: 8px; color: var(--accent); }
.daily-tooltip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 6px; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: 8px; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 3; }
.daily-bar-wrap:hover .daily-tooltip { opacity: 1; }
.daily-labels { display: grid; grid-template-columns: repeat(var(--bar-count), minmax(0, 1fr)); gap: 4px; margin-top: 7px; font-size: 8px; color: var(--faint); text-align: center; }
.daily-labels span.is-today { color: var(--accent); font-weight: 700; }
.ranking-list { display: flex; flex-direction: column; gap: 11px; margin-top: 19px; }
.ranking-row { display: grid; grid-template-columns: 68px minmax(0, 1fr) 56px 31px; gap: 9px; align-items: center; }
.ranking-name { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.ranking-name i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.ranking-track { height: 4px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.ranking-track span { display: block; height: 100%; border-radius: inherit; }
.ranking-amount { text-align: right; font-size: 10px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ranking-percent { text-align: right; font-size: 9px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- Import ---------- */
.import-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 34px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(500px 200px at 0% 0%, rgba(217, 119, 87, 0.07), transparent 65%),
    linear-gradient(115deg, color-mix(in srgb, var(--primary-soft) 34%, var(--surface)), var(--surface) 66%);
  box-shadow: var(--shadow-sm);
}
.import-hero-copy { display: flex; flex-direction: column; justify-content: center; }
.import-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--surface) 64%, transparent); font-size: 9.5px; color: var(--muted); }
.import-badge .icon { width: 12px; height: 12px; color: var(--good); }
.import-hero h2 { max-width: 540px; margin: 16px 0 12px; font-size: clamp(27px, 2.7vw, 35px); line-height: 1.24; letter-spacing: -1px; font-weight: 640; }
.import-hero p { max-width: 520px; margin: 0; font-size: 12px; line-height: 1.72; color: var(--muted); }
.import-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 24px; }
.import-support { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.import-support span { padding: 3px 7px; border-radius: 5px; background: var(--surface-soft); font-size: 8.5px; color: var(--faint); }
.drop-zone {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 26px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 28%, var(--line-strong));
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--primary); background: var(--surface); transform: translateY(-2px); }
.drop-icon { width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; border-radius: 19px; background: var(--primary-soft); color: var(--primary); margin-bottom: 6px; }
.drop-icon .icon { width: 25px; height: 25px; }
.drop-zone strong { font-size: 12.5px; font-weight: 600; }
.drop-zone > span:not(.drop-icon) { font-size: 9.5px; color: var(--muted); letter-spacing: 1px; }
.drop-zone em { font-style: normal; margin-top: 12px; font-size: 9px; color: var(--faint); }
.import-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--line); overflow: hidden; }
.import-steps > div { padding: 21px 23px; background: var(--surface); }
.import-steps span { display: block; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 8px; }
.import-steps strong { font-size: 12.5px; font-weight: 620; }
.import-steps p { margin: 6px 0 0; font-size: 10.5px; line-height: 1.6; color: var(--muted); }
.import-tip { display: flex; gap: 14px; align-items: flex-start; }
.tip-icon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.tip-icon .icon { width: 16px; height: 16px; }
.import-tip strong { font-size: 12px; }
.import-tip p { margin: 4px 0 0; font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.import-loading { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.import-loading h3 { margin: 18px 0 5px; font-size: 17px; }
.import-loading p { margin: 0; font-size: 11px; color: var(--muted); }
.import-error-card { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); }
.error-icon { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 17px; background: var(--danger-soft); color: var(--danger); }
.error-icon .icon { width: 23px; height: 23px; }
.import-error-card h3 { margin: 15px 0 5px; font-size: 18px; }
.import-error-card p { margin: 0; max-width: 440px; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.error-actions { display: flex; gap: 9px; margin-top: 20px; }
.import-summary-card { display: flex; align-items: center; gap: 14px; padding: 19px 22px; }
.import-file-icon { width: 43px; height: 43px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--primary-soft); color: var(--primary); flex: none; }
.import-file-icon .icon { width: 19px; height: 19px; }
.import-file-copy { min-width: 0; flex: 1; }
.import-file-copy h3 { margin: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-file-copy p { margin: 4px 0 0; font-size: 10px; color: var(--muted); }
.import-summary-total { text-align: right; flex: none; }
.import-summary-total span { display: block; font-size: 9px; color: var(--muted); }
.import-summary-total strong { display: block; margin-top: 3px; font-size: 18px; font-weight: 620; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.import-warning { display: flex; align-items: flex-start; gap: 8px; margin: 13px 0; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-radius: 12px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 75%, var(--ink)); font-size: 10px; line-height: 1.55; }
.import-warning .icon { width: 14px; height: 14px; margin-top: 1px; flex: none; }
.import-table-panel { padding: 0; overflow: hidden; }
.import-table-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); }
.import-table-scroll { overflow-x: auto; }
.import-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.import-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 8.5px; font-weight: 650; letter-spacing: 0.7px; color: var(--faint); text-transform: uppercase; }
.import-table th:first-child { padding-left: 20px; width: 38px; }
.import-table th:last-child { padding-right: 20px; }
.import-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.import-table td:first-child { padding-left: 20px; }
.import-table td:last-child { padding-right: 20px; }
.import-table tr:last-child td { border-bottom: 0; }
.import-table tr.is-duplicate { opacity: 0.55; }
.import-table tr.is-selected { background: color-mix(in srgb, var(--primary-soft) 30%, transparent); }
.import-table td small { display: block; margin-top: 3px; font-size: 8.5px; color: var(--faint); }
.import-note { display: block; max-width: 270px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; color: var(--ink-2); }
.import-table .amount { font-weight: 570; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inline-select { max-width: 110px; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 9.5px; color: var(--ink-2); }
.import-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 50%, var(--surface)); }
.import-footer > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 5px; font-size: 9.5px; color: var(--muted); }
.import-footer strong { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.import-footer strong#import-count { font-size: 17px; color: var(--ink); }
.import-footer .btn { flex: none; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.settings-panel { min-width: 0; }
.span-2 { grid-column: span 2; }
.profile-panel { display: flex; flex-direction: column; gap: 20px; }
.profile-hero { display: flex; align-items: center; gap: 15px; }
.profile-hero h3 { margin: 0; font-size: 20px; letter-spacing: -0.4px; }
.profile-hero > div span { display: block; margin-top: 4px; font-size: 9.5px; color: var(--muted); }
.settings-form { display: flex; align-items: flex-end; gap: 10px; }
.settings-form .field { flex: 1; }
.budget-form { margin-top: 19px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.budget-input { width: 100%; height: 54px; display: flex; flex-direction: row; align-items: baseline; gap: 4px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.budget-input > span { font-size: 17px; color: var(--muted); }
.budget-input input { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 25px; font-weight: 610; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; }
.budget-input em { font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; }
.form-hint { margin: 0; font-size: 9.5px; color: var(--faint); }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.theme-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 11px;
  color: var(--muted);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}
.theme-option:hover { border-color: var(--line-strong); }
.theme-option.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); }
.theme-option > i { margin-left: auto; width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); }
.theme-option > i .icon { width: 10px; height: 10px; }
.theme-swatch { width: 33px; height: 33px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); }
.theme-swatch .icon { width: 15px; height: 15px; }
.theme-swatch.light { background: #faf7f0; color: #7c735f; }
.theme-swatch.dark { background: #22261f; color: #d8d6c8; border-color: rgba(255,255,255,.1); }
.theme-swatch.auto { background: linear-gradient(135deg, #faf7f0 50%, #22261f 50%); color: var(--muted); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-top: 1px solid var(--line); }
.settings-row:first-of-type { border-top: 0; margin-top: 9px; }
.settings-row-copy { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.settings-row-icon { width: 33px; height: 33px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-soft); color: var(--muted); }
.settings-row-icon .icon { width: 15px; height: 15px; }
.settings-row-copy strong { display: block; font-size: 11.5px; font-weight: 600; }
.settings-row-copy p { margin: 3px 0 0; font-size: 9.5px; color: var(--muted); line-height: 1.5; }
.settings-row-actions { display: flex; gap: 5px; flex: none; }
.danger-row .settings-row-icon { background: var(--danger-soft); color: var(--danger); }
.danger-row .settings-row-copy strong { color: var(--danger); }
.about-panel { display: flex; flex-direction: column; gap: 12px; }
.about-brand { display: flex; align-items: center; gap: 10px; }
.about-brand .brand-mark { width: 34px; height: 34px; }
.about-brand strong { display: block; font-size: 14px; letter-spacing: 1px; }
.about-brand em { font-style: normal; font-size: 8px; letter-spacing: 1.4px; color: var(--muted); }
.about-panel > p { margin: 0; max-width: 640px; font-size: 10.5px; line-height: 1.7; color: var(--muted); }
.about-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.privacy-line { display: flex; align-items: center; gap: 5px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 9px; color: var(--faint); }
.privacy-line .icon { width: 12px; height: 12px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 9.5px; color: var(--muted); letter-spacing: 0.2px; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  font-size: 12px;
  transition: border-color 150ms ease, background 150ms ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: color-mix(in srgb, var(--primary) 42%, var(--line)); background: var(--surface); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(130px, .8fr) minmax(100px, .65fr); gap: 10px; margin-top: 19px; }
.form-grid .field.compact { min-width: 0; }

/* ---------- Modal / sheet ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 16, 12, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 180ms ease;
}
.modal-backdrop.is-open { opacity: 1; }
.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--line-strong) 68%, transparent);
  border-radius: 27px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform: translateY(14px) scale(0.982);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease;
  overflow: hidden;
}
.modal-backdrop.is-open .sheet { transform: translateY(0) scale(1); opacity: 1; }
.sheet-add { width: min(620px, calc(100vw - 32px)); }
.sheet-smart { width: min(670px, calc(100vw - 32px)); }
.sheet-photo { width: min(850px, calc(100vw - 32px)); }
.sheet-detail { width: min(480px, calc(100vw - 32px)); }
.sheet-image { width: min(720px, calc(100vw - 32px)); }
.sheet-month { width: min(450px, calc(100vw - 32px)); }
.sheet-confirm { width: min(420px, calc(100vw - 32px)); }
.sheet-budget { width: min(430px, calc(100vw - 32px)); }
.sheet-small { width: min(430px, calc(100vw - 32px)); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 25px 27px 0; flex: none; }
.sheet-kicker { margin: 0 0 5px; font-size: 8px; font-weight: 700; letter-spacing: 1.7px; color: var(--muted); }
.sheet-head h2 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 640; letter-spacing: -0.65px; }
.sheet-subtitle { margin: 6px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.55; }
.sheet-close { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-soft); color: var(--muted); transition: background 150ms ease, color 150ms ease; }
.sheet-close:hover { background: var(--ring-track); color: var(--ink); }
.sheet-close .icon { width: 15px; height: 15px; }
.sheet-body { padding: 18px 27px 24px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-body::-webkit-scrollbar { width: 8px; }
.sheet-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.sheet-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 15px 27px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.sheet-footer .btn-primary { min-width: 130px; }

/* Add sheet */
.add-smart {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 6px 6px 11px;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line));
  border-radius: 13px;
  background: var(--primary-soft);
}
.add-smart-icon { color: var(--primary); display: flex; }
.add-smart-icon .icon { width: 15px; height: 15px; }
.add-smart input { flex: 1; min-width: 0; height: 32px; border: 0; background: transparent; font-size: 11.5px; }
.add-type-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 19px 0 5px; }
.segmented { display: flex; padding: 3px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--line); }
.seg-btn { height: 31px; padding: 0 17px; border-radius: 8px; font-size: 11.5px; color: var(--muted); transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease; }
.seg-btn.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 2px 5px rgba(20, 23, 18, 0.06); }
.add-date-chip { font-size: 9.5px; color: var(--faint); }
.amount-field { display: flex; align-items: baseline; gap: 7px; margin: 8px 0 8px; padding: 10px 0 2px; border-bottom: 1px solid var(--line); }
.amount-field > span { font-size: 25px; font-weight: 480; color: var(--muted); }
.amount-field input { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 52px; line-height: 1.1; font-weight: 590; letter-spacing: -2.2px; font-variant-numeric: tabular-nums; }
.amount-field input.is-filled { animation: amountPop 400ms ease; }
@keyframes amountPop { 50% { color: var(--accent); transform: translateY(-1px); } }
.add-section { margin-top: 16px; }
.section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.section-label span { font-size: 10px; color: var(--ink-2); font-weight: 560; }
.section-label em { font-style: normal; font-size: 9px; color: var(--faint); }
.cat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cat-option { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 3px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 9.5px; color: var(--muted); transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease; }
.cat-option:hover { border-color: color-mix(in srgb, var(--cat) 40%, var(--line)); color: var(--ink-2); }
.cat-option.is-active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 9%, var(--surface)); color: var(--ink); }
.cat-option-icon { width: 27px; height: 27px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: color-mix(in srgb, var(--cat) 10%, transparent); color: var(--cat); }
.cat-option-icon .icon { width: 15px; height: 15px; }
.add-photo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.photo-entry { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); text-align: left; transition: background 150ms ease, border-color 150ms ease; }
.photo-entry:hover { background: var(--surface); border-color: var(--line-strong); }
.photo-entry > span:first-child { width: 31px; height: 31px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--surface); color: var(--primary); }
.photo-entry > span:first-child .icon { width: 15px; height: 15px; }
.photo-entry > div { min-width: 0; flex: 1; }
.photo-entry strong { display: block; font-size: 10.5px; font-weight: 600; }
.photo-entry small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-entry > .icon { width: 13px; height: 13px; color: var(--faint); }
.edit-receipt-note { display: flex; align-items: center; gap: 6px; margin-top: 16px; padding: 9px 11px; border-radius: 10px; background: var(--surface-soft); font-size: 9.5px; color: var(--muted); }
.edit-receipt-note .icon { width: 13px; height: 13px; }

/* Smart sheet */
.smart-capture-box { display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 13px; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.smart-capture-icon { color: var(--accent); display: flex; }
.smart-capture-icon .icon { width: 17px; height: 17px; }
.smart-capture-box input { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; font-size: 13px; }
.smart-hint-line { display: flex; align-items: center; gap: 4px; margin: 8px 1px 0; font-size: 8.5px; color: var(--faint); }
.smart-hint-line .icon { width: 11px; height: 11px; }
.smart-empty { padding: 28px 0 4px; text-align: center; }
.smart-orbit { position: relative; width: 64px; height: 64px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.smart-orbit::before, .smart-orbit::after { content: ""; position: absolute; border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent); border-radius: 50%; }
.smart-orbit::before { inset: -9px; }
.smart-orbit::after { inset: -19px; opacity: 0.6; }
.smart-orbit .icon { width: 25px; height: 25px; }
.smart-empty h3 { margin: 0; font-size: 19px; letter-spacing: -0.4px; }
.smart-empty > p { max-width: 410px; margin: 7px auto 17px; font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.smart-example-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.smart-example-grid button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-soft); font-size: 9.5px; color: var(--muted); transition: background 140ms ease, color 140ms ease; }
.smart-example-grid button:hover { background: var(--surface); color: var(--ink-2); }
.inline-error { display: flex; align-items: flex-start; gap: 6px; margin: 12px 0 0; padding: 9px 11px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 9.5px; line-height: 1.5; }
.inline-error .icon { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.smart-results { margin-top: 18px; }
.smart-results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.smart-results-head > div { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); }
.smart-results-head strong { font-size: 11.5px; color: var(--ink); }
.result-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.smart-results-head > b { font-size: 16px; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.smart-list { display: flex; flex-direction: column; gap: 7px; }
.smart-item { display: grid; grid-template-columns: auto minmax(0, 1fr) 94px auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.smart-item-badge { width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; border-radius: 11px; color: var(--cat); background: color-mix(in srgb, var(--cat) 11%, transparent); flex: none; }
.smart-item-badge .icon { width: 16px; height: 16px; }
.smart-item-main { min-width: 0; }
.smart-note-input { width: 100%; height: 23px; border: 0; background: transparent; font-size: 11.5px; font-weight: 560; padding: 0; }
.smart-item-meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.smart-select { height: 20px; max-width: 86px; border: 0; background: transparent; padding: 0 2px; font-size: 8.5px; color: var(--muted); }
.smart-type { padding: 1px 4px; border-radius: 4px; background: var(--surface); font-size: 7.5px; color: var(--muted); }
.smart-type.is-income { color: var(--good); background: var(--good-soft); }
.smart-date-input { width: 96px; height: 20px; border: 0; background: transparent; padding: 0; font-size: 8.5px; color: var(--muted); }
.smart-amount { display: flex; align-items: baseline; gap: 1px; border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }
.smart-amount span { font-size: 10px; color: var(--muted); }
.smart-amount input { width: 70px; border: 0; background: transparent; text-align: right; font-size: 13px; font-weight: 570; font-variant-numeric: tabular-nums; }
.smart-remove { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--faint); }
.smart-remove:hover { background: var(--danger-soft); color: var(--danger); }
.smart-remove .icon { width: 12px; height: 12px; }
.smart-unparsed { margin: 8px 2px 0; font-size: 8.5px; color: var(--faint); line-height: 1.5; }
.smart-add-more { margin-top: 10px; margin-left: 1px; }

/* Photo */
.photo-layout { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 24px; align-items: start; }
.photo-preview { position: relative; min-height: 300px; max-height: 470px; display: flex; align-items: center; justify-content: center; border-radius: 17px; overflow: hidden; background: #171b16; }
.photo-preview img { width: 100%; height: 100%; max-height: 470px; object-fit: contain; }
.photo-preview.result img { border-radius: 15px; }
.photo-saved-pill { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 99px; background: rgba(12, 16, 12, 0.64); backdrop-filter: blur(8px); color: #e9f0e7; font-size: 8.5px; }
.photo-saved-pill .icon { width: 11px; height: 11px; }
.photo-error-pill { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 99px; background: rgba(80, 25, 25, 0.72); backdrop-filter: blur(8px); color: #f8e0dd; font-size: 8.5px; }
.photo-error-pill .icon { width: 11px; height: 11px; }
.photo-corner { position: absolute; width: 17px; height: 17px; border-color: rgba(244, 235, 212, 0.7); border-style: solid; }
.photo-corner.tl { top: 11px; left: 11px; border-width: 1px 0 0 1px; }
.photo-corner.tr { top: 11px; right: 11px; border-width: 1px 1px 0 0; }
.photo-corner.bl { bottom: 11px; left: 11px; border-width: 0 0 1px 1px; }
.photo-corner.br { bottom: 11px; right: 11px; border-width: 0 1px 1px 0; }
.scan-line { position: absolute; left: 8%; right: 8%; height: 1px; background: linear-gradient(90deg, transparent, rgba(240, 183, 143, 0.95), transparent); box-shadow: 0 0 18px rgba(240, 183, 143, 0.6); animation: scan 2.4s cubic-bezier(.4,0,.6,1) infinite; }
@keyframes scan { 0%, 100% { top: 12%; opacity: 0.35; } 50% { top: 86%; opacity: 1; } }
.photo-loading-copy { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 12px; }
.photo-loading-copy h3 { margin: 17px 0 4px; font-size: 18px; }
.photo-loading-copy p { margin: 0; font-size: 10.5px; color: var(--muted); }
.photo-loading-copy small { max-width: 280px; margin-top: 12px; font-size: 8.5px; line-height: 1.6; color: var(--faint); }
.ocr-progress { width: min(250px, 100%); height: 3px; margin-top: 15px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.ocr-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 300ms ease; }
.photo-form { display: flex; flex-direction: column; }
.photo-success-line { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 9px; background: var(--good-soft); color: var(--good); font-size: 9.5px; }
.photo-success-line .icon { width: 13px; height: 13px; }
.photo-amount-label { display: flex; align-items: baseline; gap: 4px; margin: 15px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.photo-amount-label span { font-size: 22px; color: var(--muted); }
.photo-amount-label input { width: 100%; border: 0; background: transparent; font-size: 44px; font-weight: 590; letter-spacing: -1.8px; font-variant-numeric: tabular-nums; }
.photo-fields { grid-template-columns: 1fr 1fr; margin-top: 15px; }
.photo-fields .field:nth-child(1) { grid-column: span 2; }
.photo-fields .field:nth-child(5) { grid-column: span 2; }
.ocr-text-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.ocr-text-details summary { cursor: pointer; font-size: 9px; color: var(--muted); list-style: none; }
.ocr-text-details summary::-webkit-details-marker { display: none; }
.ocr-text-details summary::before { content: "+"; display: inline-block; margin-right: 5px; }
.ocr-text-details[open] summary::before { content: "−"; }
.ocr-text-details pre { max-height: 130px; margin: 8px 0 0; padding: 10px; overflow: auto; border-radius: 8px; background: var(--surface-soft); font-family: "SF Mono", "Menlo", monospace; font-size: 8px; line-height: 1.6; color: var(--muted); white-space: pre-wrap; }
.photo-tip { display: flex; align-items: flex-start; gap: 4px; margin: 13px 0 0; font-size: 8px; line-height: 1.5; color: var(--faint); }
.photo-tip .icon { width: 11px; height: 11px; flex: none; }
.spinner { width: 22px; height: 22px; display: inline-block; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; }
.spinner.large { width: 36px; height: 36px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Detail */
.detail-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 18px; }
.detail-category { margin-top: 11px; font-size: 9.5px; color: var(--muted); letter-spacing: 0.4px; }
.detail-amount { margin-top: 7px; font-size: 38px; line-height: 1.1; font-weight: 610; letter-spacing: -1.6px; font-variant-numeric: tabular-nums; }
.detail-amount.is-income { color: var(--good); }
.detail-hero h3 { margin: 10px 0 0; font-size: 17px; font-weight: 600; }
.detail-hero p { margin: 3px 0 0; font-size: 10px; color: var(--muted); }
.detail-rows { margin-top: 3px; border-top: 1px solid var(--line); }
.detail-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-rows span { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.detail-rows span .icon { width: 13px; height: 13px; }
.detail-rows strong { font-size: 10.5px; font-weight: 560; color: var(--ink-2); }
.receipt-thumb { position: relative; width: 100%; margin-top: 15px; border-radius: 13px; overflow: hidden; background: var(--surface-soft); }
.receipt-thumb img { width: 100%; max-height: 190px; object-fit: cover; opacity: 0.82; }
.receipt-thumb > span { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 99px; background: rgba(14,18,13,.66); backdrop-filter: blur(6px); color: #f1eee3; font-size: 8px; }
.receipt-thumb > span .icon { width: 11px; height: 11px; }
.receipt-full { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 13px; background: var(--surface-soft); }
.confirm-message { margin: 0; padding: 3px 0 8px; font-size: 12px; line-height: 1.7; color: var(--muted); }

/* Month picker */
.month-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 3px 0 15px; }
.month-picker-head strong { font-size: 24px; font-weight: 620; letter-spacing: -0.7px; font-variant-numeric: tabular-nums; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.month-cell { position: relative; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); font-size: 12px; color: var(--ink-2); transition: background 140ms ease, color 140ms ease, border-color 140ms ease; }
.month-cell:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface); }
.month-cell.is-selected { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); font-weight: 600; }
.month-cell.is-disabled { opacity: 0.3; }
.month-cell i { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); font-style: normal; font-size: 7px; opacity: 0.62; }
.month-picker-foot { display: flex; flex-direction: column; gap: 3px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.month-picker-foot span:last-child { color: var(--muted); }

/* Budget sheet */
.budget-edit-field { display: flex; align-items: baseline; gap: 5px; padding: 8px 0 4px; border-bottom: 1px solid var(--line); }
.budget-edit-field span { font-size: 26px; color: var(--muted); }
.budget-edit-field input { width: 100%; border: 0; background: transparent; font-size: 48px; font-weight: 590; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.budget-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.budget-presets button { padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-soft); font-size: 9.5px; color: var(--muted); }
.budget-presets button:hover { background: var(--surface); color: var(--ink-2); }
.install-instructions { display: flex; flex-direction: column; gap: 14px; padding: 3px 0 7px; }
.install-instructions > div { padding: 12px 14px; border-radius: 11px; background: var(--surface-soft); }
.install-instructions > div span { display: inline-block; padding: 2px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: 8px; font-weight: 700; letter-spacing: 0.6px; }
.install-instructions p { margin: 6px 0 0; font-size: 10.5px; line-height: 1.6; color: var(--muted); }
.install-instructions .muted { padding: 0 2px; font-size: 9px; }
.privacy-copy p, .sample-copy p { margin: 0 0 10px; font-size: 11.5px; line-height: 1.75; color: var(--muted); }
.privacy-copy strong { color: var(--ink); }
.privacy-copy p:last-child, .sample-copy p:last-child { margin-bottom: 0; }

/* Toast */
.toast-root { position: fixed; left: 50%; bottom: 28px; z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 7px; transform: translateX(-50%); pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(24, 29, 23, 0.94);
  color: #f2eee4;
  font-size: 11px;
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast .icon { width: 14px; height: 14px; color: #a9c8b0; }
.toast-error .icon { color: #ef9d94; }
.toast-info .icon { color: #e3b08f; }
[data-theme="dark"] .toast { background: rgba(246, 243, 234, 0.95); color: #171a15; border-color: rgba(0,0,0,.05); }
[data-theme="dark"] .toast .icon { color: #3d6c52; }

/* Bottom nav */
.bottom-nav { display: none; }

/* Page animation */
.page > * { animation: rise 480ms cubic-bezier(.2,.7,.2,1) forwards; }
.page > *:nth-child(2) { animation-delay: 45ms; }
.page > *:nth-child(3) { animation-delay: 80ms; }
.page > *:nth-child(4) { animation-delay: 110ms; }
.page > *:nth-child(5) { animation-delay: 135ms; }
@keyframes rise { from { transform: translateY(9px); } to { transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1220px) {
  :root { --sidebar: 224px; }
  .app-main { padding-left: 32px; padding-right: 32px; }
  .overview-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .hero-amount strong { font-size: 56px; }
  .budget-body { gap: 15px; }
  .budget-ring { width: 112px; height: 112px; }
  .budget-ring-inner strong { font-size: 26px; }
  .category-overview { grid-template-columns: 170px minmax(0, 1fr); }
  .donut-shell { --donut-size: 170px !important; }
}

@media (max-width: 1080px) {
  :root { --sidebar: 84px; }
  .sidebar { padding: 24px 13px 17px; align-items: center; }
  .brand { padding: 0; align-self: center; }
  .brand-copy, .sidebar-add span, .nav-item span, .sidebar-budget, .profile-copy, .profile-chip > .icon { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .sidebar-add { width: 50px; height: 50px; padding: 0; margin: 25px 0 18px; border-radius: 15px; }
  .side-nav { width: 100%; gap: 5px; }
  .nav-item { justify-content: center; padding: 0; height: 47px; }
  .nav-item .icon { width: 20px; height: 20px; }
  .nav-dot { position: absolute; top: 10px; right: 12px; }
  .profile-chip { justify-content: center; padding: 5px; }
  .stats-grid { gap: 16px; }
  .span-5, .span-7 { grid-column: span 6; }
  .stats-panel { min-height: 0; }
  .import-hero { grid-template-columns: 1fr; gap: 22px; }
  .drop-zone { min-height: 200px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .app-main { padding: 0 24px calc(108px + env(safe-area-inset-bottom)); }
  .topbar { height: 70px; }
  .topbar-context { display: none; }
  .mobile-brand { display: flex; }
  .topbar-search { display: inline-flex; }
  .topbar-actions { margin-left: auto; }
  .avatar-button { display: none; }
  .page { padding-top: 15px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 31px; letter-spacing: -1px; }
  .heading-actions .btn-secondary { display: none; }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 5px 12px env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
  }
  .bottom-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 8.5px; border-radius: 12px; }
  .bottom-nav-item .icon { width: 20px; height: 20px; }
  .bottom-nav-item.is-active { color: var(--primary); }
  .bottom-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; color: var(--muted); font-size: 8.5px; transform: translateY(-13px); }
  .bottom-add span { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: var(--primary); color: var(--primary-contrast); box-shadow: 0 12px 22px -12px rgba(27, 57, 45, 0.7); border: 3px solid var(--bg); }
  .bottom-add span .icon { width: 23px; height: 23px; }
  .bottom-add em { font-style: normal; }
  .toast-root { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .overview-grid { grid-template-columns: 1fr; }
  .quick-capture { grid-template-columns: 1fr; gap: 16px; }
  .qc-intro { align-items: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .recent-panel { display: flex; flex-direction: column; }
  .recent-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .recent-panel .transaction-row:nth-child(n+7) { display: none; }
  .spend-hero { min-height: 292px; }
  .budget-card { min-height: auto; }
  .budget-body { gap: 22px; }
  .budget-footer { flex-direction: row; justify-content: space-between; }
  .quick-capture { padding: 19px; border-radius: 22px; }
  .qc-input-row { height: 50px; }
  .qc-submit { height: 40px; }
  .category-overview { grid-template-columns: 190px 1fr; }
  .donut-shell { --donut-size: 190px !important; }
  .metric-item { padding: 15px 17px; }
  .metric-value { font-size: 19px; }
  .stats-grid { grid-template-columns: 1fr; }
  .span-5, .span-7 { grid-column: auto; }
  .stats-donut-wrap { flex-direction: row; justify-content: center; align-items: center; gap: 24px; }
  .mini-legend { max-width: 230px; grid-template-columns: 1fr; }
  .import-steps { grid-template-columns: 1fr; }
  .import-hero { padding: 26px; }
  .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .photo-layout { grid-template-columns: 1fr; gap: 16px; }
  .photo-preview { min-height: 190px; max-height: 250px; }
  .photo-preview img { max-height: 250px; }
  .photo-loading-copy { padding: 10px 8px 6px; }
  .sheet-photo { max-height: 94dvh; }
  .sheet-photo .sheet-body { padding-top: 13px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .sheet { width: 100% !important; max-height: 94dvh; border-radius: 24px; }
  .sheet-add, .sheet-smart, .sheet-photo { max-height: 94dvh; height: auto; }
  .sheet-head { padding: 21px 21px 0; }
  .sheet-body { padding: 16px 21px 22px; }
  .sheet-footer { padding: 13px 21px calc(15px + env(safe-area-inset-bottom)); }
  .sheet-head h2 { font-size: 21px; }
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .field:first-child { grid-column: span 2; }
  .recent-list { grid-template-columns: 1fr; }
  .recent-panel .transaction-row:nth-child(n+7) { display: grid; }
  .ledger-toolbar { flex-wrap: wrap; }
  .search-field { max-width: none; flex-basis: 100%; }
  .type-filter { order: 2; }
  .result-count { order: 3; }
  .import-table-panel { border-radius: 19px; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .app-main { padding: 0 16px calc(102px + env(safe-area-inset-bottom)); }
  .topbar { height: 64px; gap: 10px; }
  .topbar-actions { gap: 6px; }
  .topbar-search { display: none; }
  .month-switcher { height: 36px; }
  .month-arrow { width: 27px; }
  .month-current { height: 29px; padding: 0 5px; font-size: 11.5px; }
  .month-full { display: none; }
  .month-short { display: inline; }
  .month-chevron { display: none; }
  .page-heading { display: block; margin-bottom: 23px; }
  .page-heading h1 { font-size: 29px; letter-spacing: -0.9px; }
  .dashboard-heading h1 { font-size: 29px; }
  .lede { margin-top: 9px; font-size: 12.5px; }
  .heading-actions { margin-top: 16px; }
  .heading-actions .btn-primary { display: none; }
  .heading-actions .btn-secondary { display: inline-flex; }
  .overview-grid { margin-top: 22px; gap: 12px; }
  .spend-hero { min-height: 265px; padding: 22px; border-radius: 25px; }
  .hero-amount { margin: 24px 0 9px; letter-spacing: -2px; }
  .hero-amount strong { font-size: 46px; }
  .hero-amount .currency { font-size: 22px; margin-right: 5px; }
  .hero-amount .decimal { font-size: 20px; }
  .hero-change em { display: none; }
  .hero-bottom { gap: 16px; padding-top: 15px; }
  .hero-spark { width: 30%; opacity: 0.7; }
  .sparkline { height: 44px; }
  .hero-stat strong { font-size: 12.5px; }
  .hero-stat span { font-size: 9px; }
  .budget-card { padding: 20px; border-radius: 25px; }
  .budget-body { margin: 17px 0 16px; gap: 17px; }
  .budget-ring { width: 102px; height: 102px; }
  .budget-ring::before { inset: 7px; }
  .budget-ring-inner strong { font-size: 24px; }
  .budget-copy > strong { font-size: 20px; }
  .quick-capture { margin-top: 12px; padding: 18px 16px; border-radius: 21px; }
  .qc-intro { align-items: flex-start; gap: 11px; }
  .qc-icon { width: 39px; height: 39px; border-radius: 12px; }
  .qc-icon .icon { width: 18px; height: 18px; }
  .qc-intro h2 { font-size: 17px; }
  .qc-intro p:last-child { font-size: 10px; }
  .qc-examples { gap: 5px; }
  .qc-examples > span { display: none; }
  .qc-examples button { font-size: 8.5px; padding: 3px 7px; }
  .qc-submit { width: 42px; padding: 0; }
  .qc-submit span, .qc-submit { font-size: 0; gap: 0; }
  .qc-submit .icon { width: 17px; height: 17px; }
  .dashboard-grid { gap: 12px; margin-top: 12px; }
  .panel { padding: 19px 17px; border-radius: 21px; }
  .panel-head h3, .budget-head h3 { font-size: 16px; }
  .category-overview { grid-template-columns: 1fr; gap: 7px; }
  .donut-shell { --donut-size: 185px !important; }
  .category-legend-row { padding: 7px 2px; }
  .recent-panel .transaction-row { padding: 9px 0; }
  .metric-strip { grid-template-columns: 1fr 1fr; border-radius: 19px; }
  .metric-item { padding: 14px 15px; }
  .metric-item:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-item:nth-child(4) { border-top: 1px solid var(--line); }
  .metric-value { font-size: 18px; }
  .metric-sub { font-size: 8.5px; }
  .ledger-toolbar { margin-top: 18px; gap: 8px; }
  .search-field { height: 42px; }
  .result-count { font-size: 9px; }
  .filter-scroll { margin-right: -16px; padding-right: 16px; }
  .date-group-head { padding-left: 2px; }
  .date-title strong { font-size: 12.5px; }
  .date-total { font-size: 8.5px; gap: 6px; }
  .transaction-list { padding: 4px 12px; border-radius: 19px; }
  .transaction-list .transaction-row { padding: 10px 0; gap: 10px; }
  .transaction-list .transaction-note, .transaction-note { font-size: 12px; }
  .transaction-meta { font-size: 8.5px; }
  .transaction-amount { font-size: 12.5px; }
  .transaction-list .transaction-amount { font-size: 13px; }
  .cat-badge, .transaction-list .cat-badge { width: 37px; height: 37px; border-radius: 12px; }
  .cat-badge .icon { width: 16px; height: 16px; }
  .stats-panel { padding: 19px 17px; }
  .insight-banner { padding: 15px; gap: 11px; border-radius: 18px; }
  .insight-items { flex-direction: column; gap: 4px; }
  .insight-items span + span::before { display: none; }
  .comparison-plot { height: 170px; min-height: 170px; }
  .comparison-scale { height: 170px; }
  .chart-bar { width: 10px; }
  .stats-donut-wrap { flex-direction: column; gap: 12px; }
  .mini-legend { max-width: none; width: 100%; grid-template-columns: 1fr 1fr; }
  .daily-plot { height: 150px; }
  .daily-bars { gap: 3px; }
  .ranking-row { grid-template-columns: 64px minmax(0, 1fr) 52px 29px; gap: 6px; }
  .import-hero { padding: 21px 18px; border-radius: 22px; }
  .import-hero h2 { font-size: 26px; }
  .import-hero p { font-size: 11px; }
  .import-actions { margin-top: 18px; }
  .drop-zone { min-height: 190px; padding: 20px; }
  .import-steps > div { padding: 17px 18px; }
  .import-summary-card { flex-wrap: wrap; padding: 15px; }
  .import-summary-total { margin-left: auto; }
  .import-summary-card .mini-icon { order: 5; }
  .import-footer { flex-direction: column; align-items: stretch; gap: 11px; padding: 13px 15px; }
  .import-footer .btn { width: 100%; }
  .settings-row { align-items: flex-start; gap: 10px; }
  .settings-row-actions { flex-direction: column; }
  .settings-form { flex-direction: column; align-items: stretch; }
  .theme-options { gap: 6px; }
  .theme-option { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px; font-size: 9.5px; }
  .theme-option > i { display: none; }
  .theme-swatch { width: 100%; height: 43px; }
  .profile-hero .avatar.is-xl { width: 54px; height: 54px; border-radius: 18px; }
  .modal-backdrop { padding: 0; }
  .sheet { width: 100% !important; max-height: 95dvh; border-radius: 23px 23px 0 0; border-bottom: 0; }
  .sheet-head { padding: 19px 18px 0; }
  .sheet-body { padding: 14px 18px 19px; }
  .sheet-footer { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .sheet-footer .btn { flex: 1; min-width: 0; }
  .sheet-head h2 { font-size: 20px; }
  .amount-field input { font-size: 46px; }
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .cat-option { padding: 8px 2px 7px; font-size: 9px; }
  .add-photo-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .form-grid .field:first-child { grid-column: span 2; }
  .add-date-chip { display: none; }
  .smart-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .smart-amount { grid-column: 2; justify-self: start; margin-top: 5px; }
  .smart-amount input { width: 90px; text-align: left; }
  .smart-remove { grid-column: 3; grid-row: 1; }
  .smart-item-main { align-self: flex-start; }
  .smart-date-input { width: 91px; }
  .smart-orbit { width: 54px; height: 54px; }
  .photo-layout { gap: 12px; }
  .photo-preview { min-height: 160px; max-height: 200px; }
  .photo-preview img { max-height: 200px; }
  .photo-fields { grid-template-columns: 1fr 1fr; }
  .photo-fields .field:nth-child(1) { grid-column: span 2; }
  .photo-fields .field:nth-child(5) { grid-column: span 2; }
  .photo-amount-label input { font-size: 38px; }
  .detail-amount { font-size: 34px; }
  .toast-root { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .app-main { padding-left: 13px; padding-right: 13px; }
  .page-heading h1, .dashboard-heading h1 { font-size: 26px; }
  .hero-amount strong { font-size: 42px; }
  .hero-subline { font-size: 9.5px; }
  .metric-value { font-size: 16px; }
  .cat-grid { gap: 4px; }
  .cat-option { font-size: 8.5px; }
  .month-cell { height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

/* Specificity guards for form-like custom controls */
.field.budget-input {
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
  height: 54px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.field.budget-input > span { font-size: 17px; color: var(--muted); flex: none; }
.field.budget-input input {
  width: 100%;
  height: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 25px;
  font-weight: 610;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}
.field.budget-input input:focus { border: 0; background: transparent; }
.field.budget-input em { font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; flex: none; }

/* Compact receipt preview in entry detail */
.receipt-thumb {
  position: relative;
  height: 146px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.receipt-thumb img {
  width: 100%;
  height: 146px;
  max-height: none;
  object-fit: cover;
  object-position: top center;
  opacity: 0.92;
}
.receipt-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(12, 16, 12, 0.55));
  pointer-events: none;
}
.receipt-thumb > span {
  z-index: 1;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: rgba(15, 20, 14, 0.72);
  font-size: 9px;
  white-space: nowrap;
}

.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 7px; color: rgba(255,255,255,.55); font-size: 9px; }
.photo-empty .icon { width: 24px; height: 24px; }

/* ---------- Annual report ---------- */
.year-switcher { flex: none; }
.year-current { cursor: default; }
.annual-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; margin-top: 20px; align-items: start; }
.annual-column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.annual-layout .stats-panel { min-height: 0; }
.annual-chart { margin-top: 4px; }
.annual-insights { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.annual-insights > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 3px 10px; align-items: baseline; }
.annual-insights span { color: var(--faint); font-size: 10px; }
.annual-insights strong { color: var(--ink); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annual-insights em { grid-column: 2; font-style: normal; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.annual-merchants { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.annual-subhead { margin: 0 0 10px; font-size: 9px; font-weight: 700; letter-spacing: 1.7px; color: var(--faint); text-transform: uppercase; }
.annual-merchant-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; font-size: 11px; }
.annual-merchant-row span { color: var(--faint); font-variant-numeric: tabular-nums; }
.annual-merchant-row strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annual-merchant-row em { font-style: normal; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.annual-table { margin-top: 14px; }
.annual-table-head, .annual-table-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
}
.annual-table-head { padding: 0 7px 8px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 9px; }
.annual-table-head span:not(:first-child), .annual-table-row > span:not(.annual-month-name) { text-align: right; }
.annual-table-row {
  width: 100%;
  padding: 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
  transition: background 140ms ease;
}
.annual-table-row:hover { background: var(--surface-soft); }
.annual-table-row.is-empty { opacity: 0.4; }
.annual-table-row:disabled { cursor: default; opacity: 0.32; }
.annual-table-row:disabled:hover { background: transparent; }
.annual-month-name { color: var(--ink); font-weight: 600; text-align: left; }
.annual-table-row .is-income { color: var(--good); }
.annual-table-row .is-expense { color: var(--danger); }
.annual-empty { padding: 12px; }

@media (max-width: 900px) {
  .annual-layout { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
  .annual-column { display: contents; }
  .annual-panel-chart { order: 1; }
  .annual-panel-insights { order: 2; }
  .annual-panel-categories { order: 3; }
  .annual-panel-table { order: 4; }
}

@media (max-width: 640px) {
  .year-switcher .month-current { padding: 0 8px; }
  .annual-layout { gap: 12px; }
  .annual-insights { gap: 11px; margin-top: 15px; }
  .annual-merchants { margin-top: 17px; padding-top: 14px; }
  .annual-table-head, .annual-table-row { grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 6px; }
  .annual-col-income { display: none; }
  .annual-table-row { padding: 7px 4px; font-size: 10px; }
  .annual-chart .chart-bar { width: 9px; }
  .annual-chart .comparison-bars { gap: 2px; }
  .annual-chart .comparison-label { font-size: 8px; }
  .annual-chart .comparison-plot { height: 165px; min-height: 165px; }
  .annual-chart .comparison-scale { height: 165px; font-size: 8px; }
}

.month-switcher.is-search-hidden { display: none; }

@media print {
  .sidebar, .topbar, .bottom-nav, .heading-actions, .toast-root, .modal-backdrop { display: none !important; }
  body { background: #fff; }
  .app-shell { display: block; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .app-main { padding: 0; }
  .page { max-width: none; padding: 0; }
  .panel, .metric-strip { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .stats-grid { gap: 12px; }
}

@media (max-width: 900px) {
  .heading-actions .btn-secondary.annual-entry { display: inline-flex; }
}

@media (min-width: 901px) {
  .budget-card { padding: 22px 24px 20px; }
  .budget-body { justify-content: center; gap: 24px; margin: 18px 0 15px; }
  .budget-footer { padding-top: 12px; }
}

/* ---------- LAN sync indicator ---------- */
.sync-indicator {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.sync-indicator:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.sync-indicator[hidden] { display: none; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.sync-indicator.is-synced { color: var(--good); border-color: color-mix(in srgb, var(--good) 20%, var(--line)); }
.sync-indicator.is-synced .sync-dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.sync-indicator.is-syncing { color: var(--ink-2); }
.sync-indicator.is-syncing .sync-dot { background: var(--accent); animation: sync-pulse 900ms ease-in-out infinite; }
.sync-indicator.is-offline,
.sync-indicator.is-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 18%, var(--line)); }
.sync-indicator.is-offline .sync-dot,
.sync-indicator.is-error .sync-dot { background: var(--danger); }
@keyframes sync-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1); } }

@media (max-width: 640px) {
  .sync-indicator { width: 26px; height: 26px; padding: 0; justify-content: center; }
  .sync-indicator span:not(.sync-dot) { display: none; }
}
@media print {
  .sync-indicator { display: none !important; }
}

.sync-indicator.is-signed-out { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.sync-indicator.is-signed-out .sync-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Cloud sign-in ---------- */
.cloud-auth {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(20, 24, 19, 0.48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.cloud-auth[hidden] { display: none !important; }
.cloud-auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}
.cloud-auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.cloud-auth-brand .brand-mark {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--primary); color: var(--primary-contrast);
}
.cloud-auth-brand .brand-mark svg { width: 28px; height: 28px; }
.cloud-auth-brand strong { display: block; font-size: 17px; letter-spacing: 0.4px; }
.cloud-auth-brand em { display: block; margin-top: 3px; font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: 2.4px; color: var(--muted); }
.cloud-auth-card h2 { margin: 0; font-size: 25px; letter-spacing: -0.5px; }
.cloud-auth-lede { margin: 8px 0 20px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.cloud-auth-card form { display: flex; flex-direction: column; gap: 12px; }
.cloud-auth-submit { margin-top: 4px; width: 100%; justify-content: center; }
.cloud-auth-error { margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 11px; line-height: 1.5; }
.cloud-auth-error[hidden] { display: none; }
.cloud-auth-switch { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-size: 11px; color: var(--muted); }
.cloud-auth-offline { display: block; margin: 18px auto 0; font-size: 10.5px; color: var(--faint); }
@media (max-width: 640px) {
  .cloud-auth { padding: 14px; align-items: flex-end; }
  .cloud-auth-card { padding: 22px; border-radius: 22px; }
}

/* ---------- Tags ---------- */
.tag-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 10.5px;
  color: var(--muted);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.tag-chip:hover { border-color: var(--line-strong); color: var(--ink-2); }
.tag-chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tag-section[hidden] { display: none; }
.smart-tag-select { max-width: 104px; }
.smart-select[hidden] { display: none; }
.smart-item-meta { flex-wrap: wrap; row-gap: 3px; }

.tag-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 26px; margin-top: 12px; }
.tag-breakdown-row { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(56px, 0.75fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tag-breakdown-row:last-child { border-bottom: 0; }
.tag-breakdown-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tag-breakdown-name > i { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.tag-breakdown-name b { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-breakdown-name em { font-style: normal; font-size: 9px; color: var(--faint); white-space: nowrap; }
.tag-breakdown-bar { height: 5px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.tag-breakdown-bar i { display: block; height: 100%; border-radius: 99px; }
.tag-breakdown-amount { text-align: right; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag-breakdown-amount small { display: block; margin-top: 2px; font-size: 8px; font-weight: 500; color: var(--faint); }
.span-12 { grid-column: span 12; }
@media (max-width: 900px) {
  .tag-breakdown { grid-template-columns: 1fr; }
  .span-12 { grid-column: auto; }
}

/* Budget: available beside the ring, monthly budget at the bottom right */
.budget-footer { flex-direction: row; align-items: baseline; gap: 12px; }
.budget-footer > span { flex: 0 1 auto; }
.budget-footer .budget-monthly { margin-left: auto; justify-content: flex-end; text-align: right; flex-wrap: wrap; gap: 5px; }
.budget-footer .budget-monthly b { color: var(--ink); }

@media (max-width: 520px) {
  .tag-chip { height: 26px; padding: 0 10px; font-size: 10px; }
  .tag-breakdown-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tag-breakdown-bar { display: none; }
  .budget-footer { flex-wrap: wrap; row-gap: 5px; }
  .budget-footer .budget-monthly { margin-left: auto; }
}
