/* ============================================================
   Pecunia — Personal Finance · styles
   Fonts: Inter & Lora (SIL Open Font License 1.1), embedded in fonts.css
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --bg-sunk: #ebe8df;
  --surface: #fbfaf6;
  --surface-2: #f0ede5;
  --surface-3: #e5e1d6;
  --ink: #1d1c18;
  --muted: #69655b;
  --faint: #8f8a7e;
  --line: #e2ded2;
  --line-strong: #cdc8ba;
  --accent: #2d5b47;
  --accent-hover: #244b3a;
  --accent-ink: #f6f4ee;
  --accent-tint: #e3ebe4;
  --pos: #2f7a52;
  --neg: #ad442e;
  --warn: #9c6614;
  --pos-tint: #e2efe6;
  --neg-tint: #f6e3dc;
  --warn-tint: #f4ead6;
  --c1: #2d5b47;
  --c2: #c17d4a;
  --c3: #5a7896;
  --c4: #9b5a6e;
  --c5: #7d8b4f;
  --c6: #7b6d99;
  --c7: #4f8d8a;
  --c8: #a08a63;
  --shadow-float: 0 1px 2px rgb(60 50 30 / 0.06), 0 12px 32px -8px rgb(60 50 30 / 0.18);
  --shadow-sheet: -12px 0 40px -12px rgb(50 40 20 / 0.22);
  --r-xs: 4px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 16px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Lora", ui-serif, Georgia, "Times New Roman", serif;
  --z-top: 20;
  --z-toast: 40;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --page-max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141310;
    --bg-sunk: #0f0e0c;
    --surface: #1b1a16;
    --surface-2: #23221d;
    --surface-3: #2d2b25;
    --ink: #ece9e0;
    --muted: #a7a295;
    --faint: #7d786c;
    --line: #2c2a24;
    --line-strong: #3d3a32;
    --accent: #7cc4a0;
    --accent-hover: #93d2b2;
    --accent-ink: #10201a;
    --accent-tint: #1d2f27;
    --pos: #7fcf9f;
    --neg: #ee8f76;
    --warn: #ddb25e;
    --pos-tint: #1b2e23;
    --neg-tint: #35211a;
    --warn-tint: #332a15;
    --c1: #7cc4a0;
    --c2: #dd9c68;
    --c3: #8eaacb;
    --c4: #cf8ea2;
    --c5: #adbb7c;
    --c6: #ab9ecb;
    --c7: #7fbfbc;
    --c8: #c7b08a;
    --shadow-float: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -8px rgb(0 0 0 / 0.55);
    --shadow-sheet: -12px 0 40px -12px rgb(0 0 0 / 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141310;
  --bg-sunk: #0f0e0c;
  --surface: #1b1a16;
  --surface-2: #23221d;
  --surface-3: #2d2b25;
  --ink: #ece9e0;
  --muted: #a7a295;
  --faint: #7d786c;
  --line: #2c2a24;
  --line-strong: #3d3a32;
  --accent: #7cc4a0;
  --accent-hover: #93d2b2;
  --accent-ink: #10201a;
  --accent-tint: #1d2f27;
  --pos: #7fcf9f;
  --neg: #ee8f76;
  --warn: #ddb25e;
  --pos-tint: #1b2e23;
  --neg-tint: #35211a;
  --warn-tint: #332a15;
  --c1: #7cc4a0;
  --c2: #dd9c68;
  --c3: #8eaacb;
  --c4: #cf8ea2;
  --c5: #adbb7c;
  --c6: #ab9ecb;
  --c7: #7fbfbc;
  --c8: #c7b08a;
  --shadow-float: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -8px rgb(0 0 0 / 0.55);
  --shadow-sheet: -12px 0 40px -12px rgb(0 0 0 / 0.6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgb(0 0 0 / 0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .35 0 0 0 0 .25 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.topbar, main, .footer { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; text-wrap: balance; scroll-margin-top: 90px; }
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
h2 { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }

.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus-visible { top: 12px; color: var(--bg); }

.ic { width: 18px; height: 18px; flex: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}
.brand:hover { color: var(--ink); }
.brand-mark { width: 24px; height: 24px; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: var(--accent-ink); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; letter-spacing: -0.015em; }

.nav-wrap {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
.nav-wrap::-webkit-scrollbar { display: none; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.nav a {
  position: relative;
  display: block;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: -11px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.topbar-actions { flex: none; display: flex; gap: 8px; }

@media (max-width: 720px) {
  .topbar-inner { gap: 10px; height: 54px; }
  .brand-name { display: none; }
  .topbar-actions .btn-label { display: none; }
  .topbar-actions .btn { padding: 0; width: 36px; }
  .nav a[aria-current="page"]::after { bottom: -8px; }
}

/* ---------- Page ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 36px max(var(--gutter), env(safe-area-inset-right)) 56px max(var(--gutter), env(safe-area-inset-left));
  outline: none;
}
.page { display: flex; flex-direction: column; gap: 28px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}
.page-head .sub { margin-top: 10px; color: var(--muted); max-width: 62ch; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.footer {
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding: 18px max(var(--gutter), env(safe-area-inset-right)) calc(26px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.82rem;
}

.eyebrow { font-size: 0.8rem; font-weight: 500; color: var(--muted); letter-spacing: 0.01em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); color: var(--ink); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger { color: var(--neg); }
.btn.danger:hover { background: var(--neg-tint); border-color: var(--neg); }
.btn.danger-solid { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.danger-solid:hover { background: color-mix(in srgb, var(--neg) 88%, #000); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.link-btn {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.link-btn:hover, .panel-head a:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), transform 120ms var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.danger:hover { background: var(--neg-tint); color: var(--neg); }
.icon-btn .ic { width: 16px; height: 16px; }

label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  border: 1px solid var(--line);
}
.seg button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg.icons button { display: inline-flex; align-items: center; gap: 6px; padding: 0 11px 0 9px; }
.seg.icons .ic { width: 15px; height: 15px; }
@media (max-width: 480px) { .seg.icons span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(60 50 30 / 0.12); }

/* Range navigator */
.rangenav { display: inline-flex; align-items: center; gap: 4px; }
.rangenav-label {
  min-width: 150px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---------- Panels ---------- */
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px 22px;
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head a { font-size: 0.85rem; font-weight: 500; text-decoration: none; }
.panel-head .sub { font-size: 0.82rem; color: var(--faint); margin-top: 2px; }

.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.s-12 { grid-column: span 12; }
.s-8 { grid-column: span 8; }
.s-7 { grid-column: span 7; }
.s-6 { grid-column: span 6; }
.s-5 { grid-column: span 5; }
.s-4 { grid-column: span 4; }
.s-3 { grid-column: span 3; }
@media (max-width: 1080px) {
  .s-8, .s-7, .s-5 { grid-column: span 12; }
  .s-4, .s-3, .s-6 { grid-column: span 6; }
}
@media (max-width: 720px) {
  .grid12 > * { grid-column: span 12; }
}

/* ---------- Overview hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 40px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.hero .display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin: 10px 0 12px;
  overflow-wrap: anywhere;
  font-variant-numeric: lining-nums tabular-nums;
}
.hero-sub { color: var(--muted); font-size: 0.9rem; }
.hero .stack { margin-top: 22px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 26px; } }

.ledger { margin: 0; display: grid; }
.ledger > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.ledger > div:first-child { border-top: 0; padding-top: 0; }
.ledger dt { color: var(--muted); font-size: 0.88rem; display: flex; align-items: center; gap: 8px; }
.ledger dd { margin: 0; font-weight: 600; font-size: 1.02rem; }
.ledger-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }

/* Stat strip (non-card KPIs) */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.stat { padding: 16px 20px 18px; border-left: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .v { font-family: var(--serif); font-size: clamp(1.05rem, 0.9rem + 0.8vw, 1.5rem); font-weight: 500; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: lining-nums tabular-nums; }
.stat .f { font-size: 0.8rem; color: var(--faint); }
.stat.lead { background: var(--accent); color: var(--accent-ink); }
.stat.lead .eyebrow, .stat.lead .f { color: color-mix(in srgb, var(--accent-ink) 72%, transparent); }
@media (max-width: 560px) {
  .stat { border-left: 0; border-top: 1px solid var(--line); }
  .stat:first-child { border-top: 0; }
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tag.pos { background: var(--pos-tint); color: var(--pos); }
.tag.neg { background: var(--neg-tint); color: var(--neg); }
.tag.warn { background: var(--warn-tint); color: var(--warn); }

/* ---------- Bars ---------- */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > span {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 520ms var(--ease);
}
.bar.warn > span { background: var(--warn); }
.bar.neg > span { background: var(--neg); }

.stack { display: flex; height: 10px; gap: 3px; }
.stack > span { min-width: 4px; border-radius: 3px; }

.legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.legend.inline { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.legend li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.86rem; }
.legend .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.legend.inline .name { flex: none; }
.legend .val { font-weight: 500; }
.legend .pct { width: 3em; text-align: right; color: var(--faint); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 56px;
}
.row:first-child { border-top: 0; }
.chip-ic {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  flex: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--chip, var(--muted));
  background: color-mix(in srgb, var(--chip, var(--muted)) 15%, transparent);
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 0.8rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amt { text-align: right; font-weight: 600; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; flex: none; opacity: 0.85; }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; }

.day-group + .day-group { margin-top: 18px; }
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line-strong);
}
.day-head h3 { font-family: var(--serif); font-weight: 500; font-size: 1rem; }
.day-head .num { font-size: 0.85rem; color: var(--muted); }

/* ---------- Items (budgets, goals) ---------- */
.item { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.item:first-child { border-top: 0; padding-top: 2px; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.item-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; font-size: 0.82rem; color: var(--faint); }
.item-tools { display: flex; align-items: center; gap: 4px; flex: none; }

.goal { display: flex; flex-direction: column; gap: 14px; }
.goal-amt { font-family: var(--serif); font-size: 1.7rem; font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.goal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 8px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
thead th { border-top: 0; padding-top: 0; font-size: 0.78rem; font-weight: 500; color: var(--faint); }
th.r, td.r { text-align: right; }
td .cell-name { font-weight: 500; max-width: 240px; overflow: hidden; text-overflow: ellipsis; display: block; }
td .cell-sub { font-size: 0.78rem; color: var(--faint); }
td .row-actions { flex-wrap: wrap; justify-content: flex-end; gap: 4px; width: 172px; margin-left: auto; }

/* ---------- Controls ---------- */
.controls { display: grid; gap: 12px; }
.controls-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.controls-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; width: 16px; height: 16px; }
.search input[type="search"] { padding-left: 34px; }

input[type="text"], input[type="search"], input[type="date"], input[type="password"], select, textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
select { appearance: auto; padding-right: 6px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
[aria-invalid="true"] { border-color: var(--neg) !important; }
.filters select { width: auto; max-width: 100%; height: 34px; font-size: 0.86rem; }
.search input[type="search"] { height: 34px; font-size: 0.88rem; }

.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field legend { font-size: 0.84rem; font-weight: 500; }
.field .opt { color: var(--faint); font-weight: 400; }
.field .hint { font-size: 0.8rem; color: var(--faint); min-height: 1.2em; }
.field .err { font-size: 0.8rem; color: var(--neg); font-weight: 500; }
.field .err:empty { display: none; }
.field[hidden] { display: none; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
input.amount { height: 52px; font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }

.segment { display: flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--bg-sunk); border: 1px solid var(--line); }
.segment label {
  flex: 1;
  position: relative;
  display: grid; place-items: center;
  height: 34px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment label:hover { color: var(--ink); }
.segment label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(60 50 30 / 0.12); }
.segment label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-grid > .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Sheet (dialog) ---------- */
dialog {
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(28 24 16 / 0.4); }

dialog.sheet {
  margin: 0 0 0 auto;
  width: min(460px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-sheet);
}
dialog.sheet[open] { animation: sheet-in 260ms var(--ease); }
@keyframes sheet-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }

dialog.confirm {
  width: min(440px, calc(100vw - 24px));
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
}
dialog.confirm[open] { animation: pop-in 180ms var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }

.dlg-form { display: flex; flex-direction: column; height: 100%; max-height: inherit; }
.dlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(22px + env(safe-area-inset-top)) 24px 8px;
}
.dlg-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.45rem; letter-spacing: -0.02em; line-height: 1.15; }
.dlg-body { flex: 1; padding: 14px 24px 18px; overflow-y: auto; overscroll-behavior: contain; }
.dlg-body > .intro { color: var(--muted); margin-bottom: 18px; font-size: 0.9rem; }
.dlg-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
dialog.confirm .dlg-head { padding-top: 22px; }
dialog.confirm .dlg-head h2 { font-size: 1.25rem; }
dialog.confirm .dlg-body p { color: var(--muted); }

@media (max-width: 560px) {
  dialog.sheet {
    margin: auto 0 0;
    width: 100vw;
    height: auto;
    max-height: 92dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
  dialog.sheet[open] { animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .dlg-head { padding-top: 20px; }
}

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  animation: toast-in 220ms var(--ease);
}
.toast p { flex: 1; min-width: 0; font-size: 0.88rem; }
.toast button {
  border: 0;
  background: rgb(127 127 127 / 0.18);
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.toast button:hover { background: rgb(127 127 127 / 0.32); }
.toast button:focus-visible { outline-color: var(--bg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--faint); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .x-text { fill: var(--muted); font-size: 11.5px; font-family: var(--sans); }
.chart .x-text.now { fill: var(--ink); font-weight: 600; }
.chart .b-inc { fill: var(--c1); }
.chart .b-exp { fill: var(--c2); }
.chart-legend { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.cat-bars { display: grid; gap: 13px; }
.cat-bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; margin-bottom: 6px; min-width: 0; }
.cat-bar-top .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* This-week strip */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ws-day {
  display: grid;
  grid-template-rows: auto 64px auto;
  gap: 6px;
  padding: 10px 8px 9px;
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  transition: background-color 160ms var(--ease);
}
.ws-day:hover { background: var(--surface-2); color: var(--ink); }
.ws-dow { font-size: 0.76rem; color: var(--faint); }
.ws-dow b { display: block; font-family: var(--serif); font-size: 1.05rem; font-weight: 500; color: var(--ink); }
.ws-day.is-today .ws-dow b { color: var(--accent); }
.ws-col { position: relative; width: 12px; margin: 0 auto; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ws-col span { position: absolute; inset: 0; background: var(--c2); border-radius: 3px; transform-origin: bottom center; transition: transform 520ms var(--ease); }
.ws-day.is-future .ws-col { background: repeating-linear-gradient(-45deg, var(--surface-3) 0 3px, transparent 3px 6px); }
.ws-amt .short { display: none; }
@media (max-width: 560px) { .ws-amt .full { display: none; } .ws-amt .short { display: inline; } .ws-day { padding: 8px 2px; } }
.ws-amt { font-size: 0.74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Calendar (month) ---------- */
.cal { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--line); }
.cal-dows, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.cal-dows { background: var(--surface-2); }
.cal-dows span { padding: 9px 10px; font-size: 0.76rem; font-weight: 500; color: var(--faint); background: var(--surface-2); }
.cal-grid { border-top: 1px solid var(--line); }
.cal-day {
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  min-height: 104px;
  padding: 8px 10px 12px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms var(--ease);
}
.cal-day:hover { background: var(--surface-2); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; z-index: 1; }
.cal-day.is-out { background: var(--bg); color: var(--faint); }
.cal-day.is-out .cal-amt { opacity: 0.6; }
.cal-day[aria-pressed="true"] { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num {
  display: inline-grid;
  place-items: center;
  align-self: flex-start;
  min-width: 26px;
  height: 26px;
  margin: -3px 0 4px -6px;
  padding: 0 6px;
  border-radius: 13px;
  font-size: 0.86rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cal-day.is-today .cal-num { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cal-amt { font-size: 0.76rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.cal-amt.inc { color: var(--pos); }
.cal-amt.exp { color: var(--ink); }
.cal-count { font-size: 0.72rem; color: var(--faint); margin-top: auto; }
.cal-heat { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c2); transform-origin: left center; opacity: 0.85; }
.cal-amt .compact { display: none; }

@media (max-width: 720px) {
  .cal-day { min-height: 64px; padding: 6px 4px 8px; align-items: center; text-align: center; }
  .cal-num { margin: 0 0 2px; align-self: center; font-size: 0.8rem; min-width: 24px; height: 24px; }
  .cal-amt .full, .cal-count, .cal-amt.inc { display: none; }
  .cal-amt .compact { display: inline; }
  .cal-amt { font-size: 0.66rem; }
  .cal-dows span { padding: 8px 2px; text-align: center; }
}

.day-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.day-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.day-panel-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; letter-spacing: -0.015em; }
.inline-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.86rem; color: var(--muted); }
.inline-stats b { color: var(--ink); font-weight: 600; }

/* ---------- Calendar (week) ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.wk-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 300px;
  padding: 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.wk-day.is-today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.wk-day.is-weekend { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.wk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 0 2px; }
.wk-head h3 { display: flex; align-items: baseline; gap: 6px; font-weight: 500; }
.wk-dow { font-size: 0.78rem; color: var(--faint); font-weight: 500; }
.wk-date { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.wk-day.is-today .wk-date { color: var(--accent); }
.wk-tot { font-size: 0.74rem; color: var(--muted); text-align: right; line-height: 1.3; }
.wk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wk-item {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 7px 8px 7px 10px;
  border: 0;
  border-left: 3px solid var(--chip, var(--line-strong));
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms var(--ease), transform 120ms var(--ease);
}
button.wk-item:hover { background: var(--surface-3); }
button.wk-item:active { transform: scale(0.985); }
div.wk-item { cursor: default; }
.wk-item-title { font-size: 0.8rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-item-amt { font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-empty { font-size: 0.8rem; color: var(--faint); padding: 6px 2px; }
.wk-add { margin-top: auto; width: 100%; justify-content: flex-start; }

@media (max-width: 1080px) {
  .week { grid-template-columns: 1fr; }
  .wk-day { min-height: 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: start; gap: 6px 14px; }
  .wk-head { flex-direction: column; align-items: flex-start; grid-row: span 2; }
  .wk-tot { text-align: left; }
  .wk-add { grid-column: 2; width: auto; justify-self: start; }
}
@media (max-width: 480px) {
  .wk-day { grid-template-columns: 1fr; }
  .wk-head { flex-direction: row; align-items: baseline; grid-row: auto; }
  .wk-add { grid-column: 1; }
}

/* ---------- Empty & onboarding ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
}
.empty .ic { width: 26px; height: 26px; color: var(--faint); }
.empty p { max-width: 42ch; font-size: 0.9rem; }

.onboard {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
  min-height: min(70dvh, 640px);
}
.onboard h1 { font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4rem); letter-spacing: -0.035em; }
.onboard .lead { margin-top: 20px; font-size: 1.05rem; color: var(--muted); max-width: 48ch; }
.onboard .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.onboard-aside { display: grid; gap: 0; border-top: 1px solid var(--line-strong); }
.onboard-aside div { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.onboard-aside b { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; }
.onboard-aside span { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 860px) { .onboard { grid-template-columns: 1fr; min-height: 0; } }

/* ---------- Sign-in ---------- */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  min-height: min(78dvh, 720px);
}
.login-intro { display: grid; gap: 18px; align-content: center; }
.login-intro h1 { font-size: clamp(2.5rem, 1.7rem + 3.4vw, 4.2rem); letter-spacing: -0.035em; max-width: 13ch; }
.login-intro .lead { font-size: 1.05rem; color: var(--muted); max-width: 48ch; }
.login-intro .onboard-aside { margin-top: 10px; }
.gloss { font-family: var(--serif); color: var(--muted); font-size: 1rem; }
.gloss b { color: var(--ink); font-weight: 600; }
.gloss i { font-style: normal; font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--faint); margin: 0 4px; }
.login-card {
  display: grid;
  gap: 16px;
  padding: 28px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
}
.login-card h2 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; letter-spacing: -0.02em; }
.login-card h2.eyebrow { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.01em; }
.login-sub { margin-top: 6px; color: var(--muted); font-size: 0.88rem; }
.login-card .form-err { margin-top: 0; }
.login-card .hint a { font-weight: 500; }
.btn.block { width: 100%; height: 42px; font-size: 0.92rem; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.check-sub { display: block; font-weight: 400; color: var(--faint); font-size: 0.8rem; }
.login-alt { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 0.78rem; }
.login-alt::before, .login-alt::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-more { display: grid; gap: 6px; }
.login-more .btn { width: 100%; }
.login-who { display: flex; align-items: center; gap: 14px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 13px; background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.login-who .who { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.login-foot { font-size: 0.85rem; color: var(--muted); text-align: center; }
.login .notice { max-width: 56ch; }
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 28px; }
  .login-intro .onboard-aside { display: none; }
  .login-card { padding: 22px 18px 20px; }
}

.login-tabs { display: flex; }
.login-tabs button { flex: 1; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px 48px; }
.settings > h2 { padding-top: 22px; font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }
.settings > .panel { margin: 0; }
@media (max-width: 860px) { .settings { grid-template-columns: 1fr; gap: 10px; } .settings > h2 { padding-top: 14px; } }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-row:last-child { padding-bottom: 0; }
.setting-row > div:first-child { min-width: 0; flex: 1 1 240px; }
.setting-row label, .setting-row strong { font-weight: 500; }
.setting-row .desc { font-size: 0.82rem; color: var(--faint); margin-top: 2px; }
.setting-row select { width: auto; min-width: 190px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px 2px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon-btn { width: 24px; height: 24px; }
.chip .icon-btn .ic { width: 13px; height: 13px; }
.inline-form { display: flex; gap: 8px; max-width: 420px; }
.inline-form input { flex: 1; min-width: 0; }
.notice { padding: 14px 18px; border-radius: var(--r-md); background: var(--warn-tint); color: var(--ink); font-size: 0.9rem; }

.noscript { padding: 24px; text-align: center; }

/* ---------- Cloud sync ---------- */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.sync-pill:hover { background: var(--surface-2); color: var(--ink); }
.sync-pill .ic { width: 16px; height: 16px; }
.sync-pill.off { border-style: dashed; }
.sync-pill.is-synced .ic { color: var(--pos); }
.sync-pill.is-pending .ic, .sync-pill.is-saving .ic, .sync-pill.is-checking .ic, .sync-pill.is-offline .ic { color: var(--warn); }
.sync-pill.is-saving .ic, .sync-pill.is-checking .ic { animation: sync-pulse 1.1s ease-in-out infinite; }
.sync-pill.is-error, .sync-pill.is-conflict { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 45%, transparent); background: var(--neg-tint); }
@keyframes sync-pulse { 50% { opacity: 0.3; } }
@media (max-width: 720px) {
  .sync-pill { width: 36px; padding: 0; justify-content: center; }
  .sync-pill .pill-label { display: none; }
}
.form-err { margin-top: 16px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--neg-tint); color: var(--neg); font-size: 0.86rem; font-weight: 500; }
.form-err:empty { display: none; }
.dlg-body .intro a { font-weight: 500; }
.dlg-foot.wrap { flex-wrap: wrap; row-gap: 4px; }
.dlg-foot.wrap .btn.quiet { order: 2; flex-basis: 100%; justify-content: flex-start; padding-left: 0; background: none; color: var(--accent); }
.dlg-foot.wrap .btn.quiet:hover { text-decoration: underline; text-underline-offset: 3px; }
[aria-busy="true"] .btn.primary { cursor: progress; }

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

@media print {
  body::before, .topbar, .footer, .head-actions, .row-actions, .goal-actions, .controls { display: none !important; }
  .panel { break-inside: avoid; }
}

@media (max-width: 480px) {
  .panel { padding: 16px 16px 18px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
}
