:root {
  --brand: #9D1B08;
  --brand-2: #BB5006;
  --accent: #E19513;
  --bg: #FEFCF8;
  --surface: #FFFFFF;
  --sand: #E1DED1;
  --ink: #181410;
  --ink-2: #3D3D32;
  --muted: #6E6A5E;
  --line: #E9E5D9;
  --chart: #9D1B08;
  --chart-fill: rgba(157, 27, 8, 0.08);
  --up: #3F6B3A;
  --down: #9D1B08;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 20, 16, 0.04), 0 4px 16px rgba(24, 20, 16, 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181410;
    --surface: #211C17;
    --sand: #2E2821;
    --ink: #F4F0E6;
    --ink-2: #D9D3C4;
    --muted: #A69F8E;
    --line: #342D25;
    --brand: #E06A4F;
    --chart: #E06A4F;
    --chart-fill: rgba(224, 106, 79, 0.12);
    --up: #8DBF83;
    --down: #E06A4F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #181410; --surface: #211C17; --sand: #2E2821; --ink: #F4F0E6; --ink-2: #D9D3C4;
  --muted: #A69F8E; --line: #342D25; --brand: #E06A4F; --chart: #E06A4F;
  --chart-fill: rgba(224, 106, 79, 0.12); --up: #8DBF83; --down: #E06A4F; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; font-weight: 500; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; margin-bottom: 0.9rem; }
h3 { font-size: 1.1rem; }
a { color: var(--brand); }
p { margin: 0 0 0.8rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 16px 80px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.masthead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.masthead .meta { color: var(--muted); font-size: 0.9rem; }
.brandmark { font-family: "Playfair Display", serif; font-style: italic; color: var(--brand); font-size: 1rem; }

section { margin-bottom: 44px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile .label { font-size: 0.8rem; color: var(--muted); }
.tile .value { font-family: "Playfair Display", serif; font-size: 1.9rem; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .delta { font-size: 0.82rem; margin-top: 2px; color: var(--muted); }
.delta.up { color: var(--up); }
.delta.down { color: var(--muted); }

.read { font-size: 1.05rem; }
.read p:last-child { margin-bottom: 0; }
.signoff { color: var(--muted); font-style: italic; margin-top: 12px; font-size: 0.92rem; }

ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 12px 0; border-top: 1px solid var(--line); }
ul.clean li:first-child { border-top: 0; padding-top: 0; }
.sugg-title { font-weight: 600; }
.sugg-why { color: var(--ink-2); font-size: 0.95rem; }

.account { margin-bottom: 28px; }
.account-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-block; white-space: nowrap; font-size: 0.75rem; padding: 2px 10px; border-radius: 999px; background: var(--sand); color: var(--ink-2); }
.pill.warn { background: rgba(225, 149, 19, 0.18); color: var(--ink); }

.chart-card { margin-top: 16px; }
.chart-title { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: "Outfit", sans-serif; }
.chart .series { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); stroke: none; }
.chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity 0.12s; }
.tooltip.show { opacity: 1; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 0.8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 600px; }

.post { display: flex; justify-content: space-between; gap: 12px; }
.post .cap { color: var(--ink-2); font-size: 0.92rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post .stat { white-space: nowrap; font-size: 0.85rem; color: var(--muted); text-align: right; }

blockquote { margin: 0; padding: 10px 0 10px 16px; border-left: 3px solid var(--accent); color: var(--ink-2); }
blockquote cite { display: block; font-size: 0.8rem; color: var(--muted); font-style: normal; margin-top: 4px; }

select, input, button { font: inherit; }
select, input[type="password"] { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
button { background: var(--brand); color: #FEFCF8; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; }
button.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gate { max-width: 420px; margin: 12vh auto; text-align: center; }
.gate form { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.notice { color: var(--muted); text-align: center; padding: 60px 16px; }
.error { color: var(--down); }

.client-row { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr) auto; gap: 12px; align-items: center; }
.client-row + .client-row { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.client-row .name { font-family: "Playfair Display", serif; font-size: 1.15rem; }
.client-row .k { font-size: 0.75rem; color: var(--muted); }
.client-row .v { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .client-row { grid-template-columns: 1fr 1fr; }
  .client-row .name, .client-row .actions { grid-column: 1 / -1; }
}
.footer { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 60px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Laws of UX additions */
.tiles4 { grid-template-columns: repeat(4, 1fr); }
.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 720px) { .tiles4 { grid-template-columns: repeat(2, 1fr); } }
.headline { font-family: "Playfair Display", Georgia, serif; font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.35; margin: 0 0 20px; color: var(--ink); }
.jump { display: flex; flex-wrap: wrap; gap: 6px 4px; margin: -12px 0 32px; }
.jump a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 0.9rem; border: 1px solid var(--line); background: var(--surface); }
.jump a:hover { border-color: var(--brand); color: var(--brand); }
.secondary { color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }
.standout { display: block; margin-top: 16px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); text-decoration: none; color: var(--ink); min-height: 44px; }
.standout:hover { border-color: var(--accent); }
.standout .cap { font-family: "Playfair Display", Georgia, serif; font-size: 1.15rem; margin: 4px 0 6px; }
.standout .stat { color: var(--muted); font-size: 0.85rem; }
ul.posts { margin-top: 8px; }
ul.posts li { padding: 0; border-top: 1px solid var(--line); }
a.post { display: flex; justify-content: space-between; gap: 12px; min-height: 44px; align-items: center; padding: 10px 4px; text-decoration: none; color: var(--ink-2); }
a.post:hover .cap { color: var(--brand); }
a.post .cap { font-size: 0.92rem; }
.defs { margin-top: 8px; color: var(--ink-2); font-size: 0.92rem; }
.defs summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
.defs dl { margin: 0 0 8px; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.defs dt { font-weight: 500; }
.defs dd { margin: 0; }
.goal .label { font-size: 0.8rem; color: var(--muted); }
.goal .value { font-family: "Playfair Display", serif; font-size: 1.6rem; }
.goal .of { color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: var(--sand); overflow: hidden; margin: 8px 0 6px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.goal-note { font-size: 0.85rem; color: var(--ink-2); }
.idea { position: relative; }
.idea-n { font-family: "Playfair Display", serif; color: var(--brand); font-size: 1.4rem; line-height: 1; margin-bottom: 8px; }
.closing { border-top: 4px solid var(--brand); }
.closing ol { padding-left: 20px; margin: 12px 0 20px; }
.closing li { margin-bottom: 8px; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 10px; background: var(--brand); color: #FEFCF8; text-decoration: none; font-weight: 500; }
:root[data-theme="dark"] .btn { color: #181410; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn, :root:not([data-theme="light"]) button:not(.ghost):not([role=tab]):not(.seg-btn) { color: #181410; } }
select, button { min-height: 44px; }
section[id] { scroll-margin-top: 16px; }

/* Tabs: one screen at a time, no long scroll */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 28px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0 16px; min-height: 48px; white-space: nowrap; font-weight: 500; }
.tabs [role=tab]:hover { color: var(--ink); }
.tabs [role=tab][aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }
.panel { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.overview-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-top: 16px; }
.ov-side { display: grid; gap: 16px; align-content: start; }
.ov-side .standout { margin-top: 0; }
@media (max-width: 820px) { .overview-grid { grid-template-columns: 1fr; } }
.closing { margin-top: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.seg-btn { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; }
.seg-btn.on { border-color: var(--brand); color: var(--brand); }
.grid.two > .standout { margin-top: 0; }

.wrap { padding-top: 24px; }
.masthead { padding-bottom: 16px; margin-bottom: 20px; }
.tabs { margin: 0 0 22px; }
.headline { margin-bottom: 16px; }
.ov-main { display: grid; gap: 16px; align-content: start; }
.ov-main .closing { margin-top: 0; }
.goal { padding: 16px 18px; }
.goal .value { font-size: 1.35rem; }
.footer { margin-top: 36px; }
