/* Design direction B — Warm & Personal (switched from A — Editorial on Nov 20 to make the site feel livelier).
   Colors, fonts, corners and shadows are defined once here as variables, so every page shares them
   and dark mode only has to swap the values. */

:root {
  --bg: #fbf6ef;
  --surface: #ffffff;
  --ink: #2b2420;
  --muted: #74675d;
  --rule: #efe5d9;
  /* Four friendly colors. "-soft" is a pale background, "-ink" a darker shade that stays readable as small text. */
  --accent: #d9643a;  --accent-soft: #fbe3d6;  --accent-ink: #b0461d;   /* orange: news, buttons */
  --sage: #6f8f72;    --sage-soft: #e3ece2;    --sage-ink: #4b6b4f;     /* green: recipes */
  --sky: #5b84b1;     --sky-soft: #e0eaf5;     --sky-ink: #3c6591;      /* blue: budget */
  --butter: #e2a93b;  --butter-soft: #fbeed0;  --butter-ink: #8f6215;   /* yellow: bio */
  --plum: #8a6bb8;    --plum-soft: #ece4f6;    --plum-ink: #6a4a99;     /* purple: journal */
  --teal: #2f8f86;    --teal-soft: #dcefec;    --teal-ink: #1d6b64;     /* teal: jobs */
  --indigo: #5b5fc7;  --indigo-soft: #e6e6f8;  --indigo-ink: #4245a6;   /* indigo: agents */
  --btn-bg: #b0461d;  --btn-ink: #ffffff;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .08);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, .06), 0 18px 40px rgba(60, 40, 20, .15);
  /* Phase 1 design system (Nov 25): every size on the site comes from these three scales. */
  /* Type: 7 sizes, roughly a 1.25 ratio. Body is --fs-md; inputs never go below 16px (stops iPhone zoom). */
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 25px; --fs-2xl: 40px;
  --fs-3xl: clamp(40px, 5.5vw, 60px);
  /* Spacing: an 8px grid (4px for the tightest gaps). Corners: three radii, plus 999px pills and 50% circles. */
  --r-sm: 12px; --r-md: 18px; --r-lg: 24px;
  --radius: var(--r-lg);
  --radius-sm: var(--r-sm);
  --display: "Fraunces", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --width: 1080px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* The current section's color. <body> gets a class like "section-news" that swaps it (see below). */
  --tint: var(--accent);  --tint-soft: var(--accent-soft);  --tint-ink: var(--accent-ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --surface: #26211d;
    --ink: #f3ebe2;
    --muted: #b3a597;
    --rule: #3a322b;
    --accent: #f08a5d;  --accent-soft: #3d2a20;  --accent-ink: #f6a582;
    --sage: #9dbb9f;    --sage-soft: #263028;    --sage-ink: #b4d0b6;
    --sky: #8fb3dd;     --sky-soft: #1f2a36;     --sky-ink: #a9c6e8;
    --butter: #e8c26a;  --butter-soft: #352d1a;  --butter-ink: #efd08c;
    --plum: #b9a0e0;    --plum-soft: #2c2438;    --plum-ink: #cdb8ee;
    --teal: #7cc9bf;    --teal-soft: #1b2f2d;    --teal-ink: #9fdad1;
    --indigo: #a5a8f0;  --indigo-soft: #25253d;  --indigo-ink: #c0c2f5;
    --btn-bg: #f08a5d;  --btn-ink: #1c1815;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px rgba(0, 0, 0, .5);
  }
}

/* Section colors: the page's kicker, highlight, background glow and links all follow these. */
.section-news, .tone-orange { --tint: var(--accent); --tint-soft: var(--accent-soft); --tint-ink: var(--accent-ink); }
.section-recipes, .section-photos, .tone-sage { --tint: var(--sage); --tint-soft: var(--sage-soft); --tint-ink: var(--sage-ink); }
.section-budget, .section-auth, .tone-sky { --tint: var(--sky); --tint-soft: var(--sky-soft); --tint-ink: var(--sky-ink); }
.section-bio, .tone-butter { --tint: var(--butter); --tint-soft: var(--butter-soft); --tint-ink: var(--butter-ink); }
.section-journal, .tone-plum { --tint: var(--plum); --tint-soft: var(--plum-soft); --tint-ink: var(--plum-ink); }
.section-jobs, .tone-teal { --tint: var(--teal); --tint-soft: var(--teal-soft); --tint-ink: var(--teal-ink); }
.section-agents, .tone-indigo { --tint: var(--indigo); --tint-soft: var(--indigo-soft); --tint-ink: var(--indigo-ink); }

/* Smooth cross-fade when moving between pages (Chrome, Edge and Safari; other browsers just load normally). */
@view-transition { navigation: auto; }

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }               /* keep text size steady when rotating a phone */
/* The soft color glows behind headings hang off the right edge on purpose. Clipping on both html and
   body (not just body) makes the body itself cut them off, so phones can't be dragged sideways. */
html { overflow-x: clip; }
body { background: var(--bg); color: var(--ink); font: var(--fs-md)/1.6 var(--sans); overflow-x: clip;
       -webkit-tap-highlight-color: transparent; }     /* no grey flash on tap */
a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--tint-soft); color: var(--ink); }
.wrap { max-width: var(--width); margin: 0 auto; padding: 0 24px; }

/* ---------- Header: a floating pill that stays at the top while scrolling ---------- */
.site-header { position: sticky; top: 12px; z-index: 20; margin-top: 12px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 8px 8px 24px;
       border-radius: 999px; background: color-mix(in srgb, var(--surface) 82%, transparent);
       -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
       border: 1px solid color-mix(in srgb, var(--rule) 70%, transparent); box-shadow: var(--shadow); }
.logo { font: 700 var(--fs-lg) var(--display); letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--accent); }
.site-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.site-nav a { padding: 8px 16px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 500; text-decoration: none;
              white-space: nowrap; transition: background .2s, color .2s; }
.site-nav a:hover { background: var(--tint-soft); }
.site-nav a.active { background: var(--ink); color: var(--bg); }

/* ---------- Shared type ---------- */
.kicker { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--tint-soft); color: var(--tint-ink);
          font-size: var(--fs-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
h1 { font: 700 var(--fs-3xl)/1.08 var(--display); letter-spacing: -0.02em; margin: 16px 0 16px; }
/* The emphasized words get a highlighter stroke that sweeps in after the page loads. */
h1 em { font-weight: 600; padding: 0 .06em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
        background: linear-gradient(transparent 60%, var(--tint-soft) 60%) no-repeat 0 0 / 0% 100%;
        animation: highlight 1s var(--ease) .7s forwards; }
.lede { font-size: var(--fs-lg); color: var(--muted); max-width: 46ch; }
.section-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
                 font: 700 var(--fs-lg)/1.3 var(--display); margin-bottom: 16px; }
.section-label span { font: 400 var(--fs-sm) var(--sans); color: var(--muted); }
.muted { color: var(--muted); }
.narrow { max-width: 480px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Little rounded labels ("Updated 2 hours ago", "Covered by 4 sources"). */
.pill, .badge { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: var(--tint-soft);
                color: var(--tint-ink); font-weight: 700; white-space: nowrap; }
.pill { margin-top: 16px; padding: 4px 12px; font-size: var(--fs-sm); }
.badge { padding: 4px 8px; font-size: var(--fs-xs); vertical-align: 1px; background: var(--accent-soft); color: var(--accent-ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--surface);
        box-shadow: var(--shadow); font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.chip .dot { color: #3fae5a; }

/* Links with an underline that grows on hover. */
.text-link { display: inline-block; margin-top: 20px; font-weight: 700; color: var(--tint-ink); text-decoration: none;
             background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0% 2px;
             transition: background-size .3s var(--ease); padding-bottom: 2px; }
.text-link:hover { background-size: 100% 2px; }

/* ---------- Page header (section pages) with a soft glow in the section's color ---------- */
.page-header, .hero, .bio-hero { position: relative; isolation: isolate; }
.page-header::before, .hero::before, .hero::after, .bio-hero::before {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); pointer-events: none; }
.page-header::before, .bio-hero::before { width: 380px; height: 380px; right: -80px; top: -60px; background: var(--tint-soft); opacity: .9; }
.page-header { padding: 72px 0 40px; }
.page-body { padding: 16px 0 88px; }
.page-header-split { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; }
.page-header-split .btn { margin-top: 0; }
.updated { font-size: var(--fs-sm); color: var(--muted); }
.placeholder { padding: 28px; border-radius: var(--radius); background: var(--surface); border: 2px dashed var(--rule);
               color: var(--muted); }
.placeholder a { color: var(--tint-ink); font-weight: 700; }
.back-link { display: inline-flex; align-items: center; margin-bottom: 4px; padding: 8px 16px; border-radius: 999px;
             background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-sm); font-weight: 500; text-decoration: none;
             transition: transform .25s var(--ease); }
.back-link:hover { transform: translateX(-3px); }
.error-page { padding-bottom: 120px; }
.error-page a { color: var(--tint-ink); font-weight: 700; }
.fineprint { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: var(--fs-sm); color: var(--muted); max-width: 70ch; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 56px; align-items: center; padding: 88px 0 64px; }
.hero::before { width: 460px; height: 460px; top: -40px; right: -100px; background: var(--accent-soft); opacity: .8; }
.hero::after { width: 340px; height: 340px; bottom: -40px; left: 18%; background: var(--sage-soft); opacity: .7; }
.hello { font: 600 var(--fs-lg) var(--display); color: var(--accent-ink); }
.hero-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.hero-links .btn { margin-top: 0; }

/* Round photo inside a still rainbow ring (Nov 25: the spinning and floating were removed for a calmer page). */
.avatar { position: relative; display: block; width: 196px; aspect-ratio: 1; padding: 8px; border-radius: 50%; }
.avatar::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
                  background: conic-gradient(var(--accent), var(--butter), var(--sage), var(--sky), var(--accent)); }
.avatar span { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 50%;
               border: 5px solid var(--bg); background: var(--surface); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.45);
              transform-origin: 52% 44%; transition: transform .6s var(--ease); }
.avatar:hover img { transform: scale(1.55); }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding-bottom: 88px; }
.cards > *, .card-wide > * { min-width: 0; }   /* cards may shrink on small phones instead of overflowing */
.card { position: relative; display: block; padding: 28px; border-radius: var(--radius); background: var(--surface);
        box-shadow: var(--shadow); text-decoration: none; transition: transform .3s var(--ease), box-shadow .3s; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card-wide { grid-column: span 2; display: grid; grid-template-columns: 1fr 1.5fr; gap: 36px; }
.card h2 { font: 700 var(--fs-xl)/1.2 var(--display); margin-bottom: 8px; }
.card-intro > p, .card > p { color: var(--muted); font-size: var(--fs-sm); }
.icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: var(--r-md);
        background: var(--tint-soft); }
.card-list .item:first-child { border-top: 0; padding-top: 0; }
.card > h2 + .card-list { margin-top: 16px; }
.item { display: block; padding: 16px 0; border-top: 1px dashed var(--rule); text-decoration: none; }
.item h3 { font: 600 var(--fs-lg)/1.3 var(--display); margin-bottom: 4px; transition: color .2s; }
.item:hover h3 { color: var(--tint-ink); }
.item p { color: var(--muted); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .badge { margin-bottom: 8px; }
.item-photo { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; }
.item-photo img { width: 72px; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); }
.item-photo-right { grid-template-columns: 1fr 96px; }
.item-photo-right img { width: 96px; aspect-ratio: 4 / 3; }

/* ---------- Bio ---------- */
.bio-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; padding: 72px 0 56px; }
.bio-goal { margin-top: 16px; color: var(--muted); max-width: 52ch; }
.photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-lg);
         border: 6px solid var(--surface); box-shadow: var(--shadow-lift); transform: rotate(2deg);
         transition: transform .5s var(--ease); }
.photo:hover { transform: rotate(0deg) scale(1.02); }
.bio-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 40px; padding: 24px 0 88px; align-items: start; }
.bio-main > .section-label, .bio-side > .section-label { margin-top: 40px; }
.bio-main > .section-label:first-child, .bio-side > .section-label:first-child { margin-top: 0; }

/* Experience: cards hanging off a colorful line. */
.timeline { position: relative; list-style: none; padding: 0 0 0 32px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 3px; border-radius: var(--r-sm); opacity: .55;
                    background: linear-gradient(var(--accent), var(--butter), var(--sage), var(--sky)); }
.timeline .entry::before { content: ""; position: absolute; left: -29px; top: 25px; width: 15px; height: 15px; border-radius: 50%;
                           background: var(--bg); border: 3px solid var(--accent); }
.timeline .entry:nth-child(4n+2)::before { border-color: var(--butter); }
.timeline .entry:nth-child(4n+3)::before { border-color: var(--sage); }
.timeline .entry:nth-child(4n+4)::before { border-color: var(--sky); }
.entry { position: relative; padding: 20px 24px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--surface);
         box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s; }
.timeline .entry:hover { transform: translateX(4px); box-shadow: var(--shadow-lift); }
.entry h3 { font: 700 var(--fs-lg)/1.3 var(--display); }
.entry-org { color: var(--muted); font-size: var(--fs-sm); }
.entry-dates { float: right; margin-left: 12px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.entry ul { margin-top: 8px; padding-left: 16px; font-size: var(--fs-sm); }
.entry li::marker { color: var(--tint); }
.entry li + li { margin-top: 4px; }
.now { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
       background: var(--sage-soft); color: var(--sage-ink); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em;
       text-transform: uppercase; vertical-align: 1px; }
.now::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.small-label { margin-top: 12px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { padding: 8px 16px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-sm);
           font-weight: 500; transition: transform .25s var(--ease); }
.tags li:nth-child(4n+2) { background: var(--sage-soft); color: var(--sage-ink); }
.tags li:nth-child(4n+3) { background: var(--sky-soft); color: var(--sky-ink); }
.tags li:nth-child(4n+4) { background: var(--butter-soft); color: var(--butter-ink); }
.plain { list-style: none; padding: 16px 20px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-sm); }
.plain li + li { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }

/* ---------- Messages ---------- */
.form-errors { background: var(--accent-soft); color: var(--accent-ink); }
.form-errors { padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; }
.form-errors p + p { margin-top: 4px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 8px; max-width: 380px; }
.form-wide { max-width: 720px; }
.form label { margin-top: 8px; font-size: var(--fs-sm); font-weight: 700; }
.form label .muted { font-weight: 400; }
.form input, .form select, .form textarea { width: 100%; padding: 12px 16px; border: 1.5px solid var(--rule); border-radius: var(--r-sm);
       background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); /* 16px stops iPhones zooming in */
       transition: border-color .2s, box-shadow .2s; }
.form textarea { resize: vertical; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--tint);
       box-shadow: 0 0 0 4px var(--tint-soft); }
.form input[type=file] { padding: 8px; }
.form .checkbox { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form .checkbox input { width: auto; }
.form-inline { grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.form-buttons { display: flex; align-items: center; gap: 20px; margin-top: 16px; }
.form-buttons .text-link { margin-top: 0; }
.hint { font-size: var(--fs-sm); color: var(--muted); }
/* When the journal asks what to do with an older draft (it has buttons), make it stand out. */
.draft-status:has(button) { padding: 12px 16px; border-radius: var(--r-sm); background: var(--tint-soft); color: var(--ink);
                            font-size: var(--fs-sm); line-height: 1.5; }
.draft-status .link-button { color: var(--tint-ink); font-weight: 700; padding: 4px 0; }
.current-photo { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; }
.current-photo img { width: 120px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-self: start; gap: 8px; margin-top: 16px; padding: 12px 24px;
       border: 0; border-radius: 999px; background: var(--btn-bg); color: var(--btn-ink); font: 700 var(--fs-sm) var(--sans);
       text-decoration: none; cursor: pointer; white-space: nowrap;
       box-shadow: 0 6px 16px color-mix(in srgb, var(--btn-bg) 30%, transparent);
       transition: transform .2s var(--ease), box-shadow .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--btn-bg) 40%, transparent); }
.btn:active { transform: scale(.97); }
.form-buttons .btn, .form-inline .btn { margin-top: 0; }
.btn-quiet { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn-quiet:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.link-button { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--accent-ink); }
.owner-actions { display: flex; gap: 16px; margin-top: 16px; font-size: var(--fs-sm); }
.owner-actions a { color: var(--muted); }
.owner-actions a:hover { color: var(--tint-ink); }

/* ---------- Budget ---------- */
.budget-header { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; }
.stat { padding: 20px 28px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: right; }
.stat-label { font-size: var(--fs-sm); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tint-ink); }
.stat-value { font: 700 var(--fs-2xl)/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-sm); color: var(--muted); }
.month-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 24px; padding: 8px;
             border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-sm); }
.month-nav a, .month-nav .muted { padding: 8px 16px; border-radius: 999px; color: var(--muted); text-decoration: none;
                                  transition: background .2s, color .2s; }
.month-nav a:hover { background: var(--tint-soft); color: var(--tint-ink); }
.month-nav strong { font: 700 var(--fs-lg) var(--display); }
.month-next { display: flex; justify-content: flex-end; gap: 4px; min-width: 4em; }
.budget-grid { display: grid; grid-template-columns: 360px 1fr; gap: 32px; align-items: start; }
.budget-grid > div { min-width: 0; }  /* lets the table scroll instead of widening the page */
.budget-grid > div:first-child { padding: 28px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.budget-grid > div:first-child .form { max-width: none; }
.budget-grid > div:first-child .form input, .budget-grid > div:first-child .form select { background: var(--bg); }
.section-gap { margin-top: 40px; }
.month-list { list-style: none; padding: 0; font-size: var(--fs-sm); }
.month-list li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: var(--r-sm); }
.month-list li:hover { background: var(--bg); }
.month-list a { text-decoration: none; }
.month-list li.current { background: var(--tint-soft); }
.month-list li.current a { color: var(--tint-ink); font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.budget-actions { display: flex; flex-direction: column; align-items: start; gap: 12px; margin-top: 32px; padding-top: 20px;
                  border-top: 1px solid var(--rule); font-size: var(--fs-sm); }
.budget-actions .text-link { margin-top: 0; }
/* Category breakdown: each bar grows in from the left, in its own color. */
.breakdown { list-style: none; padding: 8px 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.breakdown li { display: grid; grid-template-columns: 9.5em 1fr 6.5em 3em; align-items: center; gap: 12px; padding: 12px 0;
                border-bottom: 1px solid var(--rule); font-size: var(--fs-sm); }
.breakdown li:last-child { border-bottom: 0; }
.breakdown .num { text-align: right; }
.breakdown-bar { height: 10px; overflow: hidden; border-radius: 999px; background: var(--bg); }
.breakdown-bar span { display: block; height: 100%; border-radius: 999px; background: var(--sky); transform-origin: left;
                      animation: grow 1.1s var(--ease) both; }
.breakdown li:nth-child(4n+2) .breakdown-bar span { background: var(--accent); animation-delay: .08s; }
.breakdown li:nth-child(4n+3) .breakdown-bar span { background: var(--sage); animation-delay: .16s; }
.breakdown li:nth-child(4n+4) .breakdown-bar span { background: var(--butter); animation-delay: .24s; }
.breakdown-share { text-align: right; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; padding: 8px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ledger { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ledger th { padding: 12px 8px 8px; border-bottom: 1px solid var(--rule); text-align: left; font-size: var(--fs-xs); font-weight: 700;
             letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ledger td { padding: 12px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr { transition: background .2s; }
.ledger tbody tr:hover { background: var(--bg); }
.ledger .num { text-align: right; white-space: nowrap; font-weight: 500; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-actions div { display: flex; gap: 12px; justify-content: end; font-size: var(--fs-sm); white-space: nowrap; }
.row-actions a { color: var(--muted); }
.row-actions a:hover { color: var(--tint-ink); }

/* ---------- Recipes ---------- */
.recipe-grid-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px; }
.recipe-tile { display: block; text-decoration: none; }
.recipe-tile-photo { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; margin-bottom: 16px;
                     border-radius: var(--r-md); box-shadow: var(--shadow); transition: transform .35s var(--ease), box-shadow .35s;
                     background: linear-gradient(135deg, var(--sage-soft), var(--butter-soft)); }
.recipe-grid-cards li:nth-child(3n+2) .recipe-tile-photo { background: linear-gradient(135deg, var(--accent-soft), var(--butter-soft)); }
.recipe-grid-cards li:nth-child(3n+3) .recipe-tile-photo { background: linear-gradient(135deg, var(--sky-soft), var(--sage-soft)); }
.recipe-tile:hover .recipe-tile-photo { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.recipe-tile-photo img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.recipe-tile:hover .recipe-tile-photo img { transform: scale(1.06); }
.recipe-tile-initial { font: 700 calc(var(--fs-2xl) * 2) var(--display); color: color-mix(in srgb, var(--ink) 22%, transparent); }
.recipe-tile h2 { font: 700 var(--fs-lg)/1.25 var(--display); transition: color .2s; }
.recipe-tile:hover h2 { color: var(--tint-ink); }
.recipe-meta { display: block; margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); }
.recipe-tools { margin-bottom: 32px; }
.search { display: flex; gap: 8px; max-width: 560px; margin-bottom: 16px; }
.search input { flex: 1; min-width: 0; padding: 12px 16px; border: 1.5px solid var(--rule); border-radius: 999px;
                background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); box-shadow: var(--shadow);
                transition: border-color .2s, box-shadow .2s; }
.search input:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 4px var(--tint-soft); }
.search .btn { margin-top: 0; }
.tag-tabs { margin-bottom: 8px; }
.result-line { font-size: var(--fs-sm); color: var(--muted); }
.result-line a { color: var(--tint-ink); font-weight: 700; }
.tile-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tile-tags span, .tag-links a { padding: 4px 8px; border-radius: 999px; background: var(--tint-soft); color: var(--tint-ink);
                                font-size: var(--fs-xs); font-weight: 700; text-decoration: none; }
.tag-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag-links a { padding: 4px 12px; font-size: var(--fs-sm); transition: transform .2s var(--ease); }
.tag-links a:hover { transform: translateY(-2px); }
/* ---------- Recipe forms: photo drop zone, quick add, extra details ---------- */
.recipe-form .fields { display: grid; gap: 8px; }
.photo-field { margin-bottom: 8px; }
.photo-field .checkbox { margin-top: 8px; }
.dropzone { position: relative; display: grid; place-items: center; min-height: 200px; margin: 0; overflow: hidden;
            border: 2px dashed color-mix(in srgb, var(--tint) 45%, var(--rule)); border-radius: var(--r-md); background: var(--tint-soft);
            cursor: pointer; text-align: center; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--tint); box-shadow: 0 0 0 5px var(--tint-soft); transform: scale(1.01); }
.dropzone:focus-within { border-color: var(--tint); box-shadow: 0 0 0 4px var(--tint-soft); }
/* The real file input covers the whole zone (invisible), so clicking anywhere opens the picker. */
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.dropzone-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.dropzone-preview[hidden] { display: none; }
.dropzone-text { position: relative; display: grid; gap: 4px; justify-items: center; padding: 24px; font-size: var(--fs-sm);
                 color: var(--tint-ink); pointer-events: none; }
.dropzone-text strong { font: 700 var(--fs-md) var(--display); color: var(--ink); }
.dropzone-icon { transition: transform .3s var(--ease); }
.dropzone:hover .dropzone-icon, .dropzone.dragging .dropzone-icon { transform: translateY(-2px); }
/* With a photo chosen, the words move to a small label at the bottom so the photo shows. */
.dropzone.has-photo .dropzone-text { align-self: end; justify-self: stretch; padding: 8px 16px;
                                     background: color-mix(in srgb, var(--surface) 88%, transparent); }
.dropzone.has-photo .dropzone-icon, .dropzone.has-photo .dropzone-text > span:last-child { display: none; }
.dropzone.has-photo .dropzone-text strong { font: 600 var(--fs-sm) var(--sans); }
.more-details { margin-top: 12px; padding: 4px 16px 16px; border-radius: var(--r-md); background: var(--bg); }
.more-details summary { padding: 8px 0; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; }
.more-details summary .muted { font-weight: 400; font-size: var(--fs-sm); margin-left: 8px; }
.more-details[open] summary { margin-bottom: 2px; }
.more-details input, .more-details textarea { background: var(--surface); }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.detail-grid label { display: block; margin-bottom: 8px; }

/* Quick add card on /recipes: photo on the left, the fields on the right. */
.quick-add { margin-bottom: 36px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
             transition: box-shadow .3s; }
.quick-add[open] { box-shadow: var(--shadow-lift); }
.quick-add > summary { display: flex; align-items: center; gap: 16px; padding: 20px 24px; cursor: pointer; list-style: none; }
.quick-add > summary::-webkit-details-marker { display: none; }
.quick-add > summary::after { content: "+"; margin-left: auto; font-size: var(--fs-lg); color: var(--tint-ink); transition: transform .3s var(--ease); }
.quick-add[open] > summary::after { transform: rotate(45deg); }
.quick-add > summary .icon { margin: 0; flex: none; }
.quick-add > summary > span:nth-child(2) { display: grid; }
.quick-add > summary strong { font: 700 var(--fs-lg) var(--display); }
.quick-add > summary .muted { font-size: var(--fs-sm); }
.quick-form { max-width: none; grid-template-columns: minmax(220px, 320px) 1fr; gap: 28px; padding: 0 24px 24px;
              animation: pop .4s var(--ease); }
.quick-form .photo-field { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
.quick-form .dropzone { min-height: 280px; }
.quick-form .fields, .quick-form .form-buttons { grid-column: 2; }
.quick-form .form-buttons { margin-top: 0; }
.quick-form input:not([type=file]), .quick-form textarea { background: var(--bg); }
.quick-form .more-details input, .quick-form .more-details textarea { background: var(--surface); }

.fact-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.fact-pills > span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
                     background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-sm); font-weight: 500; }
.tile-description { display: -webkit-box; margin-top: 8px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45;
                    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-meta a { color: var(--tint-ink); font-weight: 700; }

.recipe-hero { margin: 0; }
.recipe-hero img { display: block; width: 100%; max-height: 560px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow-lift); }
.recipe-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; align-items: start; padding-top: 40px; }
.ingredients { position: sticky; top: 96px; list-style: none; padding: 8px 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ingredients li { position: relative; padding: 8px 0 8px 24px; border-bottom: 1px dashed var(--rule); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--tint); }
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 38px 1fr; gap: 16px; align-items: start; padding: 16px 24px;
            border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-md); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
                    background: var(--tint-soft); color: var(--tint-ink); font: 700 var(--fs-md) var(--display); }

/* ---------- News ---------- */
.lead-stories { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 20px; }  /* 1–3 equal columns */
.story { padding: 16px 20px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow);
         transition: transform .3s var(--ease), box-shadow .3s; }
.story:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.story.story-lead { padding: 24px; overflow: hidden; border-radius: var(--radius); }
.story-lead .story-image { margin: -22px -22px 16px; }
.story-lead h3 { font: 700 var(--fs-lg)/1.25 var(--display); margin: 12px 0 8px; }
.story-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.story h3 { font: 700 var(--fs-lg)/1.3 var(--display); margin: 8px 0; }
.story h3 a { text-decoration: none; }
.story h3 a:hover { color: var(--tint-ink); }
.story-meta { font-size: var(--fs-sm); font-weight: 700; }
.story-meta .badge { margin-left: 8px; }
.story-lead .story-meta .badge { margin-left: 0; }
.story-summary { color: var(--muted); font-size: var(--fs-sm); }
.story-sources { margin-top: 12px; font-size: var(--fs-sm); }
.story-sources a { color: var(--tint-ink); font-weight: 500; }
.story-image { display: block; overflow: hidden; }
.story-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg); transition: transform .6s var(--ease); }
.story:hover .story-image img { transform: scale(1.04); }
.story-with-thumb { display: grid; grid-template-columns: 1fr 112px; gap: 16px; align-items: start; }
.story-with-thumb .story-thumb { order: 2; }
.story-thumb img { display: block; width: 112px; aspect-ratio: 1; object-fit: cover; margin-top: 4px; border-radius: var(--radius-sm); background: var(--bg); }

.news-status { display: flex; flex-direction: column; align-items: end; gap: 12px; }
.news-status .chip { margin: 0; }
.news-status .btn { margin-top: 0; }
.btn[disabled] { opacity: .7; cursor: progress; transform: none; }

/* Tabs (news sections): a row of pills that scrolls sideways on small phones instead of wrapping. */
.tabs { display: flex; gap: 8px; margin-bottom: 28px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
          background: var(--surface); box-shadow: var(--shadow); font-size: var(--fs-sm); font-weight: 500; text-decoration: none;
          transition: background .2s, color .2s, transform .2s var(--ease); }
.tabs a:hover { transform: translateY(-1px); background: var(--tint-soft); }
.tabs a span { min-width: 22px; padding: 0 8px; border-radius: 999px; background: var(--bg); color: var(--muted);
               font-size: var(--fs-xs); font-weight: 700; text-align: center; }
.tabs a.active { background: var(--ink); color: var(--bg); }
.tabs a.active span { background: color-mix(in srgb, var(--bg) 20%, transparent); color: var(--bg); }

/* ---------- Dashboard (my logged-in home page) ---------- */
.dash-hero { grid-template-columns: 1fr; padding-bottom: 40px; }
.dash-cards .card-wide { grid-template-columns: 1fr 1.3fr; }
.small { font-size: var(--fs-sm); }
.card > p.big-number { margin: 4px 0 2px; font: 700 var(--fs-2xl)/1.1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.journal-excerpt { white-space: pre-line; }
/* Money on Today: a quiet one-line link under the cards, not a card of its own. */
.money-line { grid-column: span 2; display: flex; align-items: center; gap: 12px; padding: 16px 4px;
              border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--fs-sm); text-decoration: none; }
.money-line > span:first-of-type { flex: 1; min-width: 0; }
.money-open { display: inline-flex; align-items: center; gap: 4px; flex: none; transition: color .2s; }
.money-line:hover .money-open { color: var(--ink); }

/* Quick-note box and note lists (dashboard and journal day page). */
.quick-note { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-note input { flex: 1; min-width: 0; padding: 12px 16px; border: 1.5px solid var(--rule); border-radius: 999px;
                    background: var(--bg); color: var(--ink); font: inherit; font-size: var(--fs-md); transition: border-color .2s, box-shadow .2s; }
.quick-note input:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 4px var(--tint-soft); }
.quick-note .btn { margin-top: 0; }
.note-list { list-style: none; padding: 0; margin-bottom: 16px; }
.note-list li { display: grid; grid-template-columns: 5.2em 1fr auto; gap: 12px; align-items: baseline; padding: 8px 0;
                border-bottom: 1px dashed var(--rule); font-size: var(--fs-sm); animation: pop .4s var(--ease); }
.note-list li:last-child { border-bottom: 0; }
.note-list time { font-size: var(--fs-xs); font-weight: 700; color: var(--tint-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note-list span { white-space: pre-line; overflow-wrap: anywhere; }
.note-list .link-button { text-decoration: none; font-size: var(--fs-lg); line-height: 1; padding: 0 4px; }

/* ---------- Journal ---------- */
.journal-grid { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; margin-top: 8px; }
.calendar { padding: 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.calendar .month-nav { box-shadow: none; background: var(--bg); margin-bottom: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-head { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal-day { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--r-sm); font-size: var(--fs-sm);
           text-decoration: none; transition: background .2s, transform .2s var(--ease); }
a.cal-day:hover { background: var(--tint-soft); transform: scale(1.06); }
.cal-day.out { color: var(--rule); }
.cal-day.future { color: var(--muted); opacity: .45; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--tint); font-weight: 700; }
.cal-day.written { background: var(--tint-soft); color: var(--tint-ink); font-weight: 700; }
.cal-day.written::after { content: ""; position: absolute; bottom: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--tint); }
/* Mood colors: rough → great. Used for calendar dots and the legend. */
.mood-1 { --mood: #c0504d; } .mood-2 { --mood: #d9843a; } .mood-3 { --mood: #c9a53a; }
.mood-4 { --mood: #6f9f6f; } .mood-5 { --mood: #3f9f8f; }
.cal-day.written[class*="mood-"]:not(.mood-0)::after { background: var(--mood); }
.cal-legend { display: flex; justify-content: space-between; margin-top: 12px; font-size: var(--fs-sm); }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--mood); }
.journal-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.journal-list a { display: grid; gap: 4px; padding: 16px 20px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow);
                  text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s; }
.journal-list a:hover { transform: translateX(4px); box-shadow: var(--shadow-lift); }
.journal-list strong { font: 700 var(--fs-md) var(--display); }
.journal-list span { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.section-label a.small { font: 500 var(--fs-sm) var(--sans); }

.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 24px; }
.day-nav .back-link { margin-bottom: 0; }
.back-link { gap: 8px; }
.day-step { display: flex; gap: 8px; }
.day-step a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
             box-shadow: var(--shadow); text-decoration: none; transition: transform .2s var(--ease); }
.day-step a:hover { transform: scale(1.1); }
.journal-day { display: grid; grid-template-columns: 1fr 1.6fr; gap: 32px; align-items: start; }
.day-notes { padding: 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.day-notes .quick-note { margin: 0; }
.journal-form { max-width: none; padding: 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.journal-form textarea { min-height: 320px; background: var(--bg); font-size: var(--fs-md); line-height: 1.7; }
.journal-day > * { min-width: 0; }   /* let the columns shrink on small phones */
.moods { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; border: 0;
         min-width: 0; }   /* fieldsets refuse to shrink below their content unless told to */
.moods legend { margin-bottom: 8px; font-size: var(--fs-sm); font-weight: 700; }
.moods label { position: relative; margin: 0; cursor: pointer; }
/* The real radio buttons are hidden (the emoji tiles stand in for them) but stay keyboard-usable. */
.moods input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.moods span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-md); background: var(--bg);
              font-size: var(--fs-xl); transition: transform .2s var(--ease), background .2s, box-shadow .2s; }
.moods small { display: block; margin-top: 2px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.moods label:hover span { transform: translateY(-2px) scale(1.06); }
.moods input:checked + span { background: var(--tint-soft); box-shadow: inset 0 0 0 2px var(--tint); transform: scale(1.08); }
.moods input:focus-visible + span { outline: 3px solid var(--tint); outline-offset: 2px; }

/* ---------- Icons (static/icons.svg, drawn with {{ icon("name") }}) ---------- */
/* Line icons take the text color, so they match every section and dark mode. */
.i { display: inline-block; flex: none; width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: none; stroke: currentColor;
     stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon { color: var(--tint-ink); }
.icon .i { width: 24px; height: 24px; }
.chip .i, .badge .i { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
.chip .i { color: var(--accent); }
.badge .i { stroke-width: 2; }
.hello { display: flex; align-items: center; gap: 8px; }
.hello-icon .i { width: 22px; height: 22px; color: var(--butter); }
.mood-face { color: var(--mood); }
.chip .mood-face { color: var(--mood); }
.journal-list .mood-face { width: 1em; height: 1em; vertical-align: -0.12em; }
.dropzone-icon .i { width: 36px; height: 36px; stroke-width: 1.5; }
.moods span .i { width: 30px; height: 30px; color: var(--mood); stroke-width: 1.6; }
.fact-pills .i { color: var(--tint-ink); }
.btn .i { width: 18px; height: 18px; stroke-width: 2; }

/* Numbers line up in columns wherever money, weights or times appear. */
.num, time, .stat-value, .big-number, .ledger td, .breakdown, .cal-day, .entry-dates { font-variant-numeric: tabular-nums; }

/* ---------- Shared components (Phase 1) ---------- */
/* Empty state: an icon, one sentence and (usually) one clear action. */
.empty, .placeholder { display: grid; justify-items: center; gap: 8px; padding: 40px 24px; border-radius: var(--r-lg);
                       background: var(--surface); border: 1.5px dashed var(--rule); color: var(--muted); text-align: center; }
.empty .i { width: 32px; height: 32px; margin-bottom: 4px; color: var(--tint); stroke-width: 1.5; }
.empty strong { font: 700 var(--fs-lg)/1.3 var(--display); color: var(--ink); }
.empty p { max-width: 40ch; }
.empty .btn { margin-top: 8px; justify-self: center; }
.placeholder a, .empty a:not(.btn) { color: var(--tint-ink); font-weight: 700; }

/* List row: a label on the left, details or an action on the right. */
.rows { list-style: none; padding: 0 24px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.rows > .row:last-child, .rows > li:last-child .row { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { display: block; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.row { text-decoration: none; transition: background .2s; }
a.row:hover strong { color: var(--tint-ink); }

/* Toasts: confirmations fade away on their own; errors stay until closed. */
.toasts { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px;
          width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--ink);
         color: var(--bg); box-shadow: var(--shadow-lift); font-size: var(--fs-sm); font-weight: 500; pointer-events: auto;
         animation: toast-in .35s var(--ease), toast-out .4s var(--ease) 4.5s forwards; }
.toast > span { flex: 1; }
.toast-mark { width: 18px; height: 18px; stroke-width: 2.25; color: var(--sage); }
.toast-error { animation: toast-in .35s var(--ease); background: var(--accent-soft); color: var(--accent-ink);
               box-shadow: var(--shadow-lift), inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.toast-error .toast-mark { color: var(--accent-ink); }
.toast-close { display: grid; place-items: center; width: 32px; height: 32px; margin: -8px -8px -8px 0; padding: 0; border: 0;
               border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.toast-close:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
/* Undo toast (after a delete): stays 9 seconds, and holds still while the pointer or keyboard is on it. */
.toast-undo { animation: toast-in .35s var(--ease), toast-out .4s var(--ease) 9s forwards; }
.toast-undo:hover, .toast-undo:focus-within { animation-play-state: paused; }
.toast-undo .toast-mark { color: var(--bg); opacity: .7; }
.toast-undo form { display: contents; }
.toast-action { margin: -6px -6px -6px 0; padding: 8px 14px; border: 0; border-radius: 999px; cursor: pointer;
                background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); font: 700 var(--fs-sm) var(--sans); }
.toast-action:hover { background: color-mix(in srgb, var(--bg) 26%, transparent); }
.toast-action:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }
/* While a form is being sent in the background (site.js), it dims a little. */
form[aria-busy="true"] { opacity: .65; transition: opacity .2s; }

/* Dialogs (keyboard shortcuts). */
.dialog { margin: auto; width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 28px; border: 0; border-radius: var(--r-lg); background: var(--surface);
          color: var(--ink); box-shadow: var(--shadow-lift); }
.dialog::backdrop { background: color-mix(in srgb, #000 40%, transparent); }
.dialog[open] { animation: toast-in .25s var(--ease); }
.dialog h2 { font: 700 var(--fs-lg)/1.3 var(--display); margin-bottom: 16px; }
.dialog .btn { margin-top: 24px; }
.keys { display: grid; gap: 0; }
.keys > div { display: grid; grid-template-columns: 6.5em 1fr; gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.keys > div:last-child { border-bottom: 0; }
.keys dd { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.keys dt span { font-size: var(--fs-xs); color: var(--muted); }
.keys dd kbd { min-width: 22px; height: 22px; padding: 0 6px; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 8px;
      background: var(--bg); box-shadow: inset 0 -2px 0 var(--rule), inset 0 0 0 1px var(--rule); font: 700 var(--fs-xs) var(--sans); }

/* Phone tab bar and the "More" sheet. Hidden on wider screens, where the top bar has every link. */
.tabbar { display: none; }

/* ---------- Jobs ---------- */
.job-add { max-width: none; padding: 0 24px 24px; animation: pop .4s var(--ease); }
.job-add input, .job-add textarea { background: var(--bg); }
.job-add-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.job-add-grid > div { display: grid; gap: 8px; }
/* The board: one column per open status. */
.job-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.job-col { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 55%, transparent);
           border: 1px solid var(--rule); }
.job-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px; font: 700 var(--fs-sm) var(--sans);
                letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.job-col-head .i { color: var(--tint); }
.job-col-head span { margin-left: auto; min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface);
                     font-size: var(--fs-xs); text-align: center; letter-spacing: 0; }
.job-col-empty { padding: 16px 8px; font-size: var(--fs-sm); color: color-mix(in srgb, var(--ink) 72%, transparent); text-align: center; }
.job-card { display: grid; gap: 4px; padding: 16px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow);
            text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s; }
.job-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.job-company { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tint-ink); }
.job-title { font: 700 var(--fs-md)/1.3 var(--display); overflow-wrap: anywhere; }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--muted); }
.job-meta .i, .due .i { width: 13px; height: 13px; vertical-align: -2px; }
.due { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: var(--bg); font-size: var(--fs-xs);
       font-weight: 700; color: var(--muted); }
.due-now { background: var(--butter-soft) !important; color: var(--butter-ink) !important; }
.closed-jobs > summary { cursor: pointer; list-style: none; }
.closed-jobs > summary::-webkit-details-marker { display: none; }
.closed-jobs[open] > summary { margin-bottom: 16px; }
.row > .i { color: var(--muted); }
.row .chev { width: 18px; height: 18px; }

/* One job */
.job-header .back-link { margin-bottom: 16px; }
.job-header .kicker { margin-left: 8px; }
.status-pill { background: var(--tint-soft) !important; color: var(--tint-ink); font-weight: 700 !important; box-shadow: none !important; }
.job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.job-actions .btn { margin-top: 0; }
.status-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 16px; padding: 4px; border-radius: 999px;
                 background: var(--surface); box-shadow: var(--shadow); max-width: 100%; }
.status-switch button { padding: 8px 16px; border: 0; border-radius: 999px; background: none; color: var(--muted);
                        font: 500 var(--fs-sm) var(--sans); cursor: pointer; transition: background .2s, color .2s; }
.status-switch button:hover { background: var(--tint-soft); color: var(--tint-ink); }
.status-switch button.current { background: var(--ink); color: var(--bg); }
.job-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.section-label a { color: var(--tint-ink); }
.draft-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.draft-button { position: relative; display: grid; justify-items: start; gap: 12px; padding: 16px; border: 0; border-radius: var(--r-md);
                background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font: 700 var(--fs-md) var(--display);
                text-align: left; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s; }
.draft-button .icon { width: 40px; height: 40px; margin: 0; border-radius: var(--r-sm); }
.draft-button .icon .i { width: 20px; height: 20px; }
.draft-button .spark { position: absolute; top: 16px; right: 16px; width: 16px; height: 16px; color: var(--tint); }
.draft-button:hover:not([disabled]) { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.draft-button[disabled] { opacity: .55; cursor: not-allowed; }
.draft-button.busy { opacity: 1; cursor: progress; }
.draft-button.busy .spark { animation: pulse-soft 1.2s ease-in-out infinite; }   /* only while Claude is writing */
.draft-hint { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 24px; }
.draft-hint .i { margin-top: 3px; }
.draft-hint .i { color: var(--tint); }
.draft-status-note { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 12px 16px; border-radius: var(--r-sm);
                     background: var(--tint-soft); color: var(--tint-ink); font-size: var(--fs-sm); font-weight: 500; }
.draft { margin-bottom: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.draft header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.draft-kind { font: 700 var(--fs-md) var(--display); }
.draft-kind .i { color: var(--tint); }
.draft-tag { padding: 2px 8px; border-radius: 999px; background: var(--butter-soft); color: var(--butter-ink); font-size: var(--fs-xs);
             font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.draft-tools { display: flex; gap: 16px; margin-left: auto; font-size: var(--fs-sm); }
.draft-tools .link-button { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.draft-body { padding: 20px 24px 24px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-md); line-height: 1.7; }
.job-details .form { max-width: none; padding: 24px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.job-details .form input, .job-details .form textarea { background: var(--bg); }
.detail-grid-2 { grid-template-columns: repeat(2, 1fr); }
.danger-zone { margin-top: 16px; padding-left: 8px; font-size: var(--fs-sm); }
.danger-zone .link-button { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.danger-zone .link-button:hover { color: var(--accent-ink); }
@keyframes pulse-soft { 50% { opacity: .35; transform: scale(.85); } }

/* Agents */
.agent-launch { max-width: 640px; }
.agent-launch .btn { margin-top: 24px; }
.agent-steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: step; }
.agent-steps li { counter-increment: step; padding: 20px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); }
.agent-steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px;
                          border-radius: 50%; background: var(--tint-soft); color: var(--tint-ink); font: 700 var(--fs-sm) var(--display); }
.agent-role { font: 700 var(--fs-lg) var(--display); }
.agent-steps p { margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); }
.agents .rows { max-width: 640px; }
.agents .row > .i { width: 20px; height: 20px; color: var(--tint); }
code { padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 8%, transparent); font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; }
.card code, .rows code { background: var(--tint-soft); color: var(--tint-ink); }

/* Today: the Jobs card */
.job-due { list-style: none; padding: 0; margin-top: 16px; }
.job-due li a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px dashed var(--rule);
                font-size: var(--fs-sm); text-decoration: none; }
.job-due li:first-child a { border-top: 0; }
.job-due strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-due span { flex: none; color: var(--butter-ink); font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 28px;
               padding-bottom: 40px; border-top: 1px solid var(--rule); font-size: var(--fs-sm); color: var(--muted); }
.footer-links { display: flex; align-items: center; gap: 16px; }
.footer-links a, .footer-links .link-button { color: var(--muted); font-size: var(--fs-sm); }
.footer-links a:hover, .footer-links .link-button:hover { color: var(--accent-ink); }

/* ---------- Accessibility ---------- */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 30; padding: 8px 16px; border-radius: 999px;
             background: var(--ink); color: var(--bg); font-size: var(--fs-sm); text-decoration: none; }
.skip-link:focus { left: 16px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--tint); outline-offset: 3px; border-radius: var(--r-sm); }

/* ---------- Motion ---------- */
/* Page headings used to fade in when a page opened, which left every page blank for most of a
   second (Phase 1, Nov 25). Now everything at the top of a page is there from the first frame.
   The "reveal" and "d1"–"d5" classes are still in the templates but no longer hide anything. */
/* Cards further down fade up as they scroll into view. static/js/site.js adds these classes;
   without JavaScript nothing is hidden. */
.rise { opacity: 0; transform: translateY(24px); }
.rise.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

@keyframes in { to { opacity: 1; transform: none; } }
@keyframes highlight { to { background-size: 100% 100%; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(24px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* People who turn on "Reduce motion" on their phone or computer get a still page. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .rise { opacity: 1; transform: none; }
  h1 em { background-size: 100% 100%; }
  @view-transition { navigation: none; }
}

/* ---------- Tablets and phones ---------- */
@media (max-width: 1000px) {
  .job-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .job-layout { grid-template-columns: minmax(0, 1fr); }
  .budget-grid { grid-template-columns: 1fr; }
  .recipe-grid { grid-template-columns: 1fr; }
  .ingredients { position: static; }
  .journal-grid, .journal-day { grid-template-columns: 1fr; }
  .calendar { max-width: 420px; }
}

@media (max-width: 760px) {
  body { font-size: var(--fs-md); }
  .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  /* Header: the logo makes way so the five links fit; each link is a finger-sized pill. */
  .site-header { top: max(8px, env(safe-area-inset-top)); margin-top: 8px; }
  .bar { padding: 4px; }
  .logo { display: none; }
  .site-nav { flex: 1; justify-content: space-between; gap: 0; }
  .site-nav a { flex: 1 1 auto; padding: 8px 8px; text-align: center; font-size: var(--fs-sm); }
  /* Logged in there are six links: they keep their size and the row scrolls sideways,
     with a soft fade on the right edge hinting there's more. */
  .site-nav.nav-long { justify-content: start; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
                       mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .site-nav.nav-long a { flex: none; padding: 8px 12px; }
  .site-nav.nav-long a:last-child { margin-right: 24px; }
  .dash-cards .card-wide { grid-template-columns: 1fr; }
  .moods span { width: 48px; height: 48px; }
  .moods span .i { width: 28px; height: 28px; }
  .journal-form { padding: 16px; }
  .note-list li { grid-template-columns: 4.6em 1fr auto; gap: 8px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 48px 0 40px; }
  .hero::before { width: 300px; height: 300px; right: -120px; }
  .avatar { width: 132px; }
  .page-header { padding: 48px 0 28px; }
  .page-header::before, .bio-hero::before { width: 260px; height: 260px; right: -120px; }
  .cards, .card-wide { grid-template-columns: 1fr; }
  .card-wide { grid-column: auto; gap: 20px; }
  .money-line { grid-column: auto; }
  .card { padding: 24px; }
  .bio-hero, .bio-grid { grid-template-columns: 1fr; }
  .bio-hero { gap: 32px; padding: 48px 0 32px; }
  .bio-hero .photo { max-width: 260px; order: -1; }
  .bio-side { padding-top: 16px; }
  .timeline { padding-left: 24px; }
  .timeline::before { left: 5px; }
  .timeline .entry::before { left: -25px; }
  .entry { padding: 16px; }
  .entry-dates { float: none; display: block; margin: 2px 0 0; }
  .stat { text-align: left; width: 100%; }
  .month-nav { font-size: var(--fs-sm); }
  .month-nav { border-radius: var(--r-md); }
  .month-nav a, .month-nav .muted { padding: 8px 8px; white-space: nowrap; }
  .month-nav strong { font-size: var(--fs-sm); text-align: center; line-height: 1.25; }
  .budget-grid > div:first-child { padding: 24px; }
  .breakdown { padding: 8px 16px; }
  /* Phones: name and amount on one line, the bar full-width underneath. */
  .breakdown li { grid-template-columns: 1fr auto 2.8em; grid-template-areas: "name num share" "bar bar bar";
                  gap: 8px 8px; font-size: var(--fs-sm); }
  .breakdown-name { grid-area: name; }
  .breakdown .num { grid-area: num; }
  .breakdown-share { grid-area: share; }
  .breakdown-bar { grid-area: bar; height: 8px; }
  .table-wrap { padding: 4px 8px; }
  .ledger .col-note { display: none; }  /* phones: hide notes to keep rows readable */
  .ledger td, .ledger th { padding-left: 8px; padding-right: 8px; }
  .row-actions div { flex-direction: column; align-items: end; gap: 2px; }
  .news-status { align-items: start; }
  .tabs { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }  /* swipe edge to edge */
  .search .btn { padding: 12px 16px; }
  .lead-stories { grid-auto-flow: row; }
  .story-list { grid-template-columns: 1fr; }
  .story-with-thumb { grid-template-columns: 1fr 88px; gap: 12px; }
  .story-thumb img { width: 88px; }
  .recipe-grid-cards { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .recipe-tile h2 { font-size: var(--fs-lg); }
  .recipe-tile-initial { font-size: var(--fs-2xl); }
  .recipe-hero img { max-height: 320px; }
  .quick-form { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 16px; }
  .quick-form .photo-field, .quick-form .fields, .quick-form .form-buttons { grid-column: 1; grid-row: auto; }
  .quick-form .dropzone, .dropzone { min-height: 170px; }
  .quick-add > summary { padding: 16px; gap: 12px; }
  .quick-add > summary strong { font-size: var(--fs-lg); }
  .detail-grid { gap: 8px; }
  .more-details { padding: 2px 16px 12px; }
  .steps li { grid-template-columns: 32px 1fr; gap: 12px; padding: 16px; font-size: var(--fs-md); }
  .steps li::before { width: 30px; height: 30px; font-size: var(--fs-sm); }
  .item-photo-right { grid-template-columns: 1fr 80px; }
  .item-photo-right img { width: 80px; }
  .site-footer { flex-direction: column; align-items: start; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
  .job-board, .agent-steps { grid-template-columns: 1fr; }
  .job-col.is-empty { display: none; }   /* phones: only the columns that have jobs */
  .job-add { padding: 0 16px 16px; }
  .job-add-grid, .draft-buttons { grid-template-columns: 1fr; }
  .draft-button { grid-template-columns: auto 1fr; align-items: center; }
  .draft-body { padding: 16px; }
  .draft header { padding: 12px 16px; }
  .job-details .form { padding: 16px; }
  .status-switch { border-radius: var(--r-md); }
  .status-switch button { padding: 8px 12px; }
  /* Logged in: the top bar shrinks to the name, and the menu moves to a tab bar at the bottom. */
  .logged-in .logo { display: block; }
  .logged-in .bar { justify-content: center; padding: 12px 16px; }
  .logged-in .site-nav { display: none; }
  .logged-in .site-footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .logged-in .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
            padding: 8px max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
            border-top: 1px solid var(--rule); }
  /* The frosted glass sits on a layer behind the tabs. (Blur on the bar itself would trap the
     sheet and its dimmed backdrop inside the bar, because blur changes what "fixed" is relative to.) */
  .tabbar::after { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--surface) 88%, transparent);
            -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px); }
  .tabbar > a, .tab-more > summary { display: grid; justify-items: center; gap: 4px; min-height: 48px; padding: 4px 0;
            border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-xs); font-weight: 500; text-decoration: none;
            cursor: pointer; list-style: none; transition: color .2s; }
  .tab-more > summary::-webkit-details-marker { display: none; }
  .tabbar .i { width: 24px; height: 24px; }
  .tabbar > a.active, .tab-more > summary.active, .tab-more[open] > summary { color: var(--ink); }
  .tabbar > a.active .i, .tab-more > summary.active .i { color: var(--accent); stroke-width: 2.1; }
  .tabbar > a:active { transform: scale(.94); }
  /* The dimmed page behind an open sheet belongs to the "More" button, so tapping it closes the sheet. */
  .tab-more[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: -1; cursor: default;
            background: rgba(20, 14, 10, .35); animation: fade-in .25s var(--ease); }
  .sheet { position: fixed; z-index: 31; left: 8px; right: 8px; bottom: calc(80px + env(safe-area-inset-bottom));
           padding: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lift);
           animation: sheet-up .3s var(--ease); }
  .sheet-title { padding: 0 8px 8px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .sheet-list { list-style: none; padding: 0; }
  .sheet-list a, .sheet-logout { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 0 8px;
           border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 500 var(--fs-md) var(--sans);
           text-decoration: none; cursor: pointer; }
  .sheet-list a span, .sheet-logout span { flex: 1; text-align: left; }
  .sheet-list a:active, .sheet-logout:active { background: var(--bg); }
  .sheet-list a.active { background: var(--bg); font-weight: 700; }
  .sheet-list .i { width: 22px; height: 22px; color: var(--muted); }
  .sheet-list .chev { width: 18px; height: 18px; }
  .sheet form { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
  .sheet-logout { color: var(--muted); }
  /* Bigger targets for small text links. */
  .row-actions a, .row-actions .link-button, .owner-actions a, .owner-actions .link-button,
  .footer-links a, .footer-links .link-button { display: inline-block; padding: 8px 0; }
  .btn { padding: 12px 24px; }
}

/* Phones: the expense table turns into a list of rows. Category and amount on the first line, date
   and note on the second; the whole row is the Edit link (Delete is on the edit page, with Undo).
   It's still a real table underneath, so screen readers keep the column names. */
@media (max-width: 560px) {
  .table-wrap { padding: 4px 16px; overflow: visible; }
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ledger, .ledger tbody { display: block; }
  .ledger tr { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
               grid-template-areas: "cat cat amt" "date note note"; gap: 2px 8px; padding: 14px 0;
               border-bottom: 1px solid var(--rule); }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger td { display: block; padding: 0; border: 0; }
  .ledger .cell-cat { grid-area: cat; font-weight: 500; font-size: var(--fs-md); }
  .ledger td.num { grid-area: amt; font-size: var(--fs-md); }
  .ledger .cell-date { grid-area: date; color: var(--muted); }
  .ledger .col-note { display: block; grid-area: note; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ledger .col-note:not(:empty)::before { content: "·"; margin-right: 8px; }
  .ledger .row-actions { position: static; }
  .ledger .row-actions div { display: contents; }
  .ledger .row-actions a { position: absolute; inset: 0; padding: 0; border-radius: var(--r-sm); font-size: 0; color: transparent; }
  .ledger .row-actions a:focus-visible { outline-offset: -2px; }
  .ledger .row-actions form { display: none; }
  .ledger tbody tr:active { background: var(--bg); }
}

@media (max-width: 350px) {   /* iPhone SE (1st gen) and other very narrow screens */
  .moods { gap: 8px; }
  .moods span { width: 42px; height: 42px; border-radius: var(--r-sm); }
  .moods span .i { width: 24px; height: 24px; }
  .day-notes, .journal-form { padding: 16px; }
  .site-nav a { font-size: var(--fs-sm); padding: 8px 8px; }
  .month-nav a, .month-nav .muted { padding: 8px 8px; font-size: var(--fs-xs); }
}
