/* Diverse budget site. Brand tokens from the app (constants/theme.ts).
   Radius system: cards 20px, controls full pill. One accent: lime. Dark only (brand). */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #050505;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f4f5f2;
  --text-2: #9aa3ab;
  --text-3: #6f767c;
  --lime: #c9ff58;
  --lime-dark: #a8d94a;
  --danger: #ff6b6b;
  --radius: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar: 68px;
  --corner: 240px;
  --content-left: 320px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, sans-serif; font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 6px; }

/* Top bar (z: 30) */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(5, 5, 5, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; letter-spacing: 0.08em; }
.brand img { border-radius: 8px; }
.actions { display: flex; align-items: center; gap: 10px; }
.lang { display: flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.lang button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.lang button[aria-pressed="true"] { background: var(--text); color: #050505; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--lime); color: #050505; border-color: var(--lime); }
.btn.primary:hover { background: var(--lime-dark); }
.btn.lg { padding: 14px 24px; font-size: 16px; }
.btn i { font-size: 18px; }

/* Donut layer (z: 20). Positioned only with transform from app.js. */
.donut-layer {
  position: fixed; left: 0; top: 0; z-index: 20; width: 560px; height: 560px;
  transform-origin: 0 0; will-change: transform; pointer-events: none;
}
.donut-layer canvas { width: 100%; height: 100%; display: block; pointer-events: auto; cursor: pointer; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 0 30%;
}
.donut-label { font-size: 22px; color: var(--text-2); font-weight: 600; line-height: 1.2; }
.donut-value { font-size: 40px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.donut-share { font-size: 22px; color: var(--lime); font-weight: 700; }

.donut-caption {
  position: fixed; z-index: 20; top: 0; left: 0; width: var(--corner); text-align: center; pointer-events: none;
  display: grid; gap: 0; opacity: 0; will-change: transform, opacity;
}
.donut-caption span { font-size: 13px; color: var(--text-2); }
.donut-caption strong { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.2; }
.donut-caption span:last-child { color: var(--lime); font-weight: 700; }

.mobile-dock { display: none; }

/* Hero */
main { padding-top: var(--topbar); }
.hero {
  min-height: calc(100dvh - var(--topbar));
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(24px, 4vw, 64px);
  max-width: 1320px; margin: 0 auto; padding: clamp(24px, 5vw, 64px) clamp(16px, 4vw, 40px);
}
.hero h1 { font-size: clamp(36px, 4.6vw, 60px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 900; margin: 0 0 20px; max-width: 14ch; }
.hero-sub { color: var(--text-2); font-size: 18px; max-width: 42ch; margin: 0 0 32px; }
.hero-total { display: flex; flex-direction: column; gap: 4px; margin-bottom: 32px; }
.hero-total-value { font-size: clamp(44px, 6vw, 80px); font-weight: 900; letter-spacing: -0.04em; color: var(--lime); line-height: 1; }
.hero-total-meta { color: var(--text-2); font-size: 15px; }
.hero-visual { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; justify-items: center; }
.donut-anchor { width: min(420px, 100%); aspect-ratio: 1; }
.legend { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 600px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.legend button {
  width: 100%; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; border: 0; background: none; cursor: pointer; text-align: left;
  transition: background 0.2s var(--ease);
}
.legend button:hover, .legend button.is-active { background: var(--surface); }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-name { font-size: 14px; color: var(--text-2); line-height: 1.3; }
.legend-amount { font-size: 14px; font-weight: 700; }

/* Loading / error */
.state { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.state:empty { display: none; }
.state .error { border: 1px solid rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); border-radius: var(--radius); padding: 16px 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.skeleton { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Breakdown */
.breakdown { padding-left: var(--content-left); max-width: 1380px; margin: 0 auto; }
.cat {
  max-width: 820px; padding: 88px clamp(16px, 4vw, 40px) 24px;
}
.cat-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 24px; margin-bottom: 16px; }
.cat-title { display: flex; align-items: center; gap: 12px; margin: 0; font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.03em; font-weight: 900; line-height: 1.1; }
.cat-title .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.cat-amount { text-align: right; }
.cat-amount strong { display: block; font-size: clamp(28px, 3.4vw, 40px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.cat-amount span { color: var(--text-2); font-size: 14px; }
.cat-summary { color: var(--text-2); max-width: 65ch; margin: 0 0 20px; }

.items { display: grid; gap: 10px; }
.item { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; transition: border-color 0.2s var(--ease); }
.item.is-open { border-color: rgba(201, 255, 88, 0.35); }
.item-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px 12px; padding: 14px 12px 14px 20px; }
.item-toggle { display: grid; gap: 2px; border: 0; background: none; text-align: left; cursor: pointer; padding: 0; min-width: 0; }
.item-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.item-name i { font-size: 14px; color: var(--text-3); transition: transform 0.3s var(--ease); }
.item.is-open .item-name i { transform: rotate(90deg); color: var(--lime); }
.item-formula { color: var(--text-2); font-size: 14px; }
.item-amount { font-weight: 800; font-size: 17px; white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text-2); font-size: 20px; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--lime); }

.item-source { margin: 0 20px 16px; padding: 14px 16px; border-radius: 14px; background: rgba(201, 255, 88, 0.06); border: 1px solid rgba(201, 255, 88, 0.2); font-size: 14px; }
.item-source p { margin: 0 0 8px; color: var(--text); }
.item-source ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.item-source a { color: var(--lime); text-underline-offset: 3px; overflow-wrap: anywhere; }
.item-source .muted { color: var(--text-2); }

.item-detail { padding: 0 20px 20px; display: grid; gap: 14px; }
.item-detail p { margin: 0; color: var(--text-2); max-width: 65ch; }
.when { font-size: 14px; color: var(--text); display: flex; gap: 8px; align-items: center; }
.when i { color: var(--lime); }
.terms { display: grid; gap: 8px; }
.term { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.term-label { font-size: 14px; color: var(--text-2); }
.term-calc { font-size: 14px; font-weight: 700; text-align: right; }
.term-edit { grid-column: 1 / -1; display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.term-edit label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
input[type="number"], input[type="password"] {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0e0e0e; color: var(--text);
}
input:focus { border-color: var(--lime); outline: none; box-shadow: 0 0 0 3px rgba(201, 255, 88, 0.25); }

/* Edit mode */
.edit-only { display: none; }
body.editing .edit-only { display: grid; }
body.editing .term-edit { display: grid; }
.editbar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 999px;
  background: rgba(20, 20, 20, 0.92); border: 1px solid var(--border); backdrop-filter: blur(14px);
  max-width: calc(100vw - 32px); flex-wrap: wrap; justify-content: center;
}
.editbar[hidden] { display: none; }
.editbar-status { font-size: 13px; color: var(--text-2); padding: 0 10px; }
.editbar-status.error { color: var(--danger); }

.key-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: #0c0c0c; color: var(--text); padding: 28px; width: min(420px, calc(100vw - 32px)); }
.key-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.key-dialog h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -0.02em; }
.key-dialog form { display: grid; gap: 8px; }
.key-dialog label { font-size: 14px; color: var(--text); }
.key-help { font-size: 13px; color: var(--text-2); margin: 0; }
.key-error { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }
.key-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Totals */
.totals { max-width: 1380px; margin: 0 auto; padding: 120px clamp(16px, 4vw, 40px) 140px; padding-left: calc(var(--content-left) + clamp(16px, 4vw, 40px)); }
.totals h2 { font-size: clamp(32px, 4vw, 52px); letter-spacing: -0.035em; font-weight: 900; margin: 0 0 32px; line-height: 1.05; }
.totals-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.figure { display: grid; gap: 6px; align-content: start; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.figure.accent { background: var(--lime); color: #050505; border-color: var(--lime); }
.figure-label { font-size: 14px; color: var(--text-2); }
.figure.accent .figure-label, .figure.accent .figure-meta { color: #1f2a0a; }
.figure-value { font-size: clamp(28px, 3.2vw, 44px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.figure-meta { font-size: 14px; }
.rate-edit { gap: 4px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.valuation { margin-top: 48px; }
.valuation h3 { font-size: 20px; margin: 0 0 16px; letter-spacing: -0.01em; }
.valuation dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; max-width: 640px; }
.valuation dl div { border-top: 1px solid var(--border); padding-top: 12px; }
.valuation dt { font-size: 14px; color: var(--text-2); }
.valuation dd { margin: 4px 0 0; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; }
.fine { margin-top: 40px; font-size: 13px; color: var(--text-3); max-width: 65ch; }


/* References (1, 1.2) so lines can be named to the assistant */
.ref {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; margin-right: 8px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 11px; font-weight: 700; color: var(--text-2); letter-spacing: 0; vertical-align: middle;
}
.cat-title .ref { height: 24px; min-width: 28px; font-size: 13px; margin-right: 0; }
.legend-name .ref { margin-right: 6px; }

/* Visible change feedback */
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { color: var(--lime); text-shadow: 0 0 0 transparent; } 100% { color: inherit; } }
.item.changed { animation: changed 2.4s var(--ease); }
@keyframes changed { 0%, 40% { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(201, 255, 88, 0.22); } 100% { border-color: var(--border); box-shadow: none; } }

/* Assistant (z: 35). Radius: panel 20px, composer 16px, controls pill. */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 35; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px 12px 16px; border-radius: 999px; border: 0; background: var(--lime); color: #050505;
  font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 12px 32px rgba(201, 255, 88, 0.18);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(201, 255, 88, 0.26); }
.chat-fab:active { transform: scale(0.97); }
.chat-fab i { font-size: 20px; }
.chat {
  position: fixed; right: 24px; bottom: 24px; z-index: 36; width: 420px; max-width: calc(100vw - 32px);
  top: calc(var(--topbar) + 16px); height: auto;
  display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden;
  border-radius: var(--radius); background: #0b0b0b; border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: chat-in 0.35s var(--ease);
}
@keyframes chat-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@media (min-width: 1101px) {
  body.chat-open .breakdown, body.chat-open .totals { max-width: none; padding-right: 470px; }
}
.chat .editbar {
  position: static; transform: none; max-width: none; border-radius: 0; background: none; backdrop-filter: none;
  border: 0; border-top: 1px solid var(--border); padding: 10px 14px; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.chat .editbar .btn { padding: 7px 11px; font-size: 12.5px; }
.chat .editbar-status { flex: 1 1 100%; padding: 0; font-size: 12px; }
.chat .editbar-status:empty { display: none; }
.chat-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px 12px 16px 18px; border-bottom: 1px solid var(--border); }
.chat-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--lime); color: #050505; font-size: 18px; }
.chat-titles h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; }
.chat-titles p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.3; }
.chat-log { overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.intro p { margin: 0 0 14px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; transition: border-color 0.2s var(--ease), background 0.2s var(--ease); }
.chip:hover { border-color: var(--lime); background: rgba(201, 255, 88, 0.06); }
.msg { font-size: 14px; line-height: 1.6; }
.msg p { margin: 0; }
.msg.user { align-self: flex-end; max-width: 85%; background: var(--lime); color: #050505; padding: 10px 14px; border-radius: 18px 18px 6px 18px; font-weight: 500; }
.msg.bot { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; max-width: 100%; }
.msg-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(201, 255, 88, 0.12); color: var(--lime); font-size: 14px; margin-top: 1px; }
.msg-body { min-width: 0; padding-top: 2px; }
.msg.error .msg-body { color: var(--danger); }
.typing { color: var(--text-2); display: inline-flex; align-items: center; gap: 3px; }
.typing span { width: 4px; height: 4px; border-radius: 50%; background: var(--text-2); animation: dot 1.2s infinite var(--ease); }
.typing span:first-of-type { margin-left: 4px; }
.typing span:nth-of-type(2) { animation-delay: 0.15s; }
.typing span:nth-of-type(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.changes { list-style: none; margin: 12px 0 0; padding: 4px; display: grid; gap: 2px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, 0.02); }
.changes button { width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; text-align: left; border: 0; border-radius: 10px; background: none; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.changes button:hover { background: rgba(201, 255, 88, 0.07); }
.changes .ref { margin: 0; grid-row: span 2; }
.change-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changes .delta { color: var(--lime); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.chat-form { padding: 12px 14px 14px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.16); background: #131313; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.composer:focus-within { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(201, 255, 88, 0.18); }
.composer textarea { resize: none; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; padding: 6px 0; max-height: 140px; }
.composer textarea::placeholder { color: var(--text-3); }
.send { width: 36px; height: 36px; border-radius: 999px; border: 0; background: var(--lime); color: #050505; display: grid; place-items: center; font-size: 18px; cursor: pointer; transition: transform 0.2s var(--ease); }
.send:active { transform: scale(0.94); }
.send:disabled { opacity: 0.45; cursor: wait; }
.composer-hint { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Collapsible levels: section > lines > detail */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease); }
.collapse.open { grid-template-rows: 1fr; }
.collapse-inner { overflow: hidden; min-height: 0; }
body.instant .collapse { transition: none; }
.lines-toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.lines-toggle:hover { border-color: rgba(201, 255, 88, 0.5); }
.lines-toggle i { font-size: 16px; color: var(--lime); transition: transform 0.35s var(--ease); }
.lines-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.lines-toggle .lines-close, .lines-toggle[aria-expanded="true"] .lines-open { display: none; }
.lines-toggle[aria-expanded="true"] .lines-close { display: inline; }
.cat .items { padding-top: 20px; }

/* Currency selector */
.currency { position: relative; display: inline-flex; align-items: center; }
.currency select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 32px 8px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.currency select:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.currency i { position: absolute; right: 12px; pointer-events: none; font-size: 13px; color: var(--text-2); }
.currency option { background: #111; }

/* Donut tooltip (z: 50) */
.donut-tip {
  position: fixed; left: 0; top: 0; z-index: 50; width: 260px; pointer-events: none;
  display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px;
  background: rgba(14, 14, 14, 0.96); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.tip-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.tip-head .ref { margin: 0; }
.donut-tip strong { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.2; }
.tip-meta { font-size: 12px; color: var(--lime); font-weight: 600; }
.tip-summary { font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin-top: 4px; }
.tip-cta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* Reveal on enter */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  :root { --content-left: 0px; --corner: 120px; }
  .breakdown { padding-left: 0; }
  .cat { padding-top: 72px; }
  .totals-grid { grid-template-columns: 1fr 1fr; }
  .figure.accent { grid-column: 1 / -1; }
  .legend { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  :root { --topbar: 60px; --corner: 48px; }
  html { scroll-padding-top: calc(var(--topbar) + 76px); }
  .mobile-dock {
    display: block; position: fixed; z-index: 19; left: 0; right: 0; top: var(--topbar); height: 60px; opacity: 0;
    background: rgba(5, 5, 5, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border); pointer-events: none;
  }
  .donut-caption { width: auto; text-align: left; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
  .donut-caption strong { font-size: 16px; }
  .donut-caption span { font-size: 13px; }
  .btn span { display: none; }
  .btn { padding: 10px 12px; }
  .brand span { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .hero-visual { order: -1; }
  .donut-anchor { width: min(300px, 80vw); }
  .cat { min-height: 0; padding-top: 88px; }
  .cat-head { grid-template-columns: 1fr; }
  .cat-amount { text-align: left; }
  .item-row { padding-left: 14px; }
  .term-edit { grid-template-columns: 1fr 1fr 1fr; }
  .totals { padding-left: clamp(16px, 4vw, 40px); }
  .totals-grid { grid-template-columns: 1fr; }
  .valuation dl { grid-template-columns: 1fr; }
  .chat-fab { right: 16px; bottom: 16px; padding: 14px; }
  .chat-fab span { display: none; }
  body.editing .chat-fab { bottom: 132px; }
  .chat { right: 8px; left: 8px; width: auto; max-width: none; bottom: 8px; top: auto; height: min(78dvh, 600px); z-index: 45; }
  .currency select { padding: 8px 26px 8px 10px; }
  .currency i { right: 9px; }
  .lang button { padding: 6px 9px; }
  .donut-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .skeleton, .flash, .item.changed, .typing span, .chat { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
