/* The maclaine.se copy only: the site's Lav look on top of styles.css.
   publish-site.mjs links this after styles.css, together with /assets/tokens.css
   ([data-look="lav"]: palette, hairline, type roles), /fonts/fonts.css (DM Sans) and
   /assets/chrome.css (the shared header and footer). The local app never loads it.

   Everything here wins by order over styles.css, so selectors keep the same weight as
   the rules they replace. The variables are set on :root[data-mode="web"], one step
   stronger than both styles.css's :root and tokens.css's [data-look="lav"].

   Chart series keep Net worth's own families (pine, ochre, slate, Falu red, moss),
   stepped to sit on the Lav grounds: every slot is 3:1 or more against the ground and
   the surface in both themes, and the set passes the dataviz palette checks
   (lightness band, chroma floor, colour blind and normal vision separation). */

:root[data-mode="web"] {
  color-scheme: light;
  --bg: var(--p-lav-150);
  --paper: var(--p-lav-100);
  --ink: var(--p-lav-950);
  --ink-2: var(--p-lav-750);
  --ink-3: #444A44;
  --rule: var(--p-lav-300);
  --rule-strong: #5E6560;      /* control outlines, 3.4:1 on the ground */
  --mark: #D3DAD2;             /* a changed row on Update, the example bar */
  --mark-edge: #5E6560;
  --up: #1F5C33;
  --down: #8A2A22;
  --debt: #5E6560;
  --fall: #9B4F5A;
  --stale: #6B4A00;
  --placeholder: #4D544D;      /* the faded last figure, 4.9:1 on the surface */

  --series-1: #007A5C;
  --series-2: #8A540E;
  --series-3: #4256A1;
  --series-4: #9B4F5A;
  --series-5: #42660D;

  --font: var(--sans);
  --step--1: 14px;
  --step-0: 16px;
  --step-1: 20px;
  --step-2: var(--t-statement);
  --step-hero: var(--t-display);
}
:root[data-mode="web"][data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--p-lav-850);
  --paper: var(--p-lav-800);
  --ink: var(--p-lav-50);
  --ink-2: var(--p-lav-250);
  --ink-3: #959D95;
  --rule: var(--p-lav-700);
  --rule-strong: #7B827B;
  --mark: #343C35;
  --mark-edge: #7B827B;
  --up: #8BC99A;
  --down: #F09A92;
  --debt: #7B827B;
  --fall: #C9636F;
  --stale: #E2B65C;
  --placeholder: #959D95;

  --series-1: #2FA688;
  --series-2: #B8752A;
  --series-3: #4F8FD0;
  --series-4: #C9636F;
  --series-5: #8E9D2F;
}

/* ── Base ── */
html { font-optical-sizing: auto; }
body { font-size: var(--step-0); line-height: 1.5; letter-spacing: -0.005em; }
b, strong { font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: var(--maxw); padding: 0 var(--gutter); }
main.wrap { padding-top: 64px; padding-bottom: 88px; }

/* Type roles. One typeface, light 300 from 44 px up, regular below. */
h2 { font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); font-weight: 400; }
.view-title { font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; margin-left: -0.04em; }
.sub { color: var(--ink-2); margin: 12px 0 0; max-width: 40em; text-wrap: pretty; }
.muted { color: var(--ink-3); }

/* ── The app's own bar: under the site header, on the same grid. "Net worth" sits on the
   name's axis, the tabs start on column 7 like the site nav, and the current tab carries
   the site's 1 px underline. ── */
.app-top { border-bottom: 1px solid var(--hairline); background: transparent; }
.app-top .wrap {
  height: 64px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 16px; align-items: center;
  font-size: var(--t-ui); line-height: var(--lh-ui);
}
.brand { grid-column: 1 / span 4; margin: 0; font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: 400; letter-spacing: 0; color: var(--ink); }
nav.tabs { grid-column: 7 / span 4; display: flex; gap: 28px; height: 100%; }
nav.tabs button {
  height: 100%; padding: 0; font-weight: 400; color: var(--ink-2);
  border-bottom: 1px solid transparent; margin-bottom: -1px; transition: color .2s var(--ease), border-color .2s var(--ease);
}
nav.tabs button:hover { color: var(--ink); }
nav.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
nav.tabs button:focus-visible { outline-offset: -2px; }
.head-right { grid-column: 11 / -1; justify-self: end; white-space: nowrap; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); color: var(--ink-2); gap: 16px; }
.chip-btn { min-height: 32px; padding: 0 14px; border: 1px solid var(--rule-strong); border-radius: 999px; font-size: var(--t-caption); color: var(--ink); }
.chip-btn:hover { border-color: var(--ink); }

.demo-bar { background: var(--paper); border-bottom: 1px solid var(--hairline); font-size: var(--t-ui); color: var(--ink-2); }
.demo-bar .wrap { padding-top: 12px; padding-bottom: 12px; justify-content: flex-start; gap: 24px; }

/* ── Controls: the homepage's switch (a pill outline, the chosen one filled with ink), and
   buttons in the same shape so a page of them reads as one family. ── */
.seg { border: 1px solid var(--rule-strong); border-radius: 999px; padding: 2px; background: transparent; gap: 2px; }
.seg button { white-space: nowrap; min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: var(--t-ui); font-weight: 400; color: var(--ink-2); transition: background-color .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.btn {
  min-height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  font-size: var(--t-ui); font-weight: 400; display: inline-flex; align-items: center; justify-content: center;
}
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); font-weight: 400; }
.btn.quiet:hover { border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--down); border-color: var(--rule-strong); font-weight: 400; }
.btn.danger:hover { border-color: var(--down); }
.btn.small { min-height: 32px; padding: 0 14px; font-size: var(--t-ui); }
.link { color: var(--ink-2); font-size: var(--t-ui); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover { color: var(--ink); }

input, select, textarea { accent-color: var(--ink); }
.money input, .note-in, .num-in, .add-form input[type=text], .add-form select, .update-head .rate input,
.h-detail table.data td input, select, input[type=date] {
  border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper); color: var(--ink);
}
.money input, .note-in, .add-form input[type=text], .add-form select, select { min-height: 40px; }
select { padding: 0 12px; }
.money input:focus, .note-in:focus, .num-in:focus, select:focus, input[type=date]:focus { border-color: var(--ink); outline: none; }
.money input:focus-visible, .note-in:focus-visible, .num-in:focus-visible, select:focus-visible, input[type=date]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.money .cur { color: var(--ink-2); }
.money .cap { color: var(--ink-2); }

/* ── Overview: the figure and the main chart share one frame, the way the homepage frames
   its captures (28 px radius, the surface colour). The chart's 2 px gaps and dot rings
   are drawn in --bg, so inside the frame --bg becomes the surface. Everything below the
   frame sits on the ground between hairlines. ── */
.hero, .ov-chart { --bg: var(--paper); background: var(--paper); }
.hero { padding: 48px 48px 0; border-radius: 28px 28px 0 0; align-items: start; }
.ov-chart { padding: 48px 48px 40px; border-radius: 0 0 28px 28px; }
.ov-chart .chart-bar { margin-top: 0; }
#v-overview .hero:has(+ #ov-body[hidden]) { border-radius: 28px; padding-bottom: 48px; }
.hero-number { font-size: var(--t-display); line-height: var(--lh-display); letter-spacing: var(--tr-display); font-weight: 300; margin-left: -0.05em; }
.hero-number .unit { font-size: 0.32em; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-2); margin-left: 0.22em; }
.hero-lines { margin-top: 28px; font-size: var(--t-body); line-height: var(--lh-body); color: var(--ink-2); max-width: 34em; }
.hero-lines p { margin: 0; }
.hero .empty { padding: 8px 0 0; }
.hero .empty h2 { font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; margin-left: -0.04em; }
.hero .empty .sub { font-size: var(--t-body); line-height: var(--lh-body); margin-top: 20px; max-width: 30em; }
.hero .empty p:last-child { margin-top: 28px; }
.chart-bar { margin: 48px 0 16px; gap: 16px; }
.chart-bar .right { gap: 20px; }
.legend { font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); color: var(--ink-2); gap: 20px; margin-bottom: 12px; }
.swatch { border-radius: 2px; }
#hero-est { margin-top: 20px !important; font-size: var(--t-caption); line-height: var(--lh-caption); }
#hero-est .link { font-size: inherit; }

.chart .axis text { fill: var(--ink-2); font-size: var(--t-caption); font-family: var(--font); }
.chart svg text { font-family: var(--font); font-weight: 400; }
.chart .grid line { stroke: var(--rule); }
.chart .zero { stroke: var(--rule-strong); }
.tip { background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 12px; box-shadow: none; font-size: var(--t-caption); line-height: var(--lh-caption); padding: 10px 14px; }
.tip .when { color: var(--ink-2); }
.tip .row.total { border-top-color: var(--hairline); font-weight: 400; color: var(--ink); }

/* Sections: air first, then a hairline, then the name in the Statement size. */
.block, .split, .accounts { margin-top: 112px; padding-top: 40px; border-top: 1px solid var(--hairline); }
.block .chart { margin-top: 28px; }
#v-overview .ov-chart + .block { margin-top: 96px; }
.stats { gap: 24px 72px; margin-top: 36px; }
.stat .n { font-size: var(--t-title); line-height: 1; letter-spacing: var(--tr-title); font-weight: 300; }
.stat .n .unit, .asset .a-gain .unit { font-size: 0.4em; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-2); }
.stat .l { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--ink-2); margin-top: 10px; }
#pay-note, #wf-sub, #mm-sub { color: var(--ink-2); }

.goal .goal-top { gap: 20px; }
.goal .goal-track { height: 12px; margin-top: 32px; background: color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 999px; }
.goal .goal-fill { border-radius: 999px; }
.goal .goal-ticks { font-size: var(--t-caption); color: var(--ink-2); margin-top: 10px; }
.goal .goal-lines { margin-top: 20px; font-size: var(--t-body); line-height: var(--lh-body); max-width: 34em; }

.years { gap: 4px; margin-top: 28px; }
.years i { height: 32px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 9%, transparent); }
.years i.need { outline-color: var(--ink-2); outline-style: dashed; outline-width: 1.5px; }
.years-axis { font-size: var(--t-caption); color: var(--ink-2); }
.ent-top { margin-top: 28px; }
.ent-top .n { font-size: var(--t-title); line-height: 1; letter-spacing: var(--tr-title); font-weight: 300; }
.ent-lines { color: var(--ink-2); margin-top: 20px; max-width: 48em; }

.asset { padding: 36px 0; border-top-color: var(--hairline); gap: 48px; }
.asset .a-name { font-size: var(--step-1); font-weight: 400; }
.asset .a-name span { color: var(--ink-2); }
.asset .a-gain { font-size: var(--t-title); line-height: 1; letter-spacing: var(--tr-title); font-weight: 300; margin-top: 16px; }
.asset .a-lines { color: var(--ink-2); margin-top: 14px; }

.split { gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 96px; }
.bars { margin-top: 28px; gap: 16px; }
.bar-row .label { color: var(--ink); }
.bar-row .pct { color: var(--ink-2); }
.bar-row .track { height: 8px; }
.bar-row .fill { border-radius: 0 999px 999px 0; }

/* Lists: rows between hairlines, the names in ink and everything else muted. */
.accounts-head h2, .accounts-head { align-items: baseline; }
.group-title { margin: 40px 0 6px; font-size: var(--t-ui); font-weight: 400; color: var(--ink-2); padding: 0; }
.acc-row, .h-row, .hh-row { padding-left: 0; padding-right: 0; border-top-color: var(--hairline); min-height: 56px; transition: background-color .2s; }
.acc-row:hover, .h-row:hover, .hh-row:hover { background: color-mix(in srgb, var(--paper) 55%, transparent); }
.acc-row .name, .u-row .name, .hh-row .k { font-weight: 400; color: var(--ink); }
.acc-row .prov, .u-row .prov, .hh-row .p, .acc-row .when, .h-row .when span, .hh-row .r { color: var(--ink-2); }
.acc-row .when.stale, .hh-row .r.soon { color: var(--stale); }
.acc-row.archived { opacity: 0.7; }
.acc-detail, .h-detail { background: var(--paper); border-top: 1px solid var(--hairline); border-radius: 0 0 16px 16px; padding-left: 20px; padding-right: 20px; }
.acc-detail .facts b { font-weight: 400; }
.h-row .when b { font-weight: 400; }
.h-row .what { color: var(--ink-2); }
.h-list { border-bottom-color: var(--hairline); margin-top: 40px; }
table.data th { font-weight: 400; color: var(--ink-2); }
table.data th, table.data td { border-bottom-color: var(--hairline); }
.table-scroll { border-top-color: var(--hairline); }
.tag { border-color: var(--ink-2); border-radius: 999px; padding: 0 7px; color: var(--ink-2); font-size: 12px; }
.est { color: var(--ink-2); }

/* ── Update ── */
.update-head { gap: 28px; align-items: flex-end; }
.update-head .sub { margin-top: 16px; }
.update-head .rate { font-size: var(--t-ui); color: var(--ink-2); gap: 10px; }
.u-group { margin-top: 56px; }
.u-group h3 { font-size: var(--t-ui); font-weight: 400; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.u-row { padding: 12px 0; border-top-color: var(--hairline); }
.u-row:last-child { border-bottom-color: var(--hairline); }
.u-row.changed { background: var(--mark); border-top-color: var(--hairline); box-shadow: inset 2px 0 0 var(--ink); padding-left: 14px; padding-right: 14px; }
.u-row .chg .was { color: var(--ink-2); }
.add-form { border: 0; border-radius: 28px; background: var(--paper); padding: 32px; gap: 20px 24px; margin-top: 16px; }
.add-form label.f, .add-form .f { color: var(--ink-2); font-size: var(--t-ui) !important; }
.add-form .hint { color: var(--ink-2); font-size: var(--t-caption); }
.add-form .seg { background: transparent; }
.savebar { background: var(--bg); border-top: 1px solid var(--hairline); z-index: 15; }
.savebar .summary { color: var(--ink-2); }
.savebar .summary b { font-weight: 400; color: var(--ink); }

/* ── Household and Settings ── */
.check > div { border-top-color: var(--hairline); padding-left: 0; }
.check .h { color: var(--ink-2); }
.check .no, .check .why { color: var(--ink-2); }
.check .yes::before { font-weight: 400; }
.set-group { margin-top: 64px; padding-top: 32px; border-top-color: var(--hairline); max-width: 52em; }
.set-group h3 { font-size: var(--step-1); font-weight: 400; letter-spacing: -0.01em; }
.set-check b { font-weight: 400; }
.set-check input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; }
.path { background: var(--paper); border: 0; border-radius: 10px; color: var(--ink-2); }
#csv-file { font-size: var(--t-ui); color: var(--ink-2); max-width: 100%; }
#csv-file::file-selector-button { font: inherit; min-height: 32px; padding: 0 14px; margin-right: 12px; border: 1px solid var(--rule-strong); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }

/* The note under the app: its own words, as a caption, with the only accent link on the page. */
.web-foot { margin-top: 152px; padding: 0; border-top: 0; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); color: var(--ink-2); max-width: 44em; }
.web-foot a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.web-foot a:hover { text-decoration-thickness: 2px; }

.toast { background: var(--ink); color: var(--bg); border-radius: 999px; font-weight: 400; font-size: var(--t-ui); padding: 12px 20px; }
dialog.welcome { max-width: 540px; border: 0; border-radius: 28px; padding: 40px 40px 32px; background: var(--paper); color: var(--ink); box-shadow: none; }
dialog.welcome::backdrop { background: rgb(22 26 22 / 0.45); }
dialog.welcome h2 { font-size: clamp(28px, 24px + 0.6vw, 32px); line-height: 1.12; letter-spacing: var(--tr-statement); font-weight: 400; margin: 0 0 20px; padding-right: 32px; }
dialog.welcome p { color: var(--ink-2); }
dialog.welcome .close { top: 16px; right: 16px; width: 44px; height: 44px; padding: 0; color: var(--ink-2); }

/* ── Between a laptop and 1440 the tabs start further left, like the site nav ── */
@media (max-width: 1199px) {
  nav.tabs { grid-column: 5 / span 5; }
  .head-right { grid-column: 10 / -1; }
  /* with figures hidden, the Show figures button takes the place of the date */
  .head-right:has(#unhide:not([hidden])) .last-update { display: none; }
}

/* ── Phones and small tablets: one column on the 20 px gutter, 44 px targets ── */
@media (max-width: 860px) {
  main.wrap { padding-top: 40px; }
  .app-top .wrap { height: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding-top: 20px; }
  .brand { flex: 1; font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
  .head-right { gap: 12px; }
  nav.tabs {
    order: 3; flex: 1 0 100%; height: 52px; gap: 24px; margin: 8px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter);
    overflow-x: auto; scrollbar-width: none;
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs button { min-height: 44px; flex: none; }
  .chip-btn, .seg button, .btn, .btn.small { min-height: 44px; }
  .money input, .note-in, .add-form input[type=text], .add-form select, select, input[type=date] { min-height: 44px; }
  .link { min-height: 44px; display: inline-flex; align-items: center; }
  .update-head .rate { margin-left: 0; }
  .demo-bar .wrap { flex-direction: column; align-items: flex-start; gap: 10px; }

  .hero { padding: 28px 16px 0; border-radius: 20px 20px 0 0; margin: 0 -8px; }
  .ov-chart { padding: 32px 16px 24px; border-radius: 0 0 20px 20px; margin: 0 -8px; }
  #v-overview .hero:has(+ #ov-body[hidden]) { border-radius: 20px; padding-bottom: 28px; }
  .hero-controls { margin-top: 8px; }
  .chart-bar .right { margin-left: 0; flex-wrap: wrap; }
  .seg button { padding: 0 9px; font-size: 15px; }
  .hero .seg button { padding: 0 14px; }
  .block, .split, .accounts { margin-top: 80px; padding-top: 28px; }
  #v-overview .ov-chart + .block { margin-top: 72px; }
  .stats { gap: 24px 40px; }
  .split { grid-template-columns: 1fr; row-gap: 72px; }
  .add-form { padding: 24px 20px; border-radius: 20px; }
  .u-row.changed { padding-left: 12px; padding-right: 12px; }
  .acc-detail, .h-detail { padding-left: 14px; padding-right: 14px; }
  .set-group { margin-top: 48px; }
  .web-foot { margin-top: 96px; }
  dialog.welcome { padding: 32px 24px 24px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  nav.tabs button, .seg button, .acc-row, .h-row, .hh-row { transition: none; }
}
