/* Default background (no JS yet, or sessionStorage off): solid color
   from the original design. JS in public/page-background.js sets
   `--page-bg` to a Picsum URL on first load and persists it for the
   session, at which point the layered backgrounds below kick in. */
:root { --page-bg: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background-color: #f5f5f7;
  /* Two-layer background: a translucent "scrim" on top so foreground
     text stays readable, and the nature image on the bottom. The scrim
     is matched per theme below. background-attachment: fixed pins the
     image to the viewport — content scrolls over it instead of with
     it, which gives the parallax-y feel the user asked for. */
  background-image: linear-gradient(rgba(245, 245, 247, 0.88), rgba(245, 245, 247, 0.88)), var(--page-bg);
  background-attachment: fixed, fixed;
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  color: #1d1d1f;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
/* Cosmetics 1+2 — scope the sticky to the LAYOUT's header only.
   Without `body > `, this rule also pinned the inner <header> inside
   <article class="reading-view"><header>...</header></article> on
   /article/:uid, which jammed the title into a small visible
   sticky-area column and made the rest of the page hard to read. */
body > header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  padding: 0.75rem 2rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-right: auto;
  text-decoration: none;
}
.logo:hover { color: #0071e3; }
html.dark .logo:hover { color: #0a84ff; }
nav a {
  text-decoration: none;
  color: #515154;
  font-size: 0.92rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s;
}
nav a:hover { background: #e8e8ed; }
nav a.active { color: #0071e3; font-weight: 600; }

/* STUFF.md #15 — pure-CSS dropdowns (AI ▾ / Manage ▾). Open on
   hover OR keyboard focus-within so the menu is reachable without
   JS and accessible to keyboard users. */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-trigger {
  background: transparent;
  border: none;
  color: #515154;
  font-size: 0.92rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.15s;
}
.nav-dropdown-trigger:hover { background: #e8e8ed; }
.nav-dropdown.active > .nav-dropdown-trigger { color: #0071e3; font-weight: 600; }
.nav-dropdown-caret { font-size: 0.7rem; opacity: 0.7; }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 8rem;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  padding: 0.35rem;
  display: none;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  color: #1d1d1f;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: #f2f2f7; }
html.dark .nav-dropdown-trigger { color: #c7c7cc; }
html.dark .nav-dropdown-trigger:hover { background: #2c2c2e; }
html.dark .nav-dropdown-menu { background: #1c1c1e; border-color: #2c2c2e; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
html.dark .nav-dropdown-menu a { color: #f5f5f7; }
html.dark .nav-dropdown-menu a:hover { background: #2c2c2e; }
html.dark .nav-dropdown.active > .nav-dropdown-trigger { color: #0a84ff; }

/* Search icon button — same visual size as the bus icon. */
nav a.nav-search-icon {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  color: #515154;
}
nav a.nav-search-icon:hover { background: #e8e8ed; color: #0071e3; }
nav a.nav-search-icon.active { color: #0071e3; }
html.dark nav a.nav-search-icon { color: #c7c7cc; }
html.dark nav a.nav-search-icon:hover { background: #2c2c2e; color: #0a84ff; }
html.dark nav a.nav-search-icon.active { color: #0a84ff; }

/* STUFF.md #17 — /whats-on page. Sections stack; section count chips
   reuse the muted small style from elsewhere; matches list is a
   compact time/teams/league row. */
.whats-on-section { margin: 1.5rem 0; }
.whats-on-count { font-size: 0.85rem; font-weight: normal; }
.whats-on-foot { margin-top: 1rem; font-size: 0.88rem; }
.whats-on-matches { list-style: none; padding: 0; margin: 0; }
.whats-on-match {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #e5e5ea;
}
html.dark .whats-on-match { border-bottom-color: #2c2c2e; }
.whats-on-match:last-child { border-bottom: none; }
.whats-on-time { min-width: 5rem; font-weight: 600; color: #1d1d1f; }
html.dark .whats-on-time { color: #f5f5f7; }
.whats-on-matchup a { color: inherit; text-decoration: none; font-weight: 500; }
.whats-on-matchup a:hover { color: #0071e3; }
html.dark .whats-on-matchup a:hover { color: #0a84ff; }
.whats-on-league { font-size: 0.85rem; }
.live-badge {
  background: #ff3b30;
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Phase 3 (2026-05-12) — bus-mode discovery chip in the "To listen
   today" header. Pulls eyes to the existing /bus route which used to
   only be reachable from the header 🚌 icon. */
.whats-on-bus-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #1d1d1f;
  background: #fff5d6;
  border: 1px solid #f3e1a3;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  margin-left: 0.6rem;
  vertical-align: middle;
  transition: background 0.1s;
}
.whats-on-bus-chip:hover { background: #ffec99; }
html.dark .whats-on-bus-chip {
  color: #f5f5f7;
  background: #3a2e10;
  border-color: #5a4818;
}
html.dark .whats-on-bus-chip:hover { background: #4a3a14; }

/* Reading-time pill on /articles meta + /article/:uid subtitle. */
.news-reading-time {
  font-variant-numeric: tabular-nums;
}

/* Phase A1 (consumer auth, 2026-05-13). Header chip + sign-in/up
   links + the sign-up / sign-in form cards + recovery-codes drawer. */
.auth-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  background: #f2f2f7;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #1d1d1f;
  margin-right: 0.3rem;
  text-decoration: none;
}
.auth-chip:hover { background: #e5e5ea; }
html.dark .auth-chip { background: #2c2c2e; color: #f5f5f7; }
html.dark .auth-chip:hover { background: #3a3a3c; }
.auth-signout-form { display: inline; margin-right: 0.3rem; }
.auth-header-link {
  font-size: 0.9rem;
  text-decoration: none;
  color: #515154;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  margin-right: 0.2rem;
}
.auth-header-link:hover { background: #e8e8ed; }
.auth-header-link-primary {
  color: #0071e3;
  border: 1px solid #0071e3;
}
.auth-header-link-primary:hover { background: #0071e3; color: #fff; }
html.dark .auth-header-link { color: #c7c7cc; }
html.dark .auth-header-link:hover { background: #2c2c2e; }
html.dark .auth-header-link-primary { color: #0a84ff; border-color: #0a84ff; }
html.dark .auth-header-link-primary:hover { background: #0a84ff; color: #fff; }

/* Sign-up + sign-in form cards. Reuse the existing .benchmark-section
   surface; the form itself stacks vertically with a clear button. */
.auth-card { max-width: 480px; margin: 1rem auto; padding: 2rem 1.5rem; }
.auth-card-recovery { margin-top: 0.75rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form label.full-width { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-form input[type="text"] {
  font-size: 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  background: #fff;
  color: #1d1d1f;
}
.auth-form input[type="text"]:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.18);
}
html.dark .auth-form input[type="text"] {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
.auth-form .btn-primary { padding: 0.7rem 1.2rem; font-size: 1rem; }
.auth-hint { font-size: 0.8rem; }
.auth-error { margin-top: 0.5rem; }
.auth-footer-link { text-align: center; max-width: 480px; margin: 1.5rem auto; }
.auth-recovery-fallback {
  max-width: 480px;
  margin: 1rem auto;
  padding: 0.5rem 1rem;
  border-radius: 6px;
}
.auth-recovery-fallback summary {
  cursor: pointer;
  color: #6e6e73;
  font-size: 0.9rem;
}
html.dark .auth-recovery-fallback summary { color: #aeaeb2; }

/* Recovery-codes display — fixed-width font, generous spacing so
   the user can read + copy a code without confusing 0/O / 1/I. */
.auth-recovery-card { max-width: 540px; margin: 1.5rem auto; padding: 2rem 1.5rem; }
.auth-recovery-codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  line-height: 1.8;
  background: #f6f6f8;
  border: 1px solid #e5e5ea;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1rem 0;
  white-space: pre;
  user-select: all;
  -webkit-user-select: all;
}
html.dark .auth-recovery-codes {
  background: #1c1c1e;
  border-color: #2c2c2e;
  color: #f5f5f7;
}
.auth-recovery-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.auth-recovery-continue {
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
}
.auth-recovery-continue:hover { text-decoration: underline; }
html.dark .auth-recovery-continue { color: #0a84ff; }

/* Phase 3 polish (2026-05-12) — /search UI. Pre-search "Try a query"
   panel plus the search-result card style (left thumb + title +
   FTS5-snippet excerpt + meta line). */
.search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0.5rem 0;
}
.search-suggestion-chip {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: #f2f2f7;
  border: 1px solid #e5e5ea;
  border-radius: 999px;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 0.88rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: background 0.1s;
}
.search-suggestion-chip:hover { background: #e8e8ed; }
html.dark .search-suggestion-chip {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .search-suggestion-chip:hover { background: #3a3a3c; }
.search-hint {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e5ea;
  font-size: 0.85rem;
  line-height: 1.7;
}
html.dark .search-hint { border-top-color: #2c2c2e; }
.search-results-summary {
  margin: 1rem 0 0.75rem 0;
}
/* The FTS5 snippet() function wraps hits in <mark>; this gives them
   a soft highlight that works in both themes. */
.search-excerpt {
  margin: 0.35rem 0 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #424245;
}
html.dark .search-excerpt { color: #c7c7cc; }
.search-excerpt mark {
  background: #fff7c2;
  color: inherit;
  padding: 0 0.15rem;
  border-radius: 2px;
}
html.dark .search-excerpt mark { background: #3a2f0a; color: #f5f5f7; }
/* The search-result row doesn't need the bulk-action checkbox column
   that articles.erb reserves; pull the left padding back. */
.search-results-list .news-item { padding-left: 0.75rem; }
.search-results-list .news-item.has-thumb {
  grid-template-areas:
    "thumb main"
    "thumb excerpt"
    "thumb badges"
    "thumb meta";
}
.search-results-list .news-item.has-thumb .search-excerpt { grid-area: excerpt; }

/* Phase 2 polish (2026-05-12) — "Pick up where you left off" tile.
   Rendered above What's On for returning users when at least one
   podcast or YouTube video has a saved position in localStorage. */
.continue-progress h3 { margin-bottom: 0.5rem; }
.continue-progress-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.continue-progress-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}
html.dark .continue-progress-item { background: rgba(28, 28, 30, 0.65); }
.continue-progress-thumb {
  position: relative;
  display: block;
  width: 96px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  text-decoration: none;
}
.continue-progress-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.continue-progress-thumb:hover img { transform: scale(1.04); }
.continue-progress-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  background: linear-gradient(transparent 55%, rgba(0,0,0,0.4));
  pointer-events: none;
}
.continue-progress-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.continue-progress-title {
  font-weight: 500;
  color: #1d1d1f;
  text-decoration: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.continue-progress-title:hover { color: #0071e3; }
html.dark .continue-progress-title { color: #f5f5f7; }
html.dark .continue-progress-title:hover { color: #0a84ff; }
.continue-progress-resume {
  font-size: 0.82rem;
  color: #6e6e73;
  font-variant-numeric: tabular-nums;
}
html.dark .continue-progress-resume { color: #aeaeb2; }
.continue-progress-feed {
  font-size: 0.78rem;
}

/* STUFF.md #16 follow-up — embedded YouTube player on /article/:uid.
   Aspect-ratio 16:9 wrapper so the iframe scales to whatever width
   the article column gets. background:#000 so the lazy-load doesn't
   flash white. */
.article-youtube-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 1.5rem 0;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.article-youtube-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* /whats-on "To watch today" cards — thumbnail + body side-by-side
   on desktop, stack on mobile. The play overlay is a CSS-only
   semi-transparent circle with a triangle. */
.whats-on-watch .whats-on-watch-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  align-items: start;
}
.whats-on-watch-thumb {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  text-decoration: none;
}
.whats-on-watch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.whats-on-watch-thumb:hover img { transform: scale(1.04); }
.whats-on-watch-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  background: linear-gradient(transparent 60%, rgba(0,0,0,0.4));
  pointer-events: none;
}
@media (max-width: 600px) {
  .whats-on-watch .whats-on-watch-card { grid-template-columns: 1fr; }
}
button#theme-toggle {
  padding: 0.35rem 0.9rem;
  border: 1px solid #d2d2d7;
  background: transparent;
  color: #1d1d1f;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
}
main { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }
h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }
.subtitle { color: #6e6e73; margin-bottom: 1.25rem; font-size: 0.95rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-header > div:first-child {
  flex: 1;
}
.page-header .refresh-btn {
  margin-top: 0.25rem;
  cursor: pointer;
}

.notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.disclaimer {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}
.summary-table th {
  background: #f5f5f7;
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  color: #6e6e73;
  font-weight: 600;
}
.summary-table td { padding: 0.7rem 1rem; font-size: 0.95rem; border-top: 1px solid #f0f0f5; }
.positive { color: #34c759; font-weight: 600; }
.negative { color: #ff3b30; font-weight: 600; }
.signal { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.signal-buy  { background: #d1f7e0; color: #1c7c3a; }
.signal-sell { background: #ffe0de; color: #c0392b; }
.signal-hold { background: #e8e8ed; color: #515154; }
.type-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: #e5e5ea; color: #3a3a3c; }
.type-etf  { background: #e0f0ff; color: #0055aa; }
.type-adr  { background: #fff4e0; color: #a05800; }
.type-fund { background: #f0e8ff; color: #6600cc; }
.region-link { color: inherit; text-decoration: none; border-bottom: 1px dotted #aaa; }
.region-link:hover { color: #0071e3; border-bottom-color: #0071e3; }
.cache-meta { font-size: 0.85rem; color: #6e6e73; margin-bottom: 0.75rem; }
.cache-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.cache-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid #e5e5ea; font-weight: 600; }
.cache-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid #f2f2f2; vertical-align: middle; }
.cache-table tr.stale-row td { background: #fffbf0; }
.type-candle  { background: #e0ffe8; color: #006622; }
.type-analyst { background: #fff0f0; color: #aa0000; }
.type-profile { background: #eef4ff; color: #0044aa; }
.type-quote   { background: #f5f5f5; color: #333; }
.chart-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.chart-box {
  flex: 1;
  min-width: 280px;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.chart-box h3 { font-size: 1rem; margin-bottom: 0.5rem; color: #1d1d1f; }
/* Chart.js with maintainAspectRatio:false expands to fill its parent.
   Pin the canvas to a fixed height so it can never grow unbounded. */
.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 300px !important;
  max-height: 300px;
}
footer {
  text-align: center;
  padding: 1.5rem;
  color: #6e6e73;
  font-size: 0.82rem;
  margin-top: 3rem;
  border-top: 1px solid #e0e0e5;
}
.footer-freshness { display: block; margin-top: 0.25rem; opacity: 0.7; }
/* Picsum/Unsplash attribution slot in the footer. Empty by default
   (no separator either); :not(:empty) adds the bullet only once
   page-background.js has populated it. */
.bg-attribution:not(:empty)::before { content: ' · '; }
.bg-attribution a { color: inherit; }
.bg-attribution a:hover { color: #0071e3; }

/* /admin/backgrounds — current pool grid with thumbnails. */
.bg-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.bg-pool-card {
  margin: 0;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html.dark .bg-pool-card { background: #1c1c1e; border-color: #2c2c2e; }
.bg-pool-card img { display: block; width: 100%; height: auto; }
.bg-pool-card figcaption {
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}

/* ---- Article + podcast thumbnails -----------------------------------
   Three surfaces:
     1. Hero image at the top of /article/:uid       — .article-hero
     2. Right-side thumbnail on /articles list rows  — .news-item-thumb
     3. Cover art on /podcasts show cards             — .podcast-show-cover
     4. Episode thumbnail on /podcasts recent cards   — .podcast-card-image
   Width-bounded so a giant CDN image doesn't blow out the layout. */
.article-hero {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 0 1rem;
  background: #f0f0f5;
}
html.dark .article-hero { background: #2c2c2e; }

/* STUFF.md follow-up — article-row thumbnails moved to the LEFT
   and enlarged from 64px → 96px so the list has visual rhythm.
   When a thumb is present we switch the row to a two-column grid
   so the thumb + content sit side-by-side rather than the title
   wrapping under a right-anchored square. */
.news-item-thumb-link {
  grid-area: thumb;
  display: block;
  width: 96px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f5;
  text-decoration: none;
}
.news-item-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.news-item-thumb-link:hover .news-item-thumb { transform: scale(1.04); }
html.dark .news-item-thumb-link { background: #2c2c2e; }
.news-item.has-thumb {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-areas:
    "thumb main"
    "thumb badges"
    "thumb meta";
  column-gap: 0.85rem;
  align-items: start;
}
.news-item.has-thumb .news-row-main    { grid-area: main; }
.news-item.has-thumb .news-row-badges  { grid-area: badges; }
.news-item.has-thumb .news-meta        { grid-area: meta; }
.news-item.has-thumb.news-item-podcast .news-item-thumb-link { aspect-ratio: 1 / 1; height: auto; }

@media (max-width: 600px) {
  .news-item-thumb-link { width: 72px; height: 54px; }
  .news-item.has-thumb  { grid-template-columns: 72px 1fr; column-gap: 0.6rem; }
}

/* STUFF.md follow-up — day-group dividers ("Today" / "Yesterday" /
   "Earlier this week" / "Earlier this month" / "Older"). Thin row,
   small caps, subtle bar — visually distinct from articles but not
   competing for attention. */
.news-day-divider {
  list-style: none;
  padding: 1rem 0 0.4rem 2.35rem;
  border-bottom: 1px solid transparent !important;
}
.news-day-divider:first-child { padding-top: 0.4rem; }
.news-day-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6e6e73;
  border-bottom: 1px solid #e5e5ea;
  padding-bottom: 0.35rem;
  display: block;
}
html.dark .news-day-label { color: #aeaeb2; border-bottom-color: #2c2c2e; }

/* STUFF.md follow-up — source-cluster ribbons. Appear above a run
   of 3+ consecutive rows sharing a feed_id. The whole ribbon is a
   filter link to that feed. */
.news-source-ribbon {
  list-style: none;
  padding: 0.5rem 0.75rem 0.5rem 2.35rem;
  background: linear-gradient(90deg, rgba(0, 113, 227, 0.07), transparent 60%);
  border-radius: 6px;
  margin: 0.35rem 0 0.1rem 0;
}
.news-source-ribbon a {
  color: #1d1d1f;
  text-decoration: none;
  font-size: 0.88rem;
}
.news-source-ribbon a:hover { color: #0071e3; }
html.dark .news-source-ribbon { background: linear-gradient(90deg, rgba(10, 132, 255, 0.12), transparent 60%); }
html.dark .news-source-ribbon a { color: #f5f5f7; }
html.dark .news-source-ribbon a:hover { color: #0a84ff; }
.news-source-ribbon-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e6e73;
  margin-right: 0.25rem;
}
html.dark .news-source-ribbon-label { color: #aeaeb2; }

/* STUFF.md follow-up — context line right under the /articles
   header. Slightly tighter type than .subtitle since it carries
   denser meta info (count + freshest source). */
.articles-context {
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

/* Podcast show cards (top of /podcasts) — square cover art on top,
   title + meta below. */
.podcast-show-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: #f0f0f5;
}
html.dark .podcast-show-cover { background: #2c2c2e; }

/* Recent-episode cards on /podcasts — image left, body right. .has-image
   modifier flips the layout to a 2-col grid; cards without an image
   keep the existing block layout. */
.podcast-card.has-image {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.85rem;
  align-items: start;
}
.podcast-card-image {
  display: block;
  width: 96px;
  height: 96px;
}
.podcast-card-image img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f5;
}
html.dark .podcast-card-image img { background: #2c2c2e; }
.podcast-card-body { min-width: 0; } /* let text wrap inside the grid track */

/* Dark mode — `html.dark body` wins specificity over the plain `body`
   ruleset above, so the body's background flips when the toggle adds
   `dark` to the html element. */
html.dark,
html.dark body {
  background-color: #1c1c1e;
  color: #f5f5f7;
}
html.dark body {
  /* Darker scrim so the nature photo doesn't bleach out the dark theme. */
  background-image: linear-gradient(rgba(28, 28, 30, 0.85), rgba(28, 28, 30, 0.85)), var(--page-bg);
}
html.dark header {
  background: rgba(28,28,30,0.9);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
html.dark .logo { color: #f5f5f7; }
html.dark nav a { color: #aeaeb2; }
html.dark nav a:hover { background: #2c2c2e; }
html.dark nav a.active { color: #0a84ff; }
html.dark button#theme-toggle { border-color: #3a3a3c; color: #f5f5f7; }
html.dark .summary-table { background: #2c2c2e; box-shadow: none; }
html.dark .summary-table th { background: #1c1c1e; color: #8e8e93; }
html.dark .summary-table td { border-color: #3a3a3c; }
html.dark .chart-box { background: #2c2c2e; }
html.dark .chart-box h3 { color: #f5f5f7; }
html.dark footer { border-color: #3a3a3c; }

/* ---- Stale cache banner ---- */
.stale-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.86rem;
  color: #664d00;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stale-icon { font-size: 1rem; }
html.dark .stale-banner {
  background: #3a2e00;
  border-color: #ffc107;
  color: #ffd55a;
}

/* ---- Market Signals cards (dashboard) ---- */
.market-signals-section { margin-top: 2.5rem; }
.market-signals-section h3 { font-size: 1.15rem; color: #1d1d1f; margin-bottom: 1rem; }
.signal-cards { display: flex; flex-wrap: wrap; gap: 1rem; }
.signal-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  flex: 1 1 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 3px solid #aeaeb2;
}
.signal-card-buy  { border-top-color: #34c759; }
.signal-card-sell { border-top-color: #ff3b30; }
.signal-card-hold { border-top-color: #ff9f0a; }
.signal-card-header { display: flex; justify-content: space-between; align-items: center; }
.signal-card-symbol { font-size: 1.2rem; font-weight: 700; color: #0071e3; text-decoration: none; }
.signal-card-symbol:hover { text-decoration: underline; }
.signal-card-meta { display: flex; gap: 0.5rem; font-size: 0.82rem; color: #6e6e73; align-items: center; }
.signal-card-price { font-weight: 600; color: #1d1d1f; }
.signal-card-rationale { font-size: 0.82rem; color: #6e6e73; margin: 0; }
.view-analysis-link { font-size: 0.82rem; color: #0071e3; text-decoration: none; align-self: flex-start; }
.view-analysis-link:hover { text-decoration: underline; }
.analyst-summary { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.analyst-type { font-size: 0.74rem; background: #f2f2f7; border-radius: 6px; padding: 0.15rem 0.5rem; color: #555; }
.analyst-counts { font-size: 0.74rem; color: #6e6e73; }

.signal.signal-lg { font-size: 1rem; padding: 0.35rem 0.9rem; }

/* ---- Analysis page ---- */
.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.analysis-title h2 { margin: 0 0 0.2rem 0; font-size: 2rem; }
.analysis-name { margin: 0; color: #6e6e73; font-size: 1rem; }
.analysis-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.analysis-signal-badge { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.signal-type-label { font-size: 0.78rem; color: #8e8e93; }

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  background: #f2f2f7;
  color: #3a3a3c;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.refresh-btn:hover { background: #e5e5ea; border-color: #aeaeb2; }

.chart-no-data { text-align: center; padding: 1rem 0; }

html.dark .analysis-title h2 { color: #f5f5f7; }
html.dark .refresh-btn { background: #3a3a3c; border-color: #48484a; color: #aeaeb2; }
html.dark .refresh-btn:hover { background: #48484a; }
.analysis-section {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.analysis-section h3 { margin: 0 0 1rem 0; font-size: 1.05rem; color: #1d1d1f; }
.data-source { margin: 1rem 0 0; font-size: 0.76rem; color: #8e8e93; }
.no-data { color: #8e8e93; font-style: italic; }

/* Analyst bars */
.analyst-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.analyst-row { display: flex; align-items: center; gap: 0.75rem; }
.analyst-label { width: 90px; font-size: 0.85rem; color: #1d1d1f; flex-shrink: 0; }
.analyst-bar-wrap { flex: 1; background: #f2f2f7; border-radius: 4px; height: 12px; overflow: hidden; }
.analyst-bar { height: 100%; border-radius: 4px; min-width: 2px; transition: width 0.3s ease; }
.analyst-bar-bullish { background: #34c759; }
.analyst-bar-neutral  { background: #ff9f0a; }
.analyst-bar-bearish  { background: #ff3b30; }
.analyst-count { width: 28px; font-size: 0.82rem; color: #6e6e73; text-align: right; flex-shrink: 0; }

/* Profile grid */
.profile-grid { display: flex; flex-direction: column; gap: 1rem; }
.profile-description p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: #3a3a3c; }
.profile-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem 1.5rem; }
.profile-field { display: flex; flex-direction: column; }
.field-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: #8e8e93; }
.field-value { font-size: 0.95rem; font-weight: 500; color: #1d1d1f; }
.field-value.positive { color: #34c759; }
.field-value.negative { color: #ff3b30; }

/* External links */
.external-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.ext-link {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  border: 1px solid #0071e3;
  border-radius: 8px;
  color: #0071e3;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.ext-link:hover { background: #0071e3; color: #fff; }

/* Period toggle buttons */
.period-buttons { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.period-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid #d1d1d6;
  border-radius: 7px;
  background: #f2f2f7;
  color: #3a3a3c;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.period-btn:hover { background: #e5e5ea; }
.period-btn.active { background: #0071e3; color: #fff; border-color: #0071e3; }

/* Data tables (macro snapshot, international indices, etc.)
   Builds on .summary-table and refines it for the Apple-inspired aesthetic:
   hairline dividers, tabular numerals, right-aligned numeric columns. */
.data-table {
  box-shadow: none;
  margin-bottom: 0;
  border-radius: 0;
  background: transparent;
}
.data-table thead th {
  background: transparent;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8e8e93;
  font-weight: 500;
  border-bottom: 1px solid #e5e5ea;
  padding: 0.6rem 1rem;
}
.data-table tbody td {
  padding: 0.7rem 1rem;
  border-top: 1px solid #f2f2f7;
  font-size: 0.95rem;
  color: #1d1d1f;
}
.data-table tbody tr:first-child td { border-top: none; }
.data-table .num { text-align: right; }
.data-table .mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.data-table .muted { color: #8e8e93; font-size: 0.88rem; }
.analysis-section > .data-table { margin-left: -0.5rem; margin-right: -0.5rem; width: calc(100% + 1rem); }

/* TradingView chart (analysis page) */
.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.chart-toolbar h3 { margin: 0; }
.chart-legend {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #6e6e73;
}
.chart-legend .legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.chart-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 1.5px;
  background: #aeaeb2;
}
.chart-legend .swatch.sma20  { background: #ff9500; }
.chart-legend .swatch.sma50  { background: #0071e3; }
.chart-legend .swatch.sma200 { background: #af52de; }
.chart-legend .swatch.bb     { background: #8e8e93; }

.chart-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tv-chart-host {
  position: relative;
  width: 100%;
  min-height: 1440px; /* 4 × 360 — must match PANE_HEIGHTS in app.js */
  display: flex;
  flex-direction: column;
  gap: 0; /* panes flush */
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
.tv-pane { position: relative; }
.tv-pane + .tv-pane { border-top: 1px solid #f2f2f7; }

.tv-readout {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 3;
  display: flex;
  gap: 0.85rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: #3a3a3c;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.tv-readout b { color: #1d1d1f; font-weight: 600; }
.tv-readout .tv-readout-date { font-weight: 600; color: #1d1d1f; }
.tv-readout .positive { color: #34c759; font-weight: 600; }
.tv-readout .negative { color: #ff3b30; font-weight: 600; }

html.dark .tv-chart-host { background: #2c2c2e; }
html.dark .tv-pane + .tv-pane { border-top-color: #3a3a3c; }
html.dark .tv-readout {
  background: rgba(28, 28, 30, 0.75);
  color: #aeaeb2;
  box-shadow: none;
}
html.dark .tv-readout b,
html.dark .tv-readout .tv-readout-date { color: #f5f5f7; }

/* News panel (analysis page) */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid #f0f0f5;
}
html.dark .news-list { border-top-color: #2c2c2e; }
.news-item {
  position: relative;
  padding: 0.65rem 0.75rem 0.65rem 2.35rem;
  border-bottom: 1px solid #f0f0f5;
  border-radius: 6px;
  transition: background 0.1s;
}
.news-item-check {
  position: absolute;
  left: 0.7rem;
  top: 0.9rem;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.1s;
}
.news-item:hover .news-item-check,
.news-item-check:checked,
.news-list.has-selection .news-item-check {
  opacity: 1;
}
html.dark .news-item { border-bottom-color: #2c2c2e; }
.news-item:hover { background: #f5f5f7; }
html.dark .news-item:hover { background: #2c2c2e; }

/* The icon + headline are one big anchor — click anywhere on it to
   open the article in a new tab. Generous padding gives a Fitts'-law
   click target (HN-style row-link). Display is grid so the icon
   column stays a fixed width while the headline wraps. */
.news-row-main {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.6rem;
  align-items: start;
  text-decoration: none;
  color: inherit;
}
.news-kind-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  text-align: center;
  user-select: none;
  flex-shrink: 0;
}
.news-headline {
  font-size: 0.96rem;
  font-weight: 600;
  color: #0071e3;
  line-height: 1.4;
}
.news-row-main:hover .news-headline { text-decoration: underline; }
html.dark .news-headline { color: #0a84ff; }

.news-row-badges {
  margin: 0.3rem 0 0 2.35rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.news-meta {
  display: flex;
  gap: 0.75rem;
  margin: 0.3rem 0 0 2.35rem;
  font-size: 0.78rem;
  color: #8e8e93;
}
.news-source { font-weight: 500; }
.news-summary { margin: 0.45rem 0 0 2.35rem; font-size: 0.88rem; line-height: 1.5; color: #3a3a3c; }

/* Dark mode extensions */
html.dark .market-signals-section h3 { color: #f5f5f7; }
html.dark .signal-card { background: #2c2c2e; box-shadow: none; }
html.dark .signal-card-symbol { color: #0a84ff; }
html.dark .signal-card-price { color: #f5f5f7; }
html.dark .analyst-type { background: #3a3a3c; color: #aeaeb2; }
html.dark .analysis-section { background: #2c2c2e; box-shadow: none; }
html.dark .analysis-section h3 { color: #f5f5f7; }
html.dark .analyst-label { color: #f5f5f7; }
html.dark .analyst-bar-wrap { background: #3a3a3c; }
html.dark .profile-description p { color: #aeaeb2; }
html.dark .field-value { color: #f5f5f7; }
html.dark .ext-link { border-color: #0a84ff; color: #0a84ff; }
html.dark .ext-link:hover { background: #0a84ff; color: #fff; }
html.dark .period-btn { background: #3a3a3c; border-color: #48484a; color: #aeaeb2; }
html.dark .period-btn:hover { background: #48484a; }
html.dark .period-btn.active { background: #0a84ff; color: #fff; border-color: #0a84ff; }
html.dark .type-badge { background: #3a3a3c; color: #aeaeb2; }
html.dark .type-etf  { background: #003366; color: #6cb4ff; }
html.dark .type-adr  { background: #3d2000; color: #ffd080; }
html.dark .type-fund { background: #2d0066; color: #c080ff; }
html.dark .region-link { color: #aeaeb2; border-bottom-color: #555; }
html.dark .region-link:hover { color: #0a84ff; border-bottom-color: #0a84ff; }
html.dark .cache-meta { color: #aeaeb2; }
html.dark .cache-table th { border-bottom-color: #48484a; }
html.dark .cache-table td { border-bottom-color: #3a3a3c; }
html.dark .cache-table tr.stale-row td { background: #2d2700; }
html.dark .type-candle  { background: #003318; color: #44cc77; }
html.dark .type-analyst { background: #330000; color: #ff8080; }
html.dark .type-profile { background: #001133; color: #6699ff; }
html.dark .type-quote   { background: #2c2c2e; color: #aeaeb2; }
html.dark .data-table thead th { border-bottom-color: #3a3a3c; }
html.dark .data-table tbody td { border-top-color: #3a3a3c; color: #f5f5f7; }
html.dark .data-table .muted   { color: #8e8e93; }
html.dark .news-item { border-bottom-color: #3a3a3c; }
html.dark .news-headline { color: #0a84ff; }
html.dark .news-summary { color: #aeaeb2; }

/* ============================================================
   §4 — Search, Watchlist, Alerts, Compare
   ============================================================ */

/* ---- Top-nav search box ---------------------------------- */
.search-box { position: relative; }
.search-box input {
  width: 220px;
  padding: 0.4rem 0.75rem;
  border: 1px solid #d2d2d7;
  background: rgba(255,255,255,0.7);
  border-radius: 20px;
  font-size: 0.88rem;
  color: #1d1d1f;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 360px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e0e0e5;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
}
.search-result-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
}
.search-result-item.highlight,
.search-result-item:hover { background: #f0f4ff; }
.sr-symbol { font-weight: 600; color: #0071e3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sr-name   { color: #1d1d1f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-region { color: #8e8e93; font-size: 0.78rem; }
.search-result-item.search-discover { border-top: 1px dashed #d1d1d6; font-style: italic; }
.search-result-item.search-discover .sr-region { color: #0071e3; text-transform: lowercase; }
.search-result-item.search-discover.loading { opacity: 0.6; }
.search-result-item.search-discover.loading .sr-name::after { content: ' …'; }
.search-result-item.search-discover.error .sr-name { color: #d70015; }
html.dark .search-result-item.search-discover { border-top-color: #3a3a3c; }
html.dark .search-result-item.search-discover.error .sr-name { color: #ff453a; }

/* ---- Watchlist button on analysis page ------------------- */
.watchlist-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d2d2d7;
  background: #fff;
  color: #1d1d1f;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.watchlist-btn:hover { border-color: #0071e3; color: #0071e3; }
.watchlist-btn[data-state="on"] {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

/* ---- Export CSV button ----------------------------------- */
.export-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d2d2d7;
  background: #fff;
  color: #1d1d1f;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.export-btn:hover { border-color: #0071e3; color: #0071e3; }

/* ---- Watchlist row remove (dashboard) -------------------- */
.watchlist-remove {
  background: transparent;
  border: none;
  color: #8e8e93;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.watchlist-remove:hover { color: #ff3b30; background: #ffece9; }
.watchlist-symbol { color: #0071e3; font-weight: 600; text-decoration: none; }
.watchlist-symbol:hover { text-decoration: underline; }

/* ---- Alerts (analysis page) ------------------------------ */
.alert-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.alert-form label { display: flex; flex-direction: column; font-size: 0.85rem; }
.alert-form input,
.alert-form select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 140px;
}
.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #e0e0e5;
}
.alert-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid #f0f0f5;
  font-size: 0.9rem;
}
.alert-cond { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.alert-status { color: #8e8e93; font-size: 0.82rem; }
.alert-triggered .alert-status { color: #ff3b30; font-weight: 600; }
.alert-remove {
  background: transparent;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: #515154;
  font-size: 0.8rem;
}
.alert-remove:hover { border-color: #ff3b30; color: #ff3b30; }
.alert-empty { padding: 0.75rem 0; color: #8e8e93; font-size: 0.9rem; }

/* ---- Compare page ---------------------------------------- */
.compare-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.compare-form label { display: flex; flex-direction: column; flex: 1; min-width: 180px; font-size: 0.85rem; }
.compare-form input,
.compare-form select {
  padding: 0.45rem 0.7rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 0.9rem;
}
.compare-chart-box { padding: 1rem 1.2rem; }
.compare-chart-host {
  position: relative;
  width: 100%;
  height: 420px;
}
.compare-chart-host canvas { width: 100% !important; height: 100% !important; }

/* ---- Dark-mode overrides --------------------------------- */
html.dark .search-box input {
  background: rgba(44,44,46,0.7);
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .search-results { background: #1c1c1e; border-color: #3a3a3c; }
html.dark .search-result-item.highlight,
html.dark .search-result-item:hover { background: #2c2c2e; }
html.dark .sr-name   { color: #f5f5f7; }
html.dark .sr-region { color: #8e8e93; }
html.dark .watchlist-btn,
html.dark .export-btn {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .watchlist-btn[data-state="on"] {
  background: #0a84ff; border-color: #0a84ff; color: #fff;
}
html.dark .alert-form input,
html.dark .alert-form select,
html.dark .compare-form input,
html.dark .compare-form select {
  background: #1c1c1e; border-color: #3a3a3c; color: #f5f5f7;
}
html.dark .alert-row { border-bottom-color: #2c2c2e; }
html.dark .alert-list { border-top-color: #3a3a3c; }

/* ---------- Portfolio (§1) ---------- */
.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}
.summary-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #e5e5ea);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.summary-label {
  font-size: 12px;
  font-weight: 500;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.summary-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.summary-sub {
  font-size: 14px;
  font-weight: 500;
  margin-left: 4px;
  color: #6e6e73;
}
.portfolio-table th, .portfolio-table td { white-space: nowrap; }
.portfolio-add {
  margin-top: 32px;
  padding: 20px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #e5e5ea);
  border-radius: 10px;
}
.portfolio-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  align-items: end;
  margin-top: 12px;
}
.portfolio-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 500;
  color: #444;
}
.portfolio-form label.full-width { grid-column: 1 / -1; }
.portfolio-form input {
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #d1d1d6;
  border-radius: 6px;
  background: #fff;
}
.portfolio-form .btn-primary {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: #0a84ff;
  color: #fff;
  cursor: pointer;
  align-self: end;
}
.portfolio-form .btn-primary:hover { background: #006fdb; }
.link-btn {
  border: none;
  background: transparent;
  color: #6e6e73;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
}
.link-btn:hover { background: rgba(0,0,0,0.05); color: #d70015; }

html.dark .summary-card,
html.dark .portfolio-add {
  background: #1c1c1e;
  border-color: #2c2c2e;
}
html.dark .summary-label { color: #98989d; }
html.dark .summary-sub { color: #98989d; }
html.dark .portfolio-form label { color: #d1d1d6; }
html.dark .portfolio-form input {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .link-btn { color: #98989d; }
html.dark .link-btn:hover { background: rgba(255,255,255,0.06); color: #ff453a; }

.position-section .position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 24px;
  margin-bottom: 12px;
}
.position-section .portfolio-form { margin-top: 8px; }

/* ---------- Lot detail (expandable on /portfolio) ---------- */
.lot-detail-row td { padding: 0; background: transparent; }
.lot-detail-wrap {
  background: #f9f9fb;
  border-radius: 8px;
  margin: 4px 0 12px;
  padding: 12px 16px;
}
.lot-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.lot-detail-table th, .lot-detail-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #ececef;
}
.lot-detail-table th { color: #6e6e73; font-weight: 500; }
.lot-detail-table .num { text-align: right; }
.sell-form {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 0.88rem;
}
.sell-form input {
  width: 110px;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #d1d1d6;
  border-radius: 5px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.sell-form input[type="date"] { width: 150px; }
.sell-form .btn-primary {
  padding: 7px 14px;
  font-size: 13px;
}
.sell-form .data-source { margin: 0; flex: 1 1 100%; font-size: 0.78rem; }

html.dark .lot-detail-wrap { background: #1c1c1e; }
html.dark .lot-detail-table th, html.dark .lot-detail-table td { border-bottom-color: #2c2c2e; }
html.dark .lot-detail-table th { color: #98989d; }
html.dark .sell-form input { background: #1c1c1e; border-color: #3a3a3c; color: #f5f5f7; }

.admin-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}
.admin-action-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f5f5f7;
  border: 1px dashed #d1d1d6;
  border-radius: 8px;
  font-size: 0.88rem;
}
.admin-action-form input[type="text"] {
  padding: 6px 8px;
  border: 1px solid #d1d1d6;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 110px;
}
.admin-action-form .data-source { margin: 0; font-size: 0.78rem; }
html.dark .admin-action-form { background: #1c1c1e; border-color: #3a3a3c; color: #f5f5f7; }
html.dark .admin-action-form input[type="text"] { background: #1c1c1e; border-color: #3a3a3c; color: #f5f5f7; }

.fidelity-import {
  margin: 12px 0 16px;
  padding: 10px 14px;
  background: var(--card-bg, #f5f5f7);
  border: 1px dashed #d1d1d6;
  border-radius: 8px;
}
.fidelity-import-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
}
.fidelity-import-form .data-source { margin: 0; font-size: 0.82rem; }
.fidelity-import-form code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}
html.dark .fidelity-import { background: #1c1c1e; border-color: #3a3a3c; }
html.dark .fidelity-import-form code { background: rgba(255, 255, 255, 0.08); }

.lot-detail-inline {
  margin-top: 10px;
  font-size: 0.88rem;
}
.lot-detail-inline summary {
  cursor: pointer;
  color: #0071e3;
  padding: 4px 0;
  user-select: none;
}
.lot-detail-inline summary:hover { text-decoration: underline; }
.lot-detail-inline .lot-detail-table { margin-top: 6px; }
html.dark .lot-detail-inline summary { color: #0a84ff; }

/* ---------- Tax-lot badges + wash-sale ---------- */
.signal-badge.holding-short   { background: #fff4d6; color: #5a4500; }
.signal-badge.holding-long    { background: #d6f0e0; color: #1d4620; }
.signal-badge.holding-mixed   { background: #e3e3ff; color: #2d2d80; }
.signal-badge.holding-unknown { background: #ececef; color: #6e6e73; }
.signal-badge.holding-wash    { background: #fde2e2; color: #800a0a; cursor: help; margin-left: 4px; }

.wash-sale-detail-row td      { padding: 0; background: transparent; border: none; }
.wash-sale-warning {
  background: #fff8e1;
  color: #5a4500;
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  margin: 0 0 8px;
  font-size: 0.86rem;
  border-radius: 4px;
}
html.dark .signal-badge.holding-short   { background: #3a2f00; color: #ffe69c; }
html.dark .signal-badge.holding-long    { background: #1d3a25; color: #a3d8a3; }
html.dark .signal-badge.holding-mixed   { background: #2d2d80; color: #d8d8ff; }
html.dark .signal-badge.holding-unknown { background: #2c2c2e; color: #98989d; }
html.dark .signal-badge.holding-wash    { background: #5a1010; color: #ffb0b0; }
html.dark .wash-sale-warning            { background: #3a2f00; color: #ffe69c; border-left-color: #f59e0b; }

.benchmark-section { margin-top: 16px; }
.benchmark-section h3 { margin-bottom: 8px; }

/* Summary regenerate buttons — vertical stack so the heading row stays
   uncluttered (just title + muted backend marker). align-items at the
   start so the buttons match their content width. */
.summary-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}
.summary-actions form { margin: 0; }

/* ---------- Collapsible positions table ---------- */
.positions-collapsible {
  margin: 16px 0;
}
.positions-collapsible-summary {
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  background: #f5f5f7;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  list-style: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.positions-collapsible-summary::-webkit-details-marker { display: none; }
.positions-collapsible-summary:hover { background: #ececef; }
.positions-chevron {
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 0.85rem;
  color: #6e6e73;
}
.positions-collapsible[open] .positions-chevron {
  transform: rotate(90deg);
}
.positions-collapsible[open] .positions-collapsible-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}
.positions-collapsible[open] > table.portfolio-table {
  border-top: none;
  border-radius: 0 0 8px 8px;
}
html.dark .positions-collapsible-summary {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .positions-collapsible-summary:hover { background: #2c2c2e; }
html.dark .positions-chevron { color: #98989d; }

/* ---------- Correlation heatmap ---------- */
.corr-heatmap-wrap {
  margin: 12px 0 8px;
  overflow-x: auto;
}
.corr-heatmap {
  border-collapse: separate;
  border-spacing: 2px;
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
}
.corr-heatmap th, .corr-heatmap td { padding: 0; }
.corr-heatmap .corr-cell {
  width: 64px;
  height: 56px;
  text-align: center;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  cursor: default;
}
.corr-heatmap .corr-row-label,
.corr-heatmap .corr-col-label {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #1d1d1f;
  font-size: 0.85rem;
  white-space: nowrap;
}
.corr-heatmap .corr-row-label { text-align: right; padding-right: 10px; }
.corr-heatmap .corr-col-label { text-align: center; padding-bottom: 6px; }
.corr-heatmap .corr-corner { width: 60px; }

.corr-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.8rem;
}
.corr-legend-swatch {
  display: inline-block;
  width: 16px;
  height: 14px;
  border-radius: 2px;
}
.corr-legend-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #6e6e73; padding: 0 4px; }
.corr-legend-tip   { margin-left: 8px; }

html.dark .corr-heatmap .corr-row-label,
html.dark .corr-heatmap .corr-col-label { color: #f5f5f7; }
html.dark .corr-legend-label { color: #8e8e93; }

/* ---------- Degradation banner ---------- */
.degradation-banner {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0 16px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.degradation-banner .banner-icon { font-size: 18px; line-height: 1; }
.degradation-banner .banner-link {
  color: #664d03;
  font-weight: 500;
  text-decoration: underline;
}
.degradation-banner .banner-link:hover { color: #423500; }
.degradation-banner form { margin: 0; }
.degradation-banner .link-btn {
  background: transparent;
  color: #664d03;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
html.dark .degradation-banner {
  background: #3a2f00;
  color: #ffe69c;
  border-color: #6b5400;
}
html.dark .degradation-banner .banner-link,
html.dark .degradation-banner .link-btn { color: #ffe69c; }
html.dark .degradation-banner .banner-link:hover { color: #fff; }

/* ---- tech-feed-reader additions ---------------------------------- */

/* Generic red error notice — symmetric with .notice for warnings.   */
.error {
  background: #fff5f5;
  border: 1px solid #ff3b30;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: #b30000;
}
html.dark .error {
  background: #3a1a1a;
  color: #ff8b80;
  border-color: #5a2828;
}

/* Reading-list rows — read articles dim, badges sit inline.         */
.news-item.read .news-headline { color: #6e6e73; font-weight: 500; }
.news-item.read .news-kind-icon { opacity: 0.4; }
.news-item.read .news-summary,
.news-item.read .excerpt        { color: #8e8e93; }
html.dark .news-item.read .news-headline { color: #8e8e93; }

/* FTS5 snippet excerpt below the headline.                          */
.excerpt {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #3a3a3c;
}
.excerpt mark {
  background: #fff3cd;
  color: #1d1d1f;
  padding: 0 2px;
  border-radius: 2px;
}
html.dark .excerpt      { color: #c7c7cc; }
html.dark .excerpt mark { background: #5a4a00; color: #fff8d6; }

/* Tag chips: small pill links applied to articles or in filters.    */
.tag-chip {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  margin: 0 0.15rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #e8f0ff;
  color: #0058c7;
  text-decoration: none;
  border: 1px solid #d2e1f9;
  white-space: nowrap;
}
.tag-chip:hover { background: #d2e1f9; }
.tag-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 0 0 0.3rem;
  margin: 0;
  font: inherit;
  cursor: pointer;
}
.tag-chip-add {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  margin: 0 0.15rem;
  border-radius: 12px;
  font-size: 0.75rem;
  background: transparent;
  color: #6e6e73;
  border: 1px dashed #d2d2d7;
  cursor: pointer;
}
.tag-chip-add:hover { background: #f0f4ff; color: #0071e3; border-color: #d2e1f9; }
html.dark .tag-chip      { background: #1c2c4f; color: #6ea3ff; border-color: #2a3d66; }
html.dark .tag-chip:hover{ background: #2a3d66; }
html.dark .tag-chip-add  { color: #aeaeb2; border-color: #48484a; }
html.dark .tag-chip-add:hover { background: #1c2c4f; color: #6ea3ff; border-color: #2a3d66; }

/* Read / bookmark / archive badges on listing rows.                 */
.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  margin: 0 0.15rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: #f2f2f7;
  color: #6e6e73;
}
.badge.bookmarked { background: #fff8d6; color: #8a6d00; }
.badge.archived   { background: #efeff5; color: #6e6e73; }
.badge.podcast-badge { background: #e9d6ff; color: #5e1f9c; letter-spacing: 0.06em; }
html.dark .badge                  { background: #2c2c2e; color: #aeaeb2; }
html.dark .badge.bookmarked       { background: #4a3a00; color: #ffe68a; }
html.dark .badge.podcast-badge    { background: #3a1d5e; color: #d6b8ff; }

/* State filter row above article lists.                              */
.state-filter a {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  margin-right: 0.3rem;
  border-radius: 14px;
  font-size: 0.85rem;
  color: #6e6e73;
  text-decoration: none;
  border: 1px solid transparent;
}
.state-filter a:hover  { background: #f0f4ff; color: #0071e3; }
.state-filter a.active { background: #0071e3; color: #fff; }

/* Article reading view + actions row.                                */
.reading-view header { margin-bottom: 1.5rem; }
.reading-view .actions {
  display: flex;
  flex-wrap: wrap;       /* Cosmetics 3 — let the row wrap on narrow widths
                            once Phase 3+5 added 👍/👎/Mute author/Mute keyword */
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
  align-items: center;
}
.reading-view .actions .mute-keyword-form input[type="text"] {
  /* Bound the keyword-mute input so the inline form doesn't push
     the surrounding buttons across the wrap. */
  width: 10rem;
}
.reading-view .actions form { margin: 0; }
.reading-view .actions button {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d2d2d7;
  background: #fff;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}
.reading-view .actions button:hover { background: #f5f5f7; }
.reading-view .tags { margin: 0.75rem 0 0; line-height: 1.9; }
.reading-view .article-body {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
  line-height: 1.6;
}
.reading-view .article-body img { max-width: 100%; height: auto; border-radius: 6px; }
.reading-view .article-body pre  { overflow-x: auto; }
.reading-view .article-footer { margin-top: 1.5rem; }
html.dark .reading-view .article-body { background: #1c1c1e; border-color: #2c2c2e; }

/* Prev / next pager.                                                  */
.pager {
  margin-top: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
  color: #6e6e73;
}
.pager a {
  color: #0071e3;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border: 1px solid #d2e1f9;
  border-radius: 6px;
}
.pager a:hover { background: #f0f4ff; }

/* Danger button (delete / remove).                                    */
button.danger {
  background: #ff3b30;
  border: none;
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}
button.danger:hover { background: #d70015; }

/* "Empty state" wrapper for pages with no data yet.                   */
.empty-state {
  background: #fff;
  border: 1px dashed #d2d2d7;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  color: #6e6e73;
}
html.dark .empty-state { background: #1c1c1e; border-color: #3a3a3c; }

/* Stat cards on the dashboard.                                        */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.stat-cards .summary-card { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-cards .summary-label { font-size: 0.78rem; color: #6e6e73; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-cards .summary-value { font-size: 1.5rem; font-weight: 600; color: #1d1d1f; }
.stat-cards .summary-sub   { font-size: 0.78rem; color: #8e8e93; }
html.dark .stat-cards .summary-value { color: #f5f5f7; }

/* Dashboard activity widgets — chart container + side-by-side grid.   */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}
.tag-cloud { line-height: 2; }
.tag-cloud .tag-chip { margin-right: 0.25rem; }
.chart-box {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.5rem;
  position: relative;
  /* Tall enough to absorb the t-money canvas rule's `height: 300px
     !important` (defined earlier in this file, around line 131) plus
     padding. Without this, the canvas overflows the box and renders
     on top of the next section. */
  height: 332px;
  overflow: hidden;
}
html.dark .chart-box { background: #1c1c1e; border-color: #2c2c2e; }

/* Trending topics list — one row per topic, term chip + sample titles. */
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f2f2f7;
  font-size: 0.9rem;
}
.topic-row:last-child { border-bottom: none; }
.topic-samples { color: #6e6e73; }
.topic-samples a { color: #6e6e73; text-decoration: none; margin-right: 0.2rem; }
.topic-samples a:hover { color: #0071e3; text-decoration: underline; }
html.dark .topic-row { border-bottom-color: #2c2c2e; }
html.dark .topic-samples,
html.dark .topic-samples a { color: #aeaeb2; }

/* Feed catalog — discover popular feeds.                              */
.catalog-category {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e6e73;
}
.catalog-list { list-style: none; padding: 0; margin: 0; }
.catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid #f2f2f7;
}
.catalog-row:last-child { border-bottom: none; }
.catalog-row.subscribed { opacity: 0.65; }
.catalog-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}
.catalog-title { font-weight: 600; color: #1d1d1f; }
.catalog-blurb { font-size: 0.88rem; color: #3a3a3c; }
.catalog-url { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subscribed-badge { background: #e8f5e9; color: #1b5e20; }
html.dark .catalog-row { border-bottom-color: #2c2c2e; }
html.dark .catalog-title { color: #f5f5f7; }
html.dark .catalog-blurb { color: #c7c7cc; }
html.dark .subscribed-badge { background: #1a3a1d; color: #6ee895; }

/* STUFF.md #23 — Ask-AI prompt box on /feeds. The textarea gets its
   width from .portfolio-form .full-width; this just styles the
   rationale line under each recommendation so it visually trails the
   blurb without competing with it. */
.ai-recommend-form textarea {
  /* box-sizing keeps the padding + border INSIDE the 100% width so the
     textarea doesn't overflow its containing .full-width label. */
  box-sizing: border-box;
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  resize: vertical;
}
html.dark .ai-recommend-form textarea {
  background: #1c1c1e;
  border-color: #38383a;
  color: #f5f5f7;
}
.ai-rationale {
  font-size: 0.85rem;
  color: #5a5a5f;
  margin-top: 0.15rem;
  font-style: italic;
}
html.dark .ai-rationale { color: #98989d; }

/* STUFF.md #23 polish — make the response block visually obvious so it
   doesn't get lost on a long /feeds page, plus a "thinking" indicator
   between submit and the synchronous server render. */
.feeds-ai-recommend {
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #f8f3ff;
  border: 1px solid #d6c2ff;
  border-radius: 10px;
}
html.dark .feeds-ai-recommend {
  background: #221a33;
  border-color: #4a3a6e;
}
.ai-recommend-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
/* Hidden by default — JS adds .is-visible at form submit. (Using a class
   toggle instead of the [hidden] attribute because the latter conflicts
   with the explicit `display` rule we'd otherwise need: `display:
   inline-flex` would silently win over the UA stylesheet's
   `display: none` for `[hidden]`, and the indicator would render at
   page load.) */
.ai-thinking {
  display: none;
  align-items: center;
  gap: 0.4rem;
  color: #5a5a5f;
  font-size: 0.9rem;
}
.ai-thinking.is-visible {
  display: inline-flex;
}
html.dark .ai-thinking { color: #c7c7cc; }
.ai-thinking-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #7c4dff;
  animation: ai-thinking-pulse 1.1s ease-in-out infinite;
}
@keyframes ai-thinking-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1.0; transform: scale(1.0); }
}
.ai-recommend-result {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: #ffffff;
  border: 2px solid #7c4dff;
  border-radius: 8px;
  outline: none;
}
html.dark .ai-recommend-result {
  background: #1c1c1e;
  border-color: #a47bff;
}
.ai-recommend-result--parse_error,
.ai-recommend-result--error {
  border-color: #d32f2f;
}
.ai-recommend-result-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}
.ai-recommend-meta {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #d2d2d7;
  font-size: 0.82rem;
  color: #5a5a5f;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
html.dark .ai-recommend-meta {
  border-top-color: #3a3a3c;
  color: #98989d;
}

/* STUFF #27 — filter toolbar above the subscribed feeds table and the
   catalog browse list. Pure client-side filter (public/feeds-filter.js):
   search input narrows by title/URL substring, chips narrow by topic. */
.feeds-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.feeds-filter-search {
  flex: 1 1 220px;
  min-width: 200px;
  padding: 0.4rem 0.7rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
html.dark .feeds-filter-search {
  background: #1c1c1e;
  border-color: #38383a;
  color: #f5f5f7;
}
.feeds-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.feeds-filter-chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  line-height: 1;
}
.feeds-filter-chip:hover { border-color: #b6b6bb; }
.feeds-filter-chip.is-active {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #fff;
}
html.dark .feeds-filter-chip {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #f5f5f7;
}
html.dark .feeds-filter-chip:hover { border-color: #5a5a5c; }
html.dark .feeds-filter-chip.is-active {
  background: #f5f5f7;
  border-color: #f5f5f7;
  color: #1d1d1f;
}
.feeds-filter-count {
  font-size: 0.78rem;
  color: #6e6e73;
  margin-left: auto;
}
html.dark .feeds-filter-count { color: #98989d; }

/* /topics page table — keeps the term-chip column to its content width
   so all chips align flush-left, and lets the samples column take the
   remaining width without squeezing the count. */
.topics-table .topic-cell { white-space: nowrap; vertical-align: middle; }
.topics-table .num         { white-space: nowrap; vertical-align: middle; min-width: 4rem; }
.topics-table .topic-samples {
  vertical-align: middle;
  line-height: 1.5;
}

/* ---- Mobile responsive (≤720px) ----------------------------------- */
/* Compact header so logo + nav + theme toggle fit; soften padding on
   the main content area; let .data-table scroll horizontally rather
   than overflow the page; collapse multi-column form grids and the
   catalog row's flex layout into single columns. */
@media (max-width: 720px) {
  header {
    padding: 0.55rem 1rem;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .logo { font-size: 1rem; margin-right: 0; }
  nav {
    flex-basis: 100%;
    order: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
  }
  nav a { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
  button#theme-toggle { order: 2; padding: 0.25rem 0.7rem; font-size: 0.8rem; }

  main { padding: 0 1rem; margin: 1rem auto; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1rem; }

  /* Tables — wrap each in its own horizontal scroll viewport so a wide
     row doesn't break the layout. Slightly smaller font + tighter
     cell padding so the common case still fits without scrolling. */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
  }
  .data-table th, .data-table td { padding: 0.4rem 0.6rem; }

  /* Form grids — collapse to one column. */
  .portfolio-form { grid-template-columns: 1fr; }

  /* Catalog rows — stack the meta/blurb above the Add button. */
  .catalog-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .catalog-meta { min-width: 0; }

  /* Reading view — slimmer side padding so prose fills the screen. */
  .reading-view .article-body { padding: 0.9rem 1.1rem; }

  /* Stat cards — smaller value type so 3 fit on phones. */
  .stat-cards { gap: 0.5rem; }
  .stat-cards .summary-value { font-size: 1.25rem; }

  /* Topics page table — already inside .data-table, but the samples
     column gets cramped on phones; force it to wrap inline. */
  .topics-table .topic-samples { white-space: normal; }
}

/* Header refresh button — sits between the nav and the theme toggle on
   every page so the user can trigger a manual refresh from anywhere.
   POSTs to /admin/refresh/all, which redirects to /feeds with the
   per-feed result counts in the flash. Match the theme-toggle pill
   shape so the two icon buttons feel like a set. */
.header-refresh-form { margin: 0; }
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid #d2d2d7;
  background: transparent;
  color: #1d1d1f;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.header-icon-btn:hover { background: #e8e8ed; }
.header-icon-btn:active svg { transform: rotate(90deg); transition: transform 0.2s; }
html.dark .header-icon-btn { border-color: #3a3a3c; color: #f5f5f7; }
html.dark .header-icon-btn:hover { background: #2c2c2e; }
/* Anchor-shaped header icons (e.g. the bus button) need link styles
   reset so they don't inherit the generic underline / blue color. */
a.header-icon-btn { text-decoration: none; }
a.header-icon-btn.active { background: #e8e8ed; }
html.dark a.header-icon-btn.active { background: #2c2c2e; }

/* Header refresh toast — anchored to the right of the header so it sits
   adjacent to the icon button. Auto-clears in JS after ~3.5s. */
#header-flash { position: relative; }
.header-toast {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 50;
}
.header-toast.error { background: #d70015; }
html.dark .header-toast { background: #f5f5f7; color: #1d1d1f; }
html.dark .header-toast.error { background: #ff453a; color: #fff; }

/* ----- Podcast browse page (/podcasts) ------------------------------- */
.podcast-shows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.podcast-show-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.podcast-show-card:hover {
  border-color: #b6b6bb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
html.dark .podcast-show-card {
  background: #1c1c1e;
  border-color: #3a3a3c;
}
html.dark .podcast-show-card:hover { border-color: #5a5a5c; }
.podcast-show-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1d1d1f;
}
html.dark .podcast-show-title { color: #f5f5f7; }
.podcast-show-meta {
  font-size: 0.78rem;
  color: #6e6e73;
}

/* STUFF #26 — YouTube channel grid (/youtube) reuses .podcast-shows +
   .podcast-show-card for the card grid shape, but each YouTube card
   bundles a primary card-link AND a sibling "↗ Channel" link. Putting
   the ↗ inside the main link would nest <a> inside <a>; instead the
   outer card is a div and the two children are siblings. */
.youtube-channel-card { position: relative; gap: 0.4rem; }
.podcast-show-card-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
}
.youtube-channel-link {
  align-self: flex-start;
  font-size: 0.78rem;
  color: #007aff;
  text-decoration: none;
}
.youtube-channel-link:hover { text-decoration: underline; }
html.dark .youtube-channel-link { color: #4dabff; }

/* STUFF #30 — bulk-add channels form + per-line result panel on
   /youtube. Reuses .benchmark-section + .portfolio-form for the base
   shape; this block styles the result list with status-color borders
   so subscribed/already/error rows are visually distinct at a glance. */
.youtube-bulk-add textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  resize: vertical;
}
html.dark .youtube-bulk-add textarea { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }

.youtube-bulk-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.youtube-bulk-result {
  padding: 0.5rem 0.7rem;
  border-left: 3px solid #d2d2d7;
  background: #f7f7f7;
  border-radius: 4px;
  font-size: 0.92rem;
}
.youtube-bulk-result--subscribed                { border-left-color: #34c759; background: #effaf1; }
.youtube-bulk-result--subscribed_pending_fetch  { border-left-color: #34c759; background: #effaf1; }
.youtube-bulk-result--already                   { border-left-color: #007aff; background: #eaf3fc; }
.youtube-bulk-result--not_found                 { border-left-color: #ff9500; background: #fff5e6; }
.youtube-bulk-result--error                     { border-left-color: #ff3b30; background: #fdeceb; }
.bulk-result-icon { font-weight: 700; margin-right: 0.35rem; }
.bulk-result-hint { font-size: 0.82rem; color: #3a3a3c; margin-top: 0.25rem; font-style: italic; }
html.dark .youtube-bulk-result                              { background: #1c1c1e; border-left-color: #3a3a3c; }
html.dark .youtube-bulk-result--subscribed                  { background: #14321a; border-left-color: #34c759; }
html.dark .youtube-bulk-result--subscribed_pending_fetch    { background: #14321a; border-left-color: #34c759; }
html.dark .youtube-bulk-result--already                     { background: #122a40; border-left-color: #4dabff; }
html.dark .youtube-bulk-result--not_found                   { background: #3a2a10; border-left-color: #ff9f0a; }
html.dark .youtube-bulk-result--error                       { background: #3a1816; border-left-color: #ff453a; }
html.dark .bulk-result-hint                                 { color: #c7c7cc; }

/* /youtube/:feed_id — the recent-videos grid. Card style is the same
   visual idiom as the podcast show cards but bigger so the thumbnail
   has room to breathe (videos are 16:9). */
.youtube-video-grid {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.youtube-video-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.youtube-video-card:hover { border-color: #b6b6bb; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
html.dark .youtube-video-card { background: #1c1c1e; border-color: #3a3a3c; }
html.dark .youtube-video-card:hover { border-color: #5a5a5c; }
.youtube-video-card.read { opacity: 0.7; }
.youtube-video-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.youtube-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.youtube-video-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem; height: 3rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  font-size: 1.25rem;
  pointer-events: none;
}
.youtube-video-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.75rem 0.75rem;
}
.youtube-video-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1d1d1f;
  text-decoration: none;
  line-height: 1.3;
}
.youtube-video-title:hover { text-decoration: underline; }
html.dark .youtube-video-title { color: #f5f5f7; }
.youtube-video-published { font-size: 0.78rem; }

.podcast-episodes {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}
.podcast-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  background: #fff;
}
.podcast-card.read { opacity: 0.65; }
html.dark .podcast-card {
  background: #1c1c1e;
  border-color: #3a3a3c;
}
.podcast-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #6e6e73;
  align-items: baseline;
}
.podcast-card-show {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5e1f9c;
  text-decoration: none;
}
html.dark .podcast-card-show { color: #d6b8ff; }
.podcast-card-show:hover { text-decoration: underline; }
.podcast-card-duration {
  font-variant-numeric: tabular-nums;
  background: #f2f2f7;
  color: #1d1d1f;
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
}
html.dark .podcast-card-duration { background: #2c2c2e; color: #f5f5f7; }
.podcast-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: #1d1d1f;
  text-decoration: none;
}
html.dark .podcast-card-title { color: #f5f5f7; }
.podcast-card-title:hover { color: #0071e3; }
.podcast-card-excerpt {
  margin: 0;
  font-size: 0.86rem;
  color: #3a3a3c;
  line-height: 1.4;
  /* Clamp to ~3 lines so cards stay scannable. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.dark .podcast-card-excerpt { color: #aeaeb2; }
.podcast-card-actions { margin-top: auto; }
.podcast-card-actions .btn-primary {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* /admin/traces — one card per trace, table of spans inside.
 *
 * Layout notes: the attributes column carries arbitrarily long values
 * (URLs, page titles, user-agent strings). To keep them inside the
 * card we (a) pin the table to a fixed layout with per-column widths,
 * (b) drop the per-attr nowrap so long values wrap onto multiple
 * lines, (c) overflow-wrap: anywhere so URL-like tokens with no
 * spaces can still break, and (d) overflow-x: auto on the card as a
 * defence in depth in case a future browser disagrees. */
.trace-card {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
html.dark .trace-card { background: #1c1c1e; border-color: #2c2c2e; }
.trace-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.trace-card-name { font-weight: 600; }
.trace-card-name a { color: #1d1d1f; text-decoration: none; }
html.dark .trace-card-name a { color: #f5f5f7; }
.trace-card-name a:hover { color: #0071e3; }
.trace-card-meta { font-size: 0.85rem; }
.trace-spans {
  width: 100%;
  table-layout: fixed;
}
.trace-spans th:nth-child(1), .trace-spans td:nth-child(1) { width: 28%; }
.trace-spans th:nth-child(2), .trace-spans td:nth-child(2) { width:  8%; }
.trace-spans th:nth-child(3), .trace-spans td:nth-child(3) { width: 10%; }
.trace-spans th:nth-child(4), .trace-spans td:nth-child(4) { width: 12%; }
.trace-spans th:nth-child(5), .trace-spans td:nth-child(5) { width: 42%; }
.trace-spans tbody td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.trace-spans code { font-size: 0.88rem; }
.trace-attrs {
  font-size: 0.8rem;
  color: #6e6e73;
  line-height: 1.6;
}
html.dark .trace-attrs { color: #aeaeb2; }
.trace-attr {
  display: inline-block;
  margin-right: 0.75rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.trace-attr code {
  background: #f2f2f7;
  padding: 0 0.25rem;
  border-radius: 3px;
  color: #1d1d1f;
}
html.dark .trace-attr code { background: #2c2c2e; color: #f5f5f7; }

/* ---- Persistent mini-player -------------------------------------------
   Pinned to the bottom edge of the viewport, full-width on mobile,
   centered with max-width on desktop. Holds the only <audio> element
   in the app. data-turbo-permanent on #global-player keeps the DOM
   alive across Turbo navigations, so audio doesn't stop when you
   click a link. body.has-mini-player adds bottom padding to <main>
   so content doesn't get hidden under the bar. */
#global-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: #fff;
  border-top: 1px solid #e5e5ea;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
  padding: 0.5rem 1rem;
}
html.dark #global-player { background: #1c1c1e; border-top-color: #2c2c2e; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.35); }
#global-player[hidden] { display: none !important; }
/* Push the entire body (main + footer with bg-attribution) up when
   the fixed mini-player is visible. The footer is OUTSIDE <main>,
   so padding the body — not just main — keeps the artist attribution
   line visible above the player bar. */
body.has-mini-player { padding-bottom: 5rem; }

.mini-player {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 1100px;
  margin: 0 auto;
}
.mini-player-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1d1d1f;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.dark .mini-player-title { color: #f5f5f7; }
.mini-player-title:hover { color: #0071e3; }
.mini-player-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.mini-player-btn {
  background: transparent;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  color: #1d1d1f;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
html.dark .mini-player-btn { border-color: #3a3a3c; color: #f5f5f7; }
.mini-player-btn:hover { background: #f2f2f7; }
html.dark .mini-player-btn:hover { background: #2c2c2e; }
.mini-player-play { background: #0071e3; color: #fff; border-color: #0071e3; min-width: 2.4rem; justify-content: center; }
.mini-player-play:hover { background: #0064c8; }
html.dark .mini-player-play { background: #0a84ff; border-color: #0a84ff; }
html.dark .mini-player-play:hover { background: #2a94ff; }
.mini-player-icon { font-size: 1rem; line-height: 1; }
.mini-player-icon-label { font-size: 0.7rem; opacity: 0.85; }
.mini-player-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: #6e6e73;
  min-width: 7rem;
  text-align: center;
}
html.dark .mini-player-time { color: #aeaeb2; }
.mini-player-time-sep { opacity: 0.6; margin: 0 0.15rem; }
.mini-player-scrubber { flex: 1; min-width: 80px; }
.mini-player-rate {
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  background: #fff;
  color: #1d1d1f;
  font-size: 0.85rem;
}
html.dark .mini-player-rate { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }
.mini-player-close {
  margin-left: auto;
  font-size: 0.95rem;
  padding: 0.25rem 0.5rem;
}

@media (max-width: 600px) {
  .mini-player-icon-label { display: none; }
  .mini-player-time { min-width: 5rem; font-size: 0.78rem; }
  .mini-player-rate { display: none; }
}

/* "Play episode" button on the article view — replaces the old inline
   <audio> + controls. Loads the episode into the global mini-player. */
.play-episode-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 1rem;
}
.play-episode-active { background: #34c759 !important; }
html.dark .play-episode-active { background: #30d158 !important; }
.play-episode-duration { font-size: 0.88rem; }

/* ---- Chat widget ----------------------------------------------------
   Floating button bottom-right, opens a 360px-wide panel above it.
   Hidden by default; chat-widget.js removes [hidden] only after the
   /chat/health probe says Claude is configured.
*/
#chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  font-size: 0.95rem;
}
.chat-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #0071e3;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: background 0.15s, transform 0.15s;
}
.chat-toggle:hover { background: #0064c8; transform: translateY(-1px); }
html.dark .chat-toggle { background: #0a84ff; }
html.dark .chat-toggle:hover { background: #2a94ff; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 6rem);
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* The bare `hidden` attribute defaults to display:none, but the
   .chat-panel rule above sets display:flex, which overrides it. We
   need an explicit !important here so the panel actually starts
   closed and only opens when the user clicks the toggle button. */
.chat-panel[hidden] { display: none !important; }
html.dark .chat-panel { background: #1c1c1e; border-color: #2c2c2e; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }

.chat-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0f0f5;
  background: #fafafc;
}
html.dark .chat-panel-header { background: #2c2c2e; border-bottom-color: #3a3a3c; }
.chat-panel-title { font-weight: 600; flex: 1; font-size: 0.92rem; color: #1d1d1f; }
html.dark .chat-panel-title { color: #f5f5f7; }
.chat-panel-context { font-weight: 400; }
.chat-panel-clear,
.chat-panel-close {
  background: transparent;
  border: none;
  color: #6e6e73;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}
.chat-panel-clear:hover,
.chat-panel-close:hover { background: #ececf0; color: #1d1d1f; }
html.dark .chat-panel-clear:hover,
html.dark .chat-panel-close:hover { background: #3a3a3c; color: #f5f5f7; }

.chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-msg {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  line-height: 1.4;
  max-width: 90%;
  word-wrap: break-word;
}
.chat-msg-user {
  align-self: flex-end;
  background: #0071e3;
  color: #fff;
  white-space: pre-wrap;
}
.chat-msg-assistant {
  align-self: flex-start;
  background: #f2f2f7;
  color: #1d1d1f;
}
html.dark .chat-msg-assistant { background: #2c2c2e; color: #f5f5f7; }
.chat-msg-assistant code {
  background: rgba(0, 0, 0, 0.07);
  padding: 0 0.25rem;
  border-radius: 3px;
  font-size: 0.88em;
}
html.dark .chat-msg-assistant code { background: rgba(255, 255, 255, 0.12); }
.chat-msg-assistant ul { margin: 0.25rem 0 0.25rem 1.1rem; padding: 0; }
.chat-msg-assistant li { margin: 0.1rem 0; }
.chat-msg-pending { opacity: 0.6; font-style: italic; }
.chat-msg-error {
  background: #ffe0de;
  color: #c0392b;
  font-style: normal;
  opacity: 1;
}
html.dark .chat-msg-error { background: #4a1a18; color: #ff6961; }
.chat-msg-hint {
  align-self: center;
  font-size: 0.85rem;
  color: #8e8e93;
  text-align: center;
  background: transparent;
  padding: 0.25rem 0.5rem;
}

.chat-panel-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem;
  border-top: 1px solid #f0f0f5;
  background: #fafafc;
}
html.dark .chat-panel-form { background: #2c2c2e; border-top-color: #3a3a3c; }
.chat-panel-input {
  flex: 1;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
  min-height: 2.4rem;
  max-height: 7rem;
  background: #fff;
  color: #1d1d1f;
}
html.dark .chat-panel-input { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }
.chat-panel-input:focus { outline: 2px solid #0071e3; outline-offset: -1px; }
.chat-panel-send {
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.chat-panel-send:hover:not(:disabled) { background: #0064c8; }
.chat-panel-send:disabled { background: #c4c4c9; cursor: not-allowed; }
html.dark .chat-panel-send { background: #0a84ff; }
html.dark .chat-panel-send:hover:not(:disabled) { background: #2a94ff; }
html.dark .chat-panel-send:disabled { background: #3a3a3c; }

/* ---- Digests ----------------------------------------------------------
   /digests is a list table styled like .data-table; the per-digest
   detail view drops a Digests.build_html fragment under .digest-items. */
.digest-meta { margin-bottom: 1rem; font-size: 0.9rem; }
.digest-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.digest-item {
  border-top: 1px solid #f0f0f5;
  padding: 0.85rem 0;
}
.digest-item:first-child { border-top: none; }
html.dark .digest-item { border-top-color: #2c2c2e; }
.digest-item-title { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.digest-item-title a { color: #1d1d1f; text-decoration: none; }
html.dark .digest-item-title a { color: #f5f5f7; }
.digest-item-title a:hover { color: #0071e3; }
.digest-item-meta { font-size: 0.85rem; margin: 0.2rem 0 0.4rem; }
.digest-item-summary { color: #3a3a3c; font-size: 0.92rem; line-height: 1.45; }
html.dark .digest-item-summary { color: #aeaeb2; }

/* ---- /articles bulk-actions toolbar ----------------------------------
   Sticky banner that appears once a row checkbox is ticked. The
   `[hidden] { display: none !important }` rule is required because
   .bulk-toolbar's `display: flex` would otherwise override the
   bare hidden attribute (same trick as .chat-panel). */
.bulk-toolbar {
  position: sticky;
  top: 0.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
html.dark .bulk-toolbar { background: #1c1c1e; border-color: #3a3a3c; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.bulk-toolbar[hidden] { display: none !important; }
.bulk-toolbar-count { font-weight: 600; margin-right: 0.5rem; font-size: 0.92rem; }
.bulk-toolbar-btn {
  background: #fff;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.bulk-toolbar-btn:hover:not(:disabled) { background: #f2f2f7; }
.bulk-toolbar-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bulk-toolbar-btn.is-pending { opacity: 0.7; }
html.dark .bulk-toolbar-btn { background: #2c2c2e; color: #f5f5f7; border-color: #3a3a3c; }
html.dark .bulk-toolbar-btn:hover:not(:disabled) { background: #3a3a3c; }
.bulk-toolbar-clear { margin-left: auto; }

/* ---- Phase 3 feedback signal ---------------------------------------
   Three surfaces share the same colour palette:
     up   = green (#34c759 / dark #30d158)
     down = red   (#ff3b30 / dark #ff453a)
   Idle / cleared state is the existing button colour, so the active
   state lights up clearly when the user has voted. */

/* /article/:uid action row */
.feedback-btn.feedback-on-up   { background: #34c759 !important; color: #fff !important; border-color: #34c759 !important; }
.feedback-btn.feedback-on-down { background: #ff3b30 !important; color: #fff !important; border-color: #ff3b30 !important; }
html.dark .feedback-btn.feedback-on-up   { background: #30d158 !important; border-color: #30d158 !important; }
html.dark .feedback-btn.feedback-on-down { background: #ff453a !important; border-color: #ff453a !important; }

/* /articles row inline 👍/👎 — hidden by default, revealed on row
   hover. When the user has actually voted, .feedback-set keeps the
   chosen button visible regardless of hover so the vote is always
   discoverable. */
.news-row-feedback {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.1s;
}
.news-item:hover .news-row-feedback,
.news-row-feedback.feedback-set { opacity: 1; }
.news-row-feedback form { display: inline; margin: 0; }
.feedback-row-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.05rem 0.3rem;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  filter: grayscale(0.4);
  opacity: 0.75;
  transition: filter 0.1s, opacity 0.1s, background 0.1s;
}
.feedback-row-btn:hover { background: #f0f0f5; filter: none; opacity: 1; }
html.dark .feedback-row-btn:hover { background: #2c2c2e; }
.feedback-row-btn.is-on { filter: none; opacity: 1; background: #e0f5e6; }
.feedback-row-btn.is-on[aria-label="Thumbs down"] { background: #ffe0de; }
html.dark .feedback-row-btn.is-on { background: #1d3a23; }
html.dark .feedback-row-btn.is-on[aria-label="Thumbs down"] { background: #3a1a18; }
/* The badge container had display: flex from the original layout but
   we made it always-rendered now (so the hover affordances have
   somewhere to live). When there are no persistent badges, suppress
   the gap. */
.news-row-badges.is-empty { gap: 0; }

/* /feeds row weight controls — small +/− pills around the live
   weight readout. Default state (1.00×) is muted; non-default is
   highlighted to make it clear which feeds are weighted. */
.feed-row-weight {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-right: 0.4rem;
  font-size: 0.85rem;
}
.feed-weight-btn {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 4px;
  padding: 0.05rem 0.45rem;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: #1d1d1f;
}
.feed-weight-btn:hover { background: #e8e8ed; }
html.dark .feed-weight-btn { background: #2c2c2e; color: #f5f5f7; border-color: #3a3a3c; }
html.dark .feed-weight-btn:hover { background: #3a3a3c; }
.feed-weight-display {
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: center;
  color: #1d1d1f;
  font-weight: 600;
}
html.dark .feed-weight-display { color: #f5f5f7; }
.feed-row-weight.is-default .feed-weight-display { color: #8e8e93; font-weight: 400; }

/* ---- Skim mode (?view=skim on /articles) ----------------------------
   Drops the meta + badges + tag chips, enlarges the headline, and
   surfaces a summary line per row so the user can decide
   read/skip/save without opening anything. Same DOM as the default
   view; just a `.news-list.skim` modifier. */
.news-list.skim .news-row-badges,
.news-list.skim .news-meta { display: none; }
.news-list.skim .news-headline { font-size: 1.1rem; line-height: 1.35; }
.news-list.skim .news-item    { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.news-summary-skim {
  margin: 0.35rem 0 0 2.35rem;     /* line up under the headline (icon column = 1.75rem + 0.6rem gap) */
  font-size: 0.92rem;
  line-height: 1.45;
  color: #3a3a3c;
  /* Clamp to ~3 lines so a single very long article doesn't push the
     next item off the fold. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.dark .news-summary-skim { color: #c0c0c5; }
.news-item.read .news-summary-skim { color: #8e8e93; }

/* Cosmetics 4 — skim mode hides the row thumbnail. The 64px image
   on the right was overlapping the first 1–2 lines of the summary
   (which only set a margin-left, not padding-right). Skim mode is
   for fast scan-and-triage, the picture isn't load-bearing here. */
.news-list.skim .news-item-thumb { display: none; }
.news-list.skim .news-item.has-thumb .news-row-main,
.news-list.skim .news-item.has-thumb .news-row-badges,
.news-list.skim .news-item.has-thumb .news-meta { padding-right: 0; }

/* ---- Phase 5 mute filters --------------------------------------------
   /feeds Muted subsection — three small lists (keyword/author/feed)
   plus an add form. /article/:uid keyword form lives inside .actions
   so it picks up button styling for free; the inline input gets a
   modest width so it doesn't dominate the row. */
.mutes-section .mutes-add { gap: 0.75rem; align-items: end; }
.mute-list { list-style: none; padding: 0; margin: 0.5rem 0 1.25rem 0; }
.mute-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e5ea;
}
.mute-row:last-child { border-bottom: none; }
.mute-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92rem; }
.mute-since { font-size: 0.82rem; margin-left: auto; }
html.dark .mute-row { border-color: #3a3a3c; }

.mute-keyword-form input[type="text"] {
  width: 12rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-right: 0.25rem;
}
html.dark .mute-keyword-form input[type="text"] { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }

/* ---- Phase 7 Read-next card -----------------------------------------
   Single-suggestion card revealed by JS once the user scrolls past
   the sentinel. Slide-in via CSS; the [hidden] attribute keeps it out
   of layout until the JS removes it. Looks like a slim version of a
   .news-item to match the rest of the surface. */
.read-next-card {
  display: block;
  margin: 1.5rem 0 1rem 0;
  padding: 1rem 1.1rem;
  border-left: 4px solid #0071e3;
  background: rgba(0, 113, 227, 0.04);
  border-radius: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.read-next-card-visible { opacity: 1; transform: translateY(0); }
.read-next-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0071e3;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.read-next-headline {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  color: #1d1d1f;
  text-decoration: none;
  line-height: 1.35;
}
.read-next-headline:hover { text-decoration: underline; }
.read-next-meta {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #6e6e73;
  display: flex;
  gap: 0.6rem;
}
html.dark .read-next-card     { background: rgba(10, 132, 255, 0.08); border-left-color: #0a84ff; }
html.dark .read-next-headline { color: #f5f5f7; }
html.dark .read-next-label    { color: #0a84ff; }
html.dark .read-next-meta     { color: #98989d; }

/* ---- Phase 8 triage page --------------------------------------------
   Three sections (must_read / optional / skip), each a slimmed-down
   .news-list. The rationale line under each headline is the value-add
   over /articles — small, italic, slightly muted so the headline
   still leads. */
.triage-section h3 { margin-bottom: 0.25rem; }
.triage-rationale {
  margin: 0.35rem 0 0 0;
  font-size: 0.92rem;
  font-style: italic;
  color: #6e6e73;
  line-height: 1.4;
}
html.dark .triage-rationale { color: #aeaeb2; }
.triage-must_read .news-item { border-left: 3px solid #34c759; padding-left: 0.6rem; }
.triage-skip      .news-item { opacity: 0.7; }
html.dark .triage-must_read .news-item { border-left-color: #30d158; }

/* STUFF.md #8 — when triage rows use the vertical-card shape
   (sports-article-list), keep the must_read / skip accents from
   the old layout. Same border-left treatment but applied to the
   card's left edge directly. */
.triage-must_read .triage-card { border-left: 3px solid #34c759; padding-left: 0.6rem; }
.triage-skip      .triage-card { opacity: 0.7; }
html.dark .triage-must_read .triage-card { border-left-color: #30d158; }
.triage-card .triage-rationale {
  /* Bring the rationale slightly forward — it's the value-add
     over the news list, so it shouldn't read as just another
     muted meta line. */
  font-style: italic;
  margin: 0.25rem 0 0.4rem;
  color: #515154;
  font-size: 0.92rem;
  line-height: 1.45;
}
html.dark .triage-card .triage-rationale { color: #aeaeb2; }
.triage-card .triage-rationale strong { font-style: normal; color: #1d1d1f; }
html.dark .triage-card .triage-rationale strong { color: #f5f5f7; }

/* ---- Sports overview page (/sports) -------------------------------
   Vertical-card article rows (title / summary / meta on separate
   lines) plus a sticky TOC at the top so the user can jump between
   sport sections without scrolling back up. The /articles list
   keeps its existing horizontal one-line row layout — this richer
   format is sports-page-specific. */

.sports-toc {
  position: sticky;
  top: 60px;                /* clears the layout's sticky <body> > header */
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  margin: 0 -0.5rem 1.5rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #e5e5ea;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
html.dark .sports-toc { background: rgba(28, 28, 30, 0.92); border-color: #3a3a3c; }

.sports-toc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.sports-toc-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e6e73;
  font-weight: 600;
  margin-right: 0.25rem;
}
html.dark .sports-toc-label { color: #98989d; }

/* Per-team button — emoji or logo + short team name. Visually a
   little louder than the sport anchor pills (they're the
   first-class navigation for the team-centric mental model). */
.sports-toc-team {
  font-weight: 600;
  border-color: #b6b6bb;
}
.sports-team-logo-sm,
.sports-team-emoji-sm {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}
.sports-team-logo-sm { object-fit: contain; }

/* Team detail page header — bigger logo or emoji next to the
   team name. */
.sports-team-header h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sports-team-logo,
.sports-team-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.8rem;
  line-height: 1;
}
.sports-team-logo { object-fit: contain; }

/* ---- Score tiles (STUFF.md #9) -------------------------------------
   Strip of last-game tiles at the top of /sports + a single tile on
   the per-team detail page. Each tile: team header (logo + name +
   W/L pill), score, opponent line, meta (date · venue). Color the
   left-edge stripe by result. Compact card; full-row on mobile. */
.sports-score-tiles {
  margin: 0 0 1.5rem 0;
}
.sports-score-tiles-heading {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.sports-score-tile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.sports-score-tile {
  flex: 1 1 220px;
  min-width: 220px;
  max-width: 320px;
  display: block;
  text-decoration: none;
  color: #1d1d1f;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-left: 4px solid #d2d2d7;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  transition: box-shadow 0.12s, transform 0.12s;
}
.sports-score-tile:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); transform: translateY(-1px); }
.sports-score-tile-w { border-left-color: #34c759; }
.sports-score-tile-l { border-left-color: #ff3b30; }
.sports-score-tile-d { border-left-color: #ff9500; }
html.dark .sports-score-tile {
  background: #1c1c1e; border-color: #3a3a3c; color: #f5f5f7;
}
html.dark .sports-score-tile-w { border-left-color: #30d158; }
html.dark .sports-score-tile-l { border-left-color: #ff453a; }
html.dark .sports-score-tile-d { border-left-color: #ff9f0a; }

.sports-score-tile-detail {
  flex: 1 1 100%;
  max-width: none;
}

.sports-score-tile-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.sports-score-tile-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.sports-score-tile-emoji {
  font-size: 1.4rem;
  line-height: 1;
  width: 28px;
  text-align: center;
}
.sports-score-tile-name {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
}
.sports-score-tile-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
}
.sports-score-tile-result-w { background: #34c759; }
.sports-score-tile-result-l { background: #ff3b30; }
.sports-score-tile-result-d { background: #ff9500; }
html.dark .sports-score-tile-result-w { background: #30d158; }
html.dark .sports-score-tile-result-l { background: #ff453a; }
html.dark .sports-score-tile-result-d { background: #ff9f0a; }

.sports-score-tile-score {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0.25rem 0;
  letter-spacing: 0.02em;
}
.sports-score-tile-sep { color: #c7c7cc; margin: 0 0.4rem; }
html.dark .sports-score-tile-sep { color: #48484a; }

.sports-score-tile-opponent {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  margin: 0.25rem 0;
}
.sports-score-tile-logo-sm {
  width: 18px; height: 18px; object-fit: contain;
}
.sports-score-tile-vs {
  color: #6e6e73;
  font-size: 0.82rem;
  margin-right: 0.1rem;
}
html.dark .sports-score-tile-vs { color: #98989d; }

.sports-score-tile-meta {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: #6e6e73;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sports-score-tile-meta-sep { color: #c7c7cc; }
html.dark .sports-score-tile-meta { color: #98989d; }
html.dark .sports-score-tile-meta-sep { color: #48484a; }

/* ---- Standings (Phase S8) ----------------------------------------
   Compact table per conference/division. Followed team rows highlight
   with a tinted background so the user can scan to "where do my
   teams sit". */
.sports-standings-heading { margin: 0 0 0.5rem 0; font-size: 1.05rem; }
.sports-standings-table { font-size: 0.92rem; }
.sports-standings-table .sports-standings-pos { width: 2.5rem; text-align: center; color: #6e6e73; }
.sports-standings-team-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #1d1d1f;
  text-decoration: none;
  font-weight: 500;
}
.sports-standings-team-link:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-standings-team-link { color: #f5f5f7; }
html.dark .sports-standings-team-link:hover { color: #0a84ff; }
.sports-standings-team-logo {
  width: 22px; height: 22px; object-fit: contain;
}
.sports-standings-followed { background: rgba(0, 113, 227, 0.06); }
html.dark .sports-standings-followed { background: rgba(10, 132, 255, 0.10); }
.sports-standings-followed .sports-standings-team-link { font-weight: 600; }
.sports-standings-follow-mark { color: #ffcc00; margin-left: 0.25rem; }

/* The header subtitle on /sports/team/:slug now carries the
   league-position line. Slightly tighter than the regular subtitle
   so the page doesn't grow taller for the same amount of context. */
.sports-team-standing { margin-top: 0.25rem; font-size: 0.92rem; }
.sports-team-standing strong { color: #1d1d1f; }
html.dark .sports-team-standing strong { color: #f5f5f7; }

/* ---- Calendar (Phase S9) ----------------------------------------
   Day-grouped list of upcoming fixtures. Each fixture: time on the
   left, matchup in the middle, league + venue at the bottom. iCal
   subscribe URL in a callout block at the top. */
.sports-calendar-subscribe {
  border-left: 3px solid #0071e3;
  background: rgba(0, 113, 227, 0.04);
  padding: 0.85rem 1rem;
  border-radius: 6px;
}
html.dark .sports-calendar-subscribe { background: rgba(10, 132, 255, 0.08); border-left-color: #0a84ff; }
.sports-calendar-ics-url {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  background: #f5f5f7;
  border-radius: 4px;
  font-size: 0.85rem;
  user-select: all;
}
html.dark .sports-calendar-ics-url { background: #2c2c2e; }

.sports-calendar-day-heading { margin: 0 0 0.5rem; font-size: 1.05rem; }
.sports-calendar-list { list-style: none; padding: 0; margin: 0; }
.sports-calendar-fixture {
  display: grid;
  grid-template-columns: 9rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e5e5ea;
}
.sports-calendar-fixture:last-child { border-bottom: none; }
html.dark .sports-calendar-fixture { border-color: #3a3a3c; }
.sports-calendar-time {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1d1d1f;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
html.dark .sports-calendar-time { color: #f5f5f7; }
.sports-calendar-matchup {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}
.sports-calendar-team {
  color: #1d1d1f;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.sports-calendar-team:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-calendar-team { color: #f5f5f7; }
html.dark .sports-calendar-team:hover { color: #0a84ff; }
.sports-calendar-vs { font-size: 0.85rem; }
.sports-calendar-meta {
  grid-column: 2;
  font-size: 0.85rem;
  color: #6e6e73;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.sports-calendar-meta-sep { color: #c7c7cc; }
.sports-calendar-league {
  color: #6e6e73;
  text-decoration: none;
  font-weight: 500;
}
.sports-calendar-league:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-calendar-meta { color: #98989d; }
html.dark .sports-calendar-meta-sep { color: #48484a; }
html.dark .sports-calendar-league { color: #98989d; }

.sports-calendar-live {
  background: #ff3b30;
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
html.dark .sports-calendar-live { background: #ff453a; }

/* ---- Tennis rankings (Phase S7) ----------------------------------
   Two side-by-side tables (ATP + WTA), each top-N players. Player
   row links to /sports/player/:slug. Detail page reuses the
   existing stat-cards grid. */
.sports-tennis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.5rem;
}
.sports-tennis-tour { margin: 0; }
.sports-tennis-heading { margin: 0 0 0.5rem; font-size: 1.05rem; }
.sports-tennis-table { font-size: 0.9rem; }
.sports-tennis-rank { width: 2.5rem; text-align: center; color: #6e6e73; font-weight: 600; }
.sports-tennis-photo { width: 36px; padding: 0.25rem; }
.sports-tennis-photo img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #f0f0f5;
}
html.dark .sports-tennis-photo img { background: #2c2c2e; }
.sports-tennis-name {
  color: #1d1d1f; text-decoration: none; font-weight: 500;
}
.sports-tennis-name:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-tennis-name { color: #f5f5f7; }
html.dark .sports-tennis-name:hover { color: #0a84ff; }
.sports-tennis-country {
  display: flex; align-items: center; gap: 0.4rem;
}
.sports-tennis-flag {
  width: 22px; height: 14px; object-fit: contain;
  border: 1px solid #e5e5ea; border-radius: 2px;
}
html.dark .sports-tennis-flag { border-color: #3a3a3c; }

/* Player detail page */
.sports-player-header h2 {
  display: flex; align-items: center; gap: 0.75rem;
}
.sports-player-headshot {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #f0f0f5;
}
html.dark .sports-player-headshot { background: #2c2c2e; }
.sports-player-stats { margin-top: 0.5rem; }
.sports-player-about { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
.sports-player-about dt { font-weight: 600; color: #515154; }
.sports-player-about dd { margin: 0; }
html.dark .sports-player-about dt { color: #aeaeb2; }

/* Tennis follows (S7 follow-up) — star toggle in the rankings
   table + a "My followed players" callout above the rankings. */
.sports-tennis-follow-cell { width: 2.5rem; text-align: center; }
.sports-tennis-follow-btn {
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: #c7c7cc;
  transition: color 0.12s, background 0.12s;
}
.sports-tennis-follow-btn:hover { background: #f5f5f7; color: #ffcc00; }
.sports-tennis-follow-btn.is-followed { color: #ffcc00; }
html.dark .sports-tennis-follow-btn { color: #48484a; }
html.dark .sports-tennis-follow-btn:hover { background: #2c2c2e; color: #ffcc00; }
html.dark .sports-tennis-follow-btn.is-followed { color: #ffcc00; }

.sports-tennis-followed {
  border-left: 3px solid #ffcc00;
  background: rgba(255, 204, 0, 0.05);
  padding: 0.85rem 1rem;
  border-radius: 6px;
}
html.dark .sports-tennis-followed { background: rgba(255, 204, 0, 0.08); }
.sports-tennis-followed-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.sports-tennis-followed-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #e5e5ea;
}
.sports-tennis-followed-row:last-child { border-bottom: none; }
html.dark .sports-tennis-followed-row { border-color: #3a3a3c; }
.sports-tennis-followed-photo {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #f0f0f5;
}
html.dark .sports-tennis-followed-photo { background: #2c2c2e; }

.sports-toc-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}
.sports-toc-button:hover { background: #e8e8ed; border-color: #b6b6bb; }
html.dark .sports-toc-button { background: #2c2c2e; color: #f5f5f7; border-color: #3a3a3c; }
html.dark .sports-toc-button:hover { background: #3a3a3c; }

/* Subscribed-feed chips, one per team-level source within a sport.
   Smaller pills than the TOC buttons; click to filter /articles. */
.sports-feed-chip {
  display: inline-block;
  margin: 0 0.4rem 0.35rem 0;
  padding: 0.18rem 0.6rem;
  font-size: 0.82rem;
  border: 1px solid #d2d2d7;
  border-radius: 4px;
  background: #f5f5f7;
  color: #1d1d1f;
  text-decoration: none;
}
.sports-feed-chip:hover { background: #e8e8ed; }
html.dark .sports-feed-chip { background: #2c2c2e; color: #f5f5f7; border-color: #3a3a3c; }
html.dark .sports-feed-chip:hover { background: #3a3a3c; }

/* Article cards — full-width, vertical stack, columns lined up. */
.sports-article-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.sports-article {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e5e5ea;
}
.sports-article:last-child { border-bottom: none; }
html.dark .sports-article { border-color: #3a3a3c; }
.sports-article.read { opacity: 0.65; }

.sports-article-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}
.sports-article-title a {
  color: #1d1d1f;
  text-decoration: none;
}
.sports-article-title a:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-article-title a { color: #f5f5f7; }
html.dark .sports-article-title a:hover { color: #0a84ff; }

.sports-article-summary {
  margin: 0.25rem 0 0.4rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3a3a3c;
  /* 3-line clamp so a single very long article doesn't dominate
     the section. Same approach as skim-mode summaries. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.dark .sports-article-summary { color: #c0c0c5; }

.sports-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #6e6e73;
}
.sports-article-meta-sep { color: #c7c7cc; }
.sports-article-source {
  color: #6e6e73;
  text-decoration: none;
  font-weight: 500;
}
.sports-article-source:hover { color: #0071e3; text-decoration: underline; }
html.dark .sports-article-meta { color: #98989d; }
html.dark .sports-article-meta-sep { color: #48484a; }
html.dark .sports-article-source { color: #98989d; }

.sports-article-in-app {
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
}
.sports-article-in-app:hover { text-decoration: underline; }
html.dark .sports-article-in-app { color: #0a84ff; }

/* ---- Public home + about pages (STUFF.md #13) ----
   Marketing-style landing surfaces for new visitors. Hero on the left,
   screenshot on the right; below that a feature grid with alternating
   card layouts. Stays inside the existing typographic system so the
   page feels of-a-piece with the app rather than a separate brand. */
.home-hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2rem 0 2.5rem 0;
  margin-bottom: 1rem;
}
.home-hero-text h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
}
.home-tagline {
  font-size: 1.15rem;
  line-height: 1.55;
  color: #424245;
  margin: 0 0 1.5rem 0;
}
html.dark .home-tagline { color: #c7c7cc; }
.home-tagline strong { color: #1d1d1f; font-weight: 600; }
html.dark .home-tagline strong { color: #f5f5f7; }
.home-cta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.home-cta .btn-primary {
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
}
.home-cta-secondary {
  color: #0071e3;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
.home-cta-secondary:hover { text-decoration: underline; }
html.dark .home-cta-secondary { color: #0a84ff; }
.home-hero-meta {
  font-size: 0.82rem;
  color: #6e6e73;
  margin: 0;
}
html.dark .home-hero-meta { color: #aeaeb2; }
.home-hero-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  border: 1px solid #e5e5ea;
}
html.dark .home-hero-image img { border-color: #2c2c2e; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }

/* STUFF.md #14 — top-picks list under the personalized hero. */
.home-hero-picks {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0 0;
  border-top: 1px solid #e5e5ea;
  padding-top: 1rem;
}
html.dark .home-hero-picks { border-top-color: #2c2c2e; }
.home-hero-picks li { margin: 0.4rem 0; line-height: 1.4; }
.home-hero-picks a {
  color: #1d1d1f;
  text-decoration: none;
  font-weight: 500;
}
html.dark .home-hero-picks a { color: #f5f5f7; }
.home-hero-picks a:hover { color: #0071e3; }
html.dark .home-hero-picks a:hover { color: #0a84ff; }

/* Feature grid — alternating image/text layout. The first card has
   no image (just text) so it renders full-width as an intro. */
.home-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2.5rem 0;
}
.home-feature {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: center;
}
html.dark .home-feature { background: #1c1c1e; border-color: #2c2c2e; }
.home-feature-with-image {
  grid-template-columns: 1.1fr 1fr;
}
.home-feature-with-image:nth-child(odd) {
  grid-template-columns: 1fr 1.1fr;
}
.home-feature-with-image:nth-child(odd) .home-feature-image {
  order: -1;
}
.home-feature h2 {
  font-size: 1.4rem;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.01em;
}
.home-feature p {
  margin: 0;
  line-height: 1.55;
  color: #424245;
}
html.dark .home-feature p { color: #c7c7cc; }
.home-feature p code {
  font-size: 0.85em;
  background: #f2f2f7;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
html.dark .home-feature p code { background: #2c2c2e; }
.home-feature-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e5ea;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  display: block;
}
html.dark .home-feature-image img { border-color: #2c2c2e; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }

/* Middle "why" section — reduced visual weight so the screenshots
   above and the CTA below carry the page. */
.home-narrative {
  max-width: 680px;
  margin: 3rem auto;
  text-align: center;
}
.home-narrative h2 {
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}
.home-narrative p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #424245;
  margin: 0 0 1rem 0;
}
html.dark .home-narrative p { color: #c7c7cc; }

.home-final-cta {
  text-align: center;
  padding: 2.5rem 0;
  border-top: 1px solid #e5e5ea;
  margin-top: 1rem;
}
html.dark .home-final-cta { border-top-color: #2c2c2e; }
.home-final-cta h2 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
.home-final-cta p { color: #6e6e73; margin: 0 0 1.25rem 0; }
html.dark .home-final-cta p { color: #aeaeb2; }
.home-final-cta .home-cta { justify-content: center; }

/* About page — left-aligned narrative sections. */
.about-section {
  margin: 2rem 0;
  max-width: 760px;
}
.about-section h3 {
  font-size: 1.3rem;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.01em;
}
.about-section p, .about-section ul, .about-section ol {
  line-height: 1.6;
  color: #424245;
}
html.dark .about-section p, html.dark .about-section ul, html.dark .about-section ol { color: #c7c7cc; }
.about-section ul, .about-section ol { padding-left: 1.4rem; }
.about-section li { margin: 0.4rem 0; }

/* Mobile: stack hero + feature cards. */
@media (max-width: 800px) {
  .home-hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .home-hero-text h1 { font-size: 2rem; }
  .home-feature, .home-feature-with-image, .home-feature-with-image:nth-child(odd) {
    grid-template-columns: 1fr;
  }
  .home-feature-with-image:nth-child(odd) .home-feature-image { order: 0; }
}

/* STUFF #29 follow-up — /account page. Section blocks reuse the
   existing .benchmark-section shell; this block styles the bits that
   are new: the passkey table, the regenerated-codes card, and the
   typed-confirmation account-delete pattern. */
.account-section { margin-bottom: 1.5rem; }
.account-display-name-form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 480px; }
.account-display-name-form label { display: flex; flex-direction: column; gap: 0.3rem; }
.account-display-name-form input { padding: 0.5rem; border: 1px solid #d2d2d7; border-radius: 6px; max-width: 360px; }
html.dark .account-display-name-form input { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }
.account-display-name-form .btn-primary { align-self: flex-start; }

.account-passkey-table { margin-top: 0.5rem; }
.account-passkey-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  display: inline-block;
  margin-right: 0.4rem;
}
.account-passkey-revoke-form { margin: 0; }
.account-add-passkey { margin-top: 1rem; }

.account-recovery-codes-card {
  background: #fff8e1;
  border: 1px solid #f0ce80;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}
.account-recovery-codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  padding: 0.75rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
  white-space: pre;
  user-select: all;
}
html.dark .account-recovery-codes-card { background: #3a2f10; border-color: #6b5a25; }
html.dark .account-recovery-codes { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }

.account-delete-section { border-left: 3px solid #ff3b30; padding-left: 1rem; }
.account-delete-details { margin-top: 0.5rem; }
.account-delete-summary {
  cursor: pointer;
  font-weight: 600;
  color: #ff3b30;
  padding: 0.4rem 0;
  user-select: none;
}
.account-delete-form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 480px; margin-top: 1rem; }
.account-delete-form label { display: flex; flex-direction: column; gap: 0.3rem; }
.account-delete-form input { padding: 0.5rem; border: 1px solid #d2d2d7; border-radius: 6px; max-width: 360px; }
html.dark .account-delete-form input { background: #1c1c1e; color: #f5f5f7; border-color: #3a3a3c; }
.account-delete-btn { align-self: flex-start; }

/* First-time-user onboarding (/welcome). 4 topic chips as labeled
   checkbox cards; checked state highlights with a tinted background.
   Reuses .btn-primary for the submit button. */
.welcome-hero {
  text-align: center;
  margin: 2rem auto 2.5rem;
  max-width: 720px;
}
.welcome-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: #1d1d1f;
}
html.dark .welcome-hero h1 { color: #f5f5f7; }
.welcome-hero .subtitle { font-size: 1.05rem; line-height: 1.5; }

.welcome-form {
  max-width: 880px;
  margin: 0 auto;
}
.welcome-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.welcome-chip {
  display: block;
  border: 2px solid #d2d2d7;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  background: #fff;
  transition: border-color 120ms ease, background 120ms ease;
  position: relative;
}
.welcome-chip:hover { border-color: #007aff; }
.welcome-chip input[type="checkbox"] {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 18px;
  height: 18px;
  accent-color: #007aff;
  cursor: pointer;
}
.welcome-chip:has(input:checked) {
  border-color: #007aff;
  background: #e6f1ff;
}
html.dark .welcome-chip { background: #1c1c1e; border-color: #3a3a3c; }
html.dark .welcome-chip:hover { border-color: #4dabff; }
html.dark .welcome-chip:has(input:checked) { background: #102a44; border-color: #4dabff; }

.welcome-chip-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-right: 1.6rem; /* room for the absolute-positioned checkbox */
}
.welcome-chip-emoji { font-size: 1.8rem; }
.welcome-chip-label { font-weight: 600; font-size: 1.05rem; color: #1d1d1f; }
html.dark .welcome-chip-label { color: #f5f5f7; }
.welcome-chip-blurb { font-size: 0.88rem; color: #3a3a3c; }
html.dark .welcome-chip-blurb { color: #c7c7cc; }
.welcome-chip-count { font-size: 0.78rem; }

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.welcome-submit { padding: 0.7rem 1.4rem; font-size: 1rem; }
.welcome-skip-link {
  color: #007aff;
  text-decoration: none;
  font-size: 0.9rem;
}
.welcome-skip-link:hover { text-decoration: underline; }
html.dark .welcome-skip-link { color: #4dabff; }

.welcome-fineprint { font-size: 0.85rem; }
