/* Inter + JetBrains Mono + Source Serif 4 (the textbook voice for headings). */
@import url("https://rsms.me/inter/inter.css");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,600&display=swap");

:root {
  --bg: #f7f8fa;                       /* clean paper */
  --grid-line: rgba(15, 23, 42, .05);  /* fine graph-paper hairline */
  --panel: #ffffff;
  --panel-2: #f4f6f9;
  --ink: #0b1220;          /* near-black slate */
  --ink-2: #334155;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #cbd5e1;
  /* One deep, restrained indigo — used sparingly, like an academic press. */
  --brand: #3730a3;
  --brand-2: #4338ca;      /* a near sibling for the rare gradient — no cyan */
  --brand-glow: rgba(55, 48, 163, .18);
  --brand-ink: #ffffff;
  /* Buttons are a single solid ink-indigo: crisp, not glowy. */
  --cta: #3730a3;
  --cta-h: #312a8a;
  --pos: #047857;
  --neg: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 1.5px rgba(15, 23, 42, .04), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-elev: 0 14px 36px -18px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .05);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Source Serif 4", "Iowan Old Style", Charter, Georgia, "Times New Roman", serif;
  --sans: "Inter var", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wide: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Always reserve the scrollbar gutter so switching filters (which changes page
   height) never nudges the centred layout sideways. */
html { scrollbar-gutter: stable; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--bg);
  /* Engineering-paper grid that slowly drifts — the most visible bit of motion,
     and pure CSS so it needs no extra element. */
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  animation: gridDrift 45s linear infinite;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.005em;
}
@keyframes gridDrift { from { background-position: 0 0; } to { background-position: 72px 72px; } }
@supports (font-variation-settings: normal) {
  body { font-family: "Inter var", var(--sans); }
}
/* Dynamic atmosphere: large, soft, drifting colour blobs on a dedicated fixed
   layer at z-index 0 — content is lifted to z-index 1 so it sits on top, and
   the blobs show in the margins, the header strip and through the frosted rail.
   (Negative z-index proved unreliable.) Animation runs regardless of the
   reduced-motion setting, by request. */
/* Background stays quiet on purpose: clean paper plus the fine graph-paper grid
   on <body>. The earlier drifting colour-blob layer was removed — too decorative
   for the audience. .bg-aurora is hidden but kept so the markup needn't change. */
.bg-aurora { display: none; }
.page, .footer { position: relative; z-index: 1; }
/* Topbar above page content so the avatar dropdown is never covered. */
.topbar { position: relative; z-index: 50; }
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }
code, .mono, .vote-score, .rail-count, .profile-count strong { font-family: var(--mono); font-feature-settings: "tnum"; }

/* Universal focus ring — subtle cyan glow that ties the whole site together */
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
  border-radius: 6px;
}

.container { max-width: var(--wide); margin: 0 auto; padding: 0 18px; }

/* Top bar */
.topbar {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar::after {
  content: ""; display: block; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand) 30%, var(--brand-2) 70%, transparent);
  opacity: .6;
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand {
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
  color: var(--ink); display: inline-flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  background: var(--brand);
  color: #fff; border-radius: 9px; width: 40px; height: 40px;
  display: inline-grid; place-items: center; font-style: italic;
  font-family: var(--serif); font-weight: 600; font-size: 1.4rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
  overflow: hidden;
}

/* --- Brand logo (otter mascot) ---------------------------------------------
   The topbar mark, the "by StatsOtter" summary badge and the cover-fallback
   each carry the mascot as an <img>. If that file 404s, the inline onerror
   adds `.no-logo` and the element's original glyph (kept in data-mark) is
   shown via ::before, so the chrome never breaks while the asset is missing. */
.brand-logo-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark.no-logo::before { content: attr(data-mark); }
.ai-summary-mark > img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%; }
.ai-summary-mark.no-logo::before { content: attr(data-mark); }
.pf-card-sigma > img { width: auto; height: 110px; max-width: 80%; object-fit: contain; display: block; }
.pf-card-sigma.no-logo::before { content: attr(data-mark); }
.footer-logo { height: 36px; width: auto; vertical-align: -11px; margin-right: 10px; }
.footer-build { margin: 6px 0 0; font-family: var(--mono, monospace); font-size: .68rem; opacity: .5; letter-spacing: .04em; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.auth-brand.no-logo { display: none; }
.auth-logo { width: clamp(150px, 48%, 200px); height: auto; display: block; }

.nav { display: flex; align-items: center; gap: 14px; }
.nav a { color: var(--ink); font-size: .94rem; }
.nav-right { margin-left: auto; }

/* Hover/focus dropdown anchored to the @username trigger */
.nav-menu { position: relative; }
.nav-menu-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  transition: background .12s;
}
.nav-menu-trigger:hover { background: #f3f4f6; text-decoration: none; }
.nav-menu-name { font-size: .9rem; }
.nav-menu-caret { font-size: .7rem; color: var(--muted); }
.nav-menu-panel {
  display: none; position: absolute; right: 0; top: 100%;
  min-width: 160px; padding: 6px 0; margin-top: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); z-index: 20;
}
/* Bridge the visual gap so hover doesn't drop when crossing it */
.nav-menu-panel::before {
  content: ""; position: absolute; left: 0; right: 0;
  top: -8px; height: 8px;
}
.nav-menu:hover .nav-menu-panel,
.nav-menu:focus-within .nav-menu-panel { display: block; }
.nav-menu-panel a,
.nav-menu-panel .linklike {
  display: block; padding: 7px 14px; font-size: .9rem;
  color: var(--ink); text-decoration: none; text-align: left; width: 100%;
}
.nav-menu-panel a:hover,
.nav-menu-panel .linklike:hover { background: #f3f4f6; text-decoration: none; }
.nav-menu-form { display: block; margin: 0; }

/* Buttons */
.btn {
  display: inline-block; padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); font-size: .88rem;
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .12s;
}
.btn:hover { text-decoration: none; border-color: var(--line-2); background: var(--panel-2); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, #3730a3 100%);
  border-color: #3730a3; color: var(--brand-ink); font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 8px 18px -10px rgba(67, 56, 202, .6);
}
.btn-primary:hover { background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%); transform: translateY(-1px); }
.btn-post {
  /* Ghost chip on the dark topbar: thin white outline, white text, soft
     translucent fill. Reads as "available action" without dominating the
     chrome the way the old solid ink-indigo block did. */
  background: rgba(255,255,255,.06);
  color: #fff;
  height: 30px; display: inline-flex; align-items: center; padding: 0 14px;
  border: 1px solid rgba(255,255,255,.38); border-radius: 999px;
  font-weight: 600; font-size: .85rem; letter-spacing: .01em;
  box-shadow: none;
  transition: background .14s ease, border-color .14s ease, transform .14s ease, color .14s ease;
}
.nav a.btn-post, .nav a.btn-post:visited { color: #fff; }
.btn-post:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.7);
  transform: translateY(-1px);
}
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.linklike { background: none; border: none; color: var(--ink); cursor: pointer; font-size: .94rem; padding: 0; white-space: nowrap; }
.linklike:hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 16px 0 0; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: .92rem; }
.msg-success { background: #ecfdf3; color: #027a48; }
.msg-error { background: #fef3f2; color: #b42318; }
.msg-info { background: #eff8ff; color: #175cd3; }

/* Hero */
.hero { padding: 22px 0 6px; position: relative; }
.hero h1 {
  margin: 0 0 10px; font-size: 1.9rem; letter-spacing: -.028em;
  font-weight: 700; line-height: 1.05; color: var(--ink);
  position: relative; display: inline-block;
}
.hero h1::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  height: 2px; width: 38px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.hero p { color: var(--muted); margin: 12px 0 0; max-width: 72ch; font-size: .95rem; }
.hero p a { color: var(--brand); font-weight: 500; }
.hero p a:hover { color: var(--brand-2); text-decoration: none; }
.hero-kicker {
  display: inline-block; font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .18em; color: var(--brand);
  margin: 0 0 8px; padding: 2px 8px;
  background: linear-gradient(90deg, rgba(67, 56, 202, .08), rgba(55, 48, 163, .08));
  border-radius: 4px;
}

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.searchbar { display: flex; gap: 8px; }
.searchbar input[type=search] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 220px; }
.sortlinks a { color: var(--muted); margin-left: 12px; font-size: .9rem; }
.sortlinks a.active { color: var(--ink); font-weight: 600; }

.tagbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-chip { font-size: .82rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel); }
.tag-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag-chip:hover { text-decoration: none; }

/* App shell with an optional floating left category rail */
.page { display: flex; align-items: flex-start; }
.main { flex: 1; min-width: 0; }

/* Railed layout: rail + content are grouped and centered together, and the
   rail floats next to the content as a card (instead of being jammed against
   the viewport edge with a big gap to centered content). */
.page.has-rail { max-width: var(--wide); margin: 0 auto; gap: 24px; padding: 16px 18px 0; }
.page.has-rail .main .container { max-width: none; margin: 0; padding: 0; }
.page.has-rail .hero { padding-top: 0; }

.leftrail {
  flex-shrink: 0; width: 244px;
  position: sticky; top: 74px;
  max-height: calc(100vh - 90px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px 10px;
}
.leftrail::before {
  content: ""; display: block; height: 2px;
  margin: -14px -10px 12px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 50%, transparent 100%);
  opacity: .8;
}
.rail-heading {
  color: var(--muted); font-family: var(--mono); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; margin: 2px 10px 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.rail-links { display: flex; flex-direction: column; gap: 1px; counter-reset: rail; }
.rail-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 12px; border-radius: 6px;
  color: var(--ink-2); font-size: .88rem;
  transition: background .12s ease, color .12s ease;
}
.rail-link:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.rail-link.active {
  background: linear-gradient(90deg, rgba(67, 56, 202, .08), rgba(67, 56, 202, 0));
  color: var(--brand); font-weight: 600;
}
.rail-link.active::after {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; border-radius: 0 2px 2px 0; background: var(--brand);
}
.rail-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-count {
  font-family: var(--mono); font-feature-settings: "tnum"; font-size: .72rem;
  color: var(--muted); flex-shrink: 0;
  padding: 1px 6px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.rail-link:hover .rail-count { color: var(--ink); }
.rail-link.active .rail-count { color: var(--brand); background: rgba(67, 56, 202, .08); border-color: rgba(67, 56, 202, .25); }

/* Colored dot for tag/stage rows — slim square accent on the left edge */
.rail-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--line-2); }
.rail-family .rail-dot { width: 6px; height: 18px; border-radius: 2px; }
/* Stages (workflows) */
.rail-stage-diagnostic .rail-dot { background: #94a3b8; }
.rail-stage-prep .rail-dot { background: #6366f1; }
.rail-stage-estimation .rail-dot { background: var(--brand); }
.rail-stage-inference .rail-dot { background: var(--pos); }
.rail-stage-robustness .rail-dot { background: var(--neg); }
.rail-stage-heterogeneity .rail-dot { background: #94a3b8; }
.rail-stage-reporting .rail-dot { background: #94a3b8; }
.rail-stage-other .rail-dot { background: #9ca3af; }
/* Method tag dots — slug-keyed; an unknown tag falls back to the neutral default. */
.rail-tag-did .rail-dot { background: #3b82f6; }
.rail-tag-doubly-robust .rail-dot { background: #ec4899; }
.rail-tag-event-study .rail-dot { background: #8b5cf6; }
.rail-tag-matrix-completion .rail-dot { background: #10b981; }
.rail-tag-panel-iv .rail-dot { background: #f97316; }
.rail-tag-synthetic-control .rail-dot { background: #94a3b8; }

/* Identification-strategy families on the methods rail */
.rail-blurb { color: var(--muted); font-size: .78rem; line-height: 1.45; margin: 0 8px 12px; }
.rail-blurb em { color: var(--ink); font-style: italic; }
.rail-subheading { color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin: 18px 8px 6px; }
.rail-links-sub { gap: 1px; }
.rail-links-sub .rail-link { padding: 5px 10px; font-size: .85rem; color: #475467; }
.rail-link.is-empty { opacity: .55; }
.rail-link.is-empty:hover { opacity: 1; }
.rail-family .rail-dot { background: var(--brand); }
.rail-family-rct .rail-dot { background: #94a3b8; }
.rail-family-unconfoundedness .rail-dot { background: #6366f1; }
.rail-family-did .rail-dot { background: #3b82f6; }
.rail-family-iv .rail-dot { background: #f97316; }
.rail-family-rd .rail-dot { background: #94a3b8; }
.rail-family-synth .rail-dot { background: #94a3b8; }
.rail-family-hte .rail-dot { background: #8b5cf6; }
.rail-family-sensitivity .rail-dot { background: #ec4899; }
.rail-family-mediation .rail-dot { background: #94a3b8; }
.rail-family-survival .rail-dot { background: var(--neg); }
/* Secondary-page rails (workflow list, legacy method list) stay monochrome too —
   one quiet slate marker, organised by label rather than colour. */
[class*="rail-stage-"] .rail-dot,
[class*="rail-tag-"] .rail-dot,
[class*="rail-family-"] .rail-dot { background: #94a3b8; }
.rail-all-tags { margin: 14px 8px 0; }
.rail-all-tags > summary {
  list-style: none; cursor: pointer; font-size: .75rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
  padding: 4px 0; display: inline-flex; align-items: center; gap: 4px;
}
.rail-all-tags > summary::-webkit-details-marker { display: none; }
.rail-all-tags > summary::before { content: "▸"; font-size: .65rem; transition: transform .15s; }
.rail-all-tags[open] > summary::before { transform: rotate(90deg); }
.rail-all-tags > summary:hover { color: var(--brand); }
.rail-all-tags .rail-links-sub { margin-top: 6px; }

@media (max-width: 820px) {
  .page.has-rail { flex-direction: column; gap: 12px; padding: 14px 18px 0; }
  .leftrail {
    position: static; width: auto; max-height: none;
    box-shadow: none; padding: 10px 12px; border-radius: 12px;
  }
  .rail-links { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .rail-heading { width: 100%; margin: 0 0 6px; }
  .rail-link { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; }
  .rail-count { display: none; }
}

/* Cards */
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px; display: flex; gap: 16px;
  transition: border-color .15s ease, box-shadow .2s ease, transform .15s ease;
}
.card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-elev), 0 0 0 1px rgba(67, 56, 202, .04);
}
.card-body { flex: 1; min-width: 0; }
.card-title {
  margin: 0 0 6px; font-size: 1.08rem; font-weight: 600;
  letter-spacing: -.01em; line-height: 1.3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-title a { color: var(--ink); display: inline; }
.card-title a:hover { color: var(--brand); text-decoration: none; }
.title-pkg-pill {
  display: inline-block; font-family: var(--mono);
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  padding: 1px 7px; border-radius: 4px; vertical-align: 2px;
  margin-right: 8px;
  background: linear-gradient(180deg, #0f172a, #1e293b); color: #c7d2fe;
  border: 1px solid #1e293b;
  text-transform: uppercase;
}
.title-rest { color: inherit; }
.detail-head h1 .title-pkg-pill { vertical-align: 4px; font-size: .72rem; }
.card-summary { margin: 0 0 10px; color: var(--ink-2); font-size: .92rem; line-height: 1.5; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.card-meta { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta a { color: var(--ink-2); font-weight: 500; }
.card-meta a:hover { color: var(--brand); text-decoration: none; }
.card-meta code { font-size: .78rem; padding: 1px 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; color: var(--brand); }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Badges */
.badge {
  font-size: .72rem; padding: 2px 9px; border-radius: 6px;
  background: var(--panel); color: var(--ink-2);
  border: 1px solid var(--line); font-weight: 500;
}
a.badge:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.badge-estimand {
  font-family: var(--mono); font-feature-settings: "tnum";
  letter-spacing: .04em; font-weight: 700; font-size: .68rem;
  background: linear-gradient(180deg, #eef2ff, #e0e7ff);
  color: var(--brand); border-color: #c7d2fe;
  text-transform: uppercase; padding: 2px 7px;
}
.badge-public { background: #ecfdf3; color: #027a48; border-color: #abefc6; }
.badge-private { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.badge-hidden { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge-draft, .badge-pending { background: #fffaeb; color: #b54708; }
.badge-rejected { background: #fef3f2; color: #b42318; }

/* Key/value table (dataset metadata) */
.kv { border-collapse: collapse; margin: 12px 0; }
.kv th { text-align: left; color: var(--muted); font-weight: 600; padding: 5px 16px 5px 0; vertical-align: top; font-size: .9rem; white-space: nowrap; }
.kv td { padding: 5px 0; font-size: .92rem; }

/* Vote box */
/* Star widget: a hollow indigo star that fills in when you star the item —
   matching the site palette, no hint of a hidden downvote. */
.votebox {
  flex: none; width: 44px;
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 6px 5px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); align-self: flex-start;
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.votebox.is-lit {
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.detail-head .votebox { padding: 5px 7px 6px; }
.vote-star {
  display: inline-grid; place-items: center;
  background: none; border: none; cursor: pointer;
  width: 26px; height: 26px; padding: 0;
  color: var(--line-2);        /* unlit: pale slate outline */
  transition: color .18s ease, transform .12s ease, filter .18s ease;
}
.vote-star svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.vote-star:hover { color: var(--brand); text-decoration: none; }
.vote-star.active-up { color: var(--brand); filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--brand) 40%, transparent)); }
.vote-star.active-up svg { fill: currentColor; }
/* Satisfying pop when clicked (AJAX path). */
.vote-star.vote-pulse { animation: vote-pop .36s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes vote-pop {
  0%   { transform: scale(1) rotate(0); }
  40%  { transform: scale(1.4) rotate(-8deg); }
  70%  { transform: scale(.95) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .vote-star.vote-pulse { animation: none; } }
.vote-score { transition: color .15s ease; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; color: var(--muted); padding: 0; line-height: 1.1; }
.vote-score.pos { color: var(--brand); }

/* Detail */
.detail {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-top: 18px;
  position: relative; overflow: hidden;
}
.detail::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 50%, transparent 100%);
  opacity: .85;
}
.detail-head { display: flex; gap: 18px; align-items: flex-start; }
/* Only the main column flexes — NOT the votebox, which is a fixed-size div. */
.detail-head > div:not(.votebox) { min-width: 0; flex: 1; }
.detail-head h1 { font-family: var(--serif); margin: 0 0 10px; font-size: 1.7rem; line-height: 1.18; letter-spacing: -.005em; }
/* Major page headings share the serif voice — the textbook register. */
.hero h1, .hero-workflows h1, .formwrap-head h1, .compose-head h1,
.profile-head h1, .guide-hero h1 { font-family: var(--serif); letter-spacing: -.005em; }
.detail-head .byline { margin-bottom: 10px; font-size: .9rem; }
.detail-head .card-tags { margin-bottom: 0; gap: 8px; }
.lead { font-size: 1.05rem; color: #374151; }
/* "Summary · by StatsOtter" — a labelled plain-English digest of the workflow.
   Lives between SOURCE and the long description; quietly indigo-tinted so it
   reads as a curated synopsis, not editorial body copy. */
.ai-summary {
  position: relative; margin: 18px 0 22px;
  padding: 14px 18px 14px 18px; border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 4%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--line));
}
.ai-summary-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.ai-summary-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 1.2rem; line-height: 1;
}
.ai-summary-kicker {
  font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--brand);
}
.ai-summary-by { color: var(--muted); }
.ai-summary-body {
  margin: 0; font-family: var(--serif); font-size: 1.02rem; line-height: 1.55;
  color: var(--ink); font-feature-settings: "kern", "liga";
  min-height: 1.55em;
}
/* Hide the server-rendered text until the reveal JS runs, otherwise the full
   paragraph flashes for one frame before the animation starts. JS adds
   .sd-reveal (word cascade) or .sd-reveal-block (math: whole-block fade),
   which makes it visible. */
[data-typewriter] { visibility: hidden; }
[data-typewriter].sd-reveal,
[data-typewriter].sd-reveal-block { visibility: visible; }
/* Word-cascade reveal: each word fades up + de-blurs; JS staggers the
   animation-delay so they arrive in a fast wave (~20ms apart). */
.sd-reveal-w {
  display: inline-block; opacity: 0;
  animation: sdWordIn .5s cubic-bezier(.2, .7, .2, 1) both;
  will-change: opacity, transform, filter;
}
@keyframes sdWordIn {
  from { opacity: 0; transform: translateY(.5em) scale(.985); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
/* Math summaries can't be split into word spans (KaTeX) — fade the whole block. */
.sd-reveal-block { animation: sdBlockIn .55s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes sdBlockIn {
  from { opacity: 0; transform: translateY(.4em); filter: blur(5px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sd-reveal-w, .sd-reveal-block {
    animation: none !important; opacity: 1 !important;
    filter: none !important; transform: none !important;
  }
}

/* Styled hover/focus tooltip (JS appends to <body>; positioned in JS).
   Body-level so it isn't clipped by cards' overflow:hidden. */
.sd-tip {
  position: fixed; z-index: 300; max-width: 260px;
  padding: 7px 10px; border-radius: 8px;
  background: #0b1424; color: #fff;
  font-family: var(--sans); font-size: .76rem; line-height: 1.4; font-weight: 500;
  letter-spacing: 0; text-transform: none;
  box-shadow: 0 10px 30px -8px rgba(11,20,36,.5), 0 2px 6px rgba(11,20,36,.25);
  pointer-events: none; opacity: 0; transform: translateY(3px);
  transition: opacity .12s ease, transform .12s ease;
}
.sd-tip.is-on { opacity: 1; transform: none; }
/* Hint that tooltip'd badges are interactive. */
[data-tip] { cursor: help; }

/* Full-screen image lightbox (JS-created). */
.sd-lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 4vmin;
  background: rgba(8,12,24,.86); cursor: zoom-out;
  opacity: 0; transition: opacity .2s ease;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.sd-lightbox.is-open { opacity: 1; }
.sd-lightbox img {
  max-width: 96vw; max-height: 92vh; border-radius: 8px; background: #fff;
  box-shadow: 0 24px 70px -10px rgba(0,0,0,.6);
  transform: scale(.97); transition: transform .2s ease;
}
.sd-lightbox.is-open img { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .sd-tip, .sd-lightbox, .sd-lightbox img { transition: none; }
}
.links { display: flex; gap: 10px; margin: 12px 0; }
.muted { color: var(--muted); }
.eval-status { font-size: .9rem; padding: 10px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); margin: 12px 0; color: var(--muted); }
.eval-scored, .eval-published { background: #ecfdf3; color: #027a48; border-color: #abefc6; }
.eval-rejected { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.eval-draft, .eval-pending { background: #fffaeb; color: #b54708; border-color: #fedf89; }

/* Prose (rendered markdown) */
.prose { overflow-wrap: anywhere; max-width: 78ch; }
.prose h1, .prose h2, .prose h3 { margin: 1em 0 .4em; }
.prose p { margin: .6em 0; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.prose code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; }
.prose blockquote {
  border-left: 2px solid var(--line-2); margin: 8px 0; padding: 6px 0 6px 12px;
  color: var(--muted); font-size: .82rem; line-height: 1.5;
  background: var(--panel-2); border-radius: 0 4px 4px 0;
}
.prose blockquote p { margin: 0; }

/* Datasets used / methods using (cross-links) */
.datasets-used { margin-top: 24px; }
.datasets-used h2 { font-size: 1.2rem; margin-bottom: 10px; }

/* Method list page — single-block cards, emerald accent (distinct from workflow indigo) */
.method-card { border-left: 2px solid var(--pos); }
.method-card:hover { border-left-color: var(--pos); box-shadow: var(--shadow-elev), inset 2px 0 0 var(--pos); }
.method-badge { display: inline-block; background: #ecfdf3; color: #027a48; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; margin-right: 8px; vertical-align: middle; }

/* Workflow list page — pipeline-style cards (distinct from method cards) */
.hero-workflows h1 { display: inline-block; }
.hero-workflows .hero-sub { color: var(--muted); font-weight: 400; font-size: 1.1rem; }
.workflow-card { border-left: 2px solid var(--brand); }
.workflow-card:hover { border-left-color: var(--brand); box-shadow: var(--shadow-elev), inset 2px 0 0 var(--brand); }
.workflow-badge { display: inline-block; background: #eef2ff; color: var(--brand); padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; margin-right: 8px; vertical-align: middle; }
.pipeline-preview {
  list-style: none; padding: 10px 0 6px; margin: 4px 0 8px;
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
}
.pipeline-preview .pipe-step {
  position: relative;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px 6px 12px; margin-right: 22px; margin-bottom: 6px;
  display: flex; flex-direction: column; min-width: 0; max-width: 220px;
}
.pipeline-preview .pipe-step::after {
  content: "→"; position: absolute; right: -18px; top: 50%; transform: translateY(-50%);
  color: var(--brand); font-weight: 700; font-size: .95rem;
}
.pipeline-preview .pipe-step:last-child { margin-right: 0; }
.pipeline-preview .pipe-step:last-child::after { content: ""; }
.pipe-stage { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pipe-label { font-size: .85rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-more { align-self: center; color: var(--muted); font-size: .8rem; padding: 0 4px; }

/* Layered DAG on workflow cards — vertical stack of layers, each layer is one
   or more step pills side-by-side (parallel branches). Arrows between layers
   show flow direction. Compact enough to fit inside list/profile cards. */
.vdag { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin: 14px 0 14px; position: relative; }
.vdag-layer { display: flex; gap: 10px; justify-content: center; align-items: stretch; flex-wrap: wrap; padding: 3px 0; }
.vdag-arrow {
  text-align: center; color: rgba(99, 102, 241, .35); font-size: .7rem;
  line-height: 1.4; font-family: var(--mono); letter-spacing: 0;
  position: relative;
}
.vdag-arrow::before {
  /* a 1 px gradient connector line through the arrow glyph */
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(99, 102, 241, .35), rgba(55, 48, 163, .25));
  z-index: -1;
}
.vdag-step {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 8px;
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(248, 250, 252, .9) 100%);
  min-width: 0; max-width: 360px; flex: 0 1 auto;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .8) inset,
    0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
a.vdag-step:hover {
  border-color: rgba(99, 102, 241, .35);
  text-decoration: none; transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .8) inset,
    0 8px 20px -10px rgba(67, 56, 202, .25);
}
.vdag-step .vpipe-text { flex: 1; min-width: 0; }
.vdag-step .vpipe-label { font-weight: 500; color: var(--ink); }
/* Branched layer: tinted panel that visually groups the parallel siblings */
.vdag-branch {
  background:
    radial-gradient(ellipse at center, rgba(99, 102, 241, .065) 0%, rgba(55, 48, 163, .03) 60%, transparent 100%),
    linear-gradient(180deg, rgba(99, 102, 241, .04), rgba(55, 48, 163, .03));
  border-radius: 10px;
  padding: 8px;
  border: 1px dashed rgba(99, 102, 241, .22);
  position: relative;
}
.vdag-branch::before {
  /* Soft outer glow to suggest "this is a parallel block, not just a row" */
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 24px -8px rgba(99, 102, 241, .18) inset;
}
.vdag-branch .vdag-step { flex: 1 1 0; min-width: 140px; }

/* Shared pieces still used by the new DAG step partial */
.vpipe-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--line);
  box-shadow:
    0 0 0 2px var(--panel),
    0 0 0 3px rgba(99, 102, 241, .15),
    0 0 10px currentColor;
  position: relative;
}
.vpipe-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.vpipe-stage {
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.vpipe-label { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }

.vpipe-diagnostic .vpipe-dot { background: #94a3b8; color: #94a3b8; }
.vpipe-prep .vpipe-dot { background: #6366f1; color: #6366f1; }
.vpipe-estimation .vpipe-dot { background: var(--brand); color: var(--brand); }
.vpipe-inference .vpipe-dot { background: var(--pos); color: var(--pos); }
.vpipe-robustness .vpipe-dot { background: var(--neg); color: var(--neg); }
.vpipe-heterogeneity .vpipe-dot { background: #94a3b8; color: #94a3b8; }
.vpipe-reporting .vpipe-dot { background: #94a3b8; color: #94a3b8; }
.vpipe-other .vpipe-dot { background: #9ca3af; color: #9ca3af; }

/* Profile sections — 2×2 grid of blocks (own / saved × methods / workflows) */
.profile-group-heading { font-size: 1.15rem; margin: 26px 0 4px; letter-spacing: -.01em; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 12px; }
.profile-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.profile-block .cards { gap: 10px; }
.profile-block .card { padding: 10px 12px; }
.profile-block .card-title { font-size: 1rem; }
.profile-section-title { font-size: 1.05rem; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.profile-section-title .muted { font-weight: 400; font-size: .85rem; }
@media (max-width: 820px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* Workflow detail — layered DAG. Each layer is a horizontal row of step cards
   (parallel steps render side-by-side); a vertical connector between layers
   makes the top-down flow clear, while the "↳ from #N" tags on each card
   spell out the exact DAG edges. */
.workflow-dag { display: flex; flex-direction: column; gap: 28px; margin-top: 10px; }
.dag-layer { display: flex; gap: 14px; justify-content: center; align-items: stretch; flex-wrap: wrap; position: relative; }
.dag-layer:not(:last-child)::after {
  content: ""; position: absolute; left: 50%; bottom: -22px;
  width: 2px; height: 16px; background: var(--brand);
}
.dag-layer:not(:last-child)::before {
  content: "▼"; position: absolute; left: 50%; bottom: -10px;
  transform: translate(-50%, 0); color: var(--brand); font-size: .7rem;
}
.dag-layer-parallel { padding: 6px 0; }
.dag-step { flex: 0 1 280px; min-width: 220px; max-width: 340px; display: flex; }
.dag-step .dstep-link { flex: 1; margin: 0; }
.branch-flag { font-size: .72rem; background: #fdf4ff; color: #a21caf; padding: 2px 8px; border-radius: 999px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; margin-left: 8px; }

/* Workflow detail steps — same vertical timeline, with full bodies */
.dstep-list { margin-top: 6px; }
.dstep-row::before { left: 15px; top: 28px; bottom: -4px; }
.dstep-link { display: flex; align-items: flex-start; gap: 14px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); background: var(--panel); margin: 6px 0; }
a.dstep-link:hover { background: #f9fafb; border-color: #cbd0d6; }
.dstep-noop { cursor: default; }
.dstep-row .vpipe-dot { margin-top: 5px; }
.dstep-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dstep-head { display: flex; align-items: center; gap: 8px; }
.dstep-num { color: var(--muted); font-size: .78rem; font-weight: 700; }
.dstep-title { font-weight: 600; font-size: 1rem; color: var(--ink); }
a.dstep-link .dstep-title { color: var(--brand); }
.dstep-note { color: #374151; font-size: .9rem; }
.dstep-deps { color: var(--muted); font-size: .82rem; }
.dstep-dep { display: inline-block; background: #f1f2f4; color: #475467; padding: 1px 8px; border-radius: 6px; margin-left: 4px; font-size: .76rem; }

/* Stage accents — give each stage a tint so the pipeline reads at a glance. */
.pipe-diagnostic { background: #fffaeb; border-color: #fedf89; }
.pipe-prep { background: #f1f5ff; border-color: #c7d2fe; }
.pipe-estimation { background: #eef2ff; border-color: #c7d2fe; }
.pipe-inference { background: #ecfdf3; border-color: #abefc6; }
.pipe-robustness { background: #fef3f2; border-color: #fecdca; }
.pipe-heterogeneity { background: #fdf4ff; border-color: #f5d0fe; }
.pipe-reporting { background: #f0fdfa; border-color: #99f6e4; }
.pipe-other { background: #f4f4f5; border-color: var(--line); }

/* Workflow step list (detail page) */
.step-list { list-style: none; padding: 0; margin: 10px 0 18px; counter-reset: stepc; display: flex; flex-direction: column; gap: 10px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; counter-increment: stepc; position: relative; }
.step::before { content: counter(stepc); position: absolute; left: -12px; top: 12px; background: var(--brand); color: #fff; width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 700; display: grid; place-items: center; }
.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-title { font-weight: 600; }
.step-note { color: #374151; margin-top: 6px; font-size: .92rem; }
.step-deps { margin-top: 6px; font-size: .82rem; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* Workflow step formset — each row is a card with a left "order" rail, a
   structured body, and a small actions column. Replaces the cramped table. */
.steps-head { margin: 22px 0 10px; }
.steps-head h2 { margin: 0 0 4px; }
.steps-head p { margin: 0; font-size: .9rem; }
.step-formset { display: flex; flex-direction: column; gap: 14px; margin: 6px 0 8px; }
.step-formset-hint { font-size: .82rem; margin: 6px 0 0; }
.step-row {
  display: grid; grid-template-columns: 84px 1fr 84px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.step-row:hover { border-color: #c7d2fe; }
.step-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.step-row-rail {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-right: 1px solid var(--line);
  padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.step-rail-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.step-row-rail input[type=number] {
  width: 60px; padding: 6px 4px; text-align: center; font-weight: 700; font-size: 1.05rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink);
}
.step-row-rail input[type=number]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79,70,229,.12); }

.step-row-body { padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.step-row-body .field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.step-row-body label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.step-row-body input[type=text],
.step-row-body input[type=url],
.step-row-body input[type=number],
.step-row-body select,
.step-row-body textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .92rem; background: var(--panel); color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.step-row-body input:focus,
.step-row-body select:focus,
.step-row-body textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
.step-row-body textarea { min-height: 64px; resize: vertical; line-height: 1.45; }
.step-row-grid { display: grid; gap: 12px; }
.step-row-grid-top { grid-template-columns: 220px 1fr; }
.step-row-grid-ext { grid-template-columns: 1fr 2fr; margin-top: 8px; }

.step-external { background: #fafbfc; border: 1px dashed var(--line); border-radius: 8px; padding: 0 10px; }
.step-external > summary {
  list-style: none; cursor: pointer; padding: 8px 0;
  font-size: .82rem; color: var(--muted); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.step-external > summary::-webkit-details-marker { display: none; }
.step-external > summary::before { content: "▸"; font-size: .7rem; color: var(--muted); transition: transform .15s; }
.step-external[open] > summary::before { transform: rotate(90deg); }
.step-external > summary:hover { color: var(--brand); }
.step-external[open] { padding-bottom: 10px; }

.step-row-actions {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-left: 1px solid var(--line);
  padding: 16px 10px; display: flex; align-items: flex-start; justify-content: center;
}
.step-row-delete {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
}
.step-row-delete input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--neg); cursor: pointer; margin: 0;
}
.step-row-delete span {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.step-row-delete:hover span { color: var(--neg); }
/* When a row is marked for deletion, dim it visibly */
.step-row:has(.step-row-delete input:checked) { opacity: .55; }
.step-row:has(.step-row-delete input:checked) .step-row-body input,
.step-row:has(.step-row-delete input:checked) .step-row-body select,
.step-row:has(.step-row-delete input:checked) .step-row-body textarea { text-decoration: line-through; }

@media (max-width: 720px) {
  .step-row { grid-template-columns: 1fr; }
  .step-row-rail, .step-row-actions {
    border-right: none; border-left: none; border-bottom: 1px solid var(--line);
    flex-direction: row; justify-content: flex-start; gap: 12px;
  }
  .step-row-actions { border-bottom: none; border-top: 1px solid var(--line); justify-content: flex-end; }
  .step-row-grid-top { grid-template-columns: 1fr; }
  .step-row-grid-ext { grid-template-columns: 1fr; }
}

/* Avatar — circular initial OR uploaded image */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; color: #fff; font-weight: 700;
  text-transform: uppercase; line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  letter-spacing: 0; overflow: hidden;
}
.avatar-image { background: var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.byline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.byline .avatar { margin-right: 2px; }

/* Avatar editor — preview + file input side-by-side */
.avatar-edit { display: flex; gap: 18px; align-items: center; }
.avatar-edit-preview { flex: none; }
.avatar-edit-field { flex: 1; min-width: 0; }
.avatar-edit-field input[type=file] {
  display: block; padding: 14px 16px; border: 1.5px dashed var(--line-2);
  border-radius: 14px; background: var(--panel-2); font-size: .88rem; cursor: pointer;
  width: 100%; color: var(--muted); transition: border-color .15s, background .15s;
}
.avatar-edit-field input[type=file]::file-selector-button {
  margin-right: 14px; padding: 8px 14px; border: none;
  border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: .85rem; font-weight: 600; cursor: pointer;
}
.avatar-edit-field input[type=file]:hover { border-color: var(--brand); background: #f4f6f9; }

/* Comments + composer */
.comments { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.comments-h { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: -.005em; margin: 0 0 14px; }
.comments-login { padding: 14px 16px; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 16px; }
.comments-empty { color: var(--muted); padding: 18px 16px; background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; list-style: none; text-align: center; }

.comment-composer {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.comment-composer:focus-within { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 0 0 3px var(--brand-glow); }
.comment-composer-form { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.comment-composer-form textarea {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  font-family: inherit; font-size: .94rem; resize: vertical; min-height: 60px; line-height: 1.5;
  background: var(--panel-2); color: var(--ink); transition: background .14s, border-color .14s;
}
.comment-composer-form textarea:focus { outline: none; background: var(--panel); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.comment-composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.comment-composer-actions .muted { font-size: .78rem; }
.comment-composer-actions .btn-primary { padding: 6px 14px; font-size: .85rem; font-weight: 600; }
.comment-composer-reply { background: var(--panel-2); padding: 10px; }

/* Top-level comments sit on a quiet panel; replies are nested with a left
   "thread line" that ties them to their parent. */
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.comment { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.comment-meta a { color: var(--ink); font-weight: 600; }
.comment.reply {
  margin: 10px 0 0 24px; background: var(--panel-2); border-color: var(--line);
  position: relative; padding-left: 18px;
}
.comment.reply::before {
  content: ""; position: absolute; left: -16px; top: 18px; width: 14px; height: 1px;
  background: color-mix(in srgb, var(--brand) 30%, var(--line-2));
}
.reply-toggle { margin-top: 8px; }
.reply-toggle summary { cursor: pointer; color: var(--brand); font-size: .85rem; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.reply-toggle summary::-webkit-details-marker { display: none; }
.reply-toggle summary::before { content: "↳"; font-size: .85rem; }
.reply-toggle[open] summary { color: var(--muted); }

/* Forms */
.formwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px; margin-top: 18px; max-width: 760px; }
.formwrap.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.formwrap.formwrap-wide { max-width: 1000px; }
.formwrap-head { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.formwrap-head h1 { margin: 0 0 6px; font-size: 1.5rem; letter-spacing: -.01em; }
.formwrap-head p { margin: 0; font-size: .92rem; }

.stacked-form .field { margin-bottom: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stacked-form label, .stacked-form > label { font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.stacked-form input[type=text], .stacked-form input[type=email], .stacked-form input[type=password],
.stacked-form input[type=url], .stacked-form input[type=number], .stacked-form textarea, .stacked-form select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: .95rem; background: var(--panel-2); color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .05);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.stacked-form input::placeholder, .stacked-form textarea::placeholder { color: var(--muted); }
.stacked-form input:hover, .stacked-form textarea:hover, .stacked-form select:hover { border-color: var(--line-2); }
.stacked-form input:focus, .stacked-form textarea:focus, .stacked-form select:focus {
  outline: none; border-color: var(--brand); background: var(--panel);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04), 0 0 0 4px var(--brand-glow);
}
.stacked-form select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.stacked-form textarea { line-height: 1.55; min-height: 96px; resize: vertical; }
.help { color: var(--muted); font-size: .82rem; }
.snippet { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: .82rem; margin: 8px 0; white-space: pre; line-height: 1.5; }
.field-error { color: var(--neg); font-size: .85rem; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions-sticky {
  position: sticky; bottom: 0;
  margin: 24px -28px -24px; padding: 16px 28px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
}

/* Fancy multi-section form (method/workflow create) */
.fancy-form { display: flex; flex-direction: column; gap: 20px; }
.form-section {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 16px;
}
.form-section-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.form-grid { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-url-ref { grid-template-columns: 2fr 1fr; }
.help-block { margin: 0 0 6px; line-height: 1.5; }
.form-section-sub { font-weight: 500; color: var(--muted); font-size: .88rem; margin-left: 6px; }
@media (max-width: 720px) {
  .form-grid-2, .form-grid-url-ref { grid-template-columns: 1fr; }
}

/* Pinned repository banner on method detail */
.repo-pin {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 10px 0; padding: 8px 12px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap;
  font-size: .88rem;
}
.repo-pin-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.repo-pin-icon {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--brand), #3730a3); color: #fff;
  border-radius: 6px; font-size: .85rem; font-weight: 700; font-family: var(--mono);
}
.repo-pin-info > div { min-width: 0; }
.repo-pin-url {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; color: var(--ink); font-weight: 600;
}
.repo-pin-ref { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-size: .88rem; color: var(--muted); }
.repo-pin-ref code {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; color: var(--brand); font-size: .82rem;
}
.repo-pin-kind {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  background: var(--brand); color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 700;
}
.repo-pin-ref-empty { color: var(--neg); font-style: italic; }
.repo-pin-actions { display: flex; align-items: center; gap: 8px; }
.repo-pin-history { position: relative; }
.repo-pin-history > summary {
  list-style: none; cursor: pointer; padding: 6px 10px;
  font-size: .82rem; color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel);
}
.repo-pin-history > summary::-webkit-details-marker { display: none; }
.repo-pin-history > summary::before { content: "≡ "; }
.repo-pin-history > summary:hover { color: var(--brand); border-color: var(--brand); }
.repo-pin-history[open] > summary { background: var(--brand); color: #fff; border-color: var(--brand); }
.repo-pin-history > ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  list-style: none; padding: 6px; margin: 0; min-width: 280px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,.15);
}
.repo-pin-history > ul > li {
  padding: 8px 10px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.repo-pin-history > ul > li.is-current { background: #eef2ff; }
.repo-pin-history code {
  background: #f3f4f6; border-radius: 4px; padding: 1px 5px;
  font-size: .82rem; color: var(--brand); font-weight: 600;
}
.repo-pin-history .muted { font-size: .75rem; }

/* Topic tags as toggle pills (template iterates the field → labels are
   direct children, so this works regardless of Django's wrapper markup).
   The .stacked-form .field rule forces column layout, so we out-specify it. */
.stacked-form .pill-field { display: flex; flex-flow: row wrap; align-items: flex-start; gap: 8px; }
.pill-field ul { display: contents; }   /* flatten any <ul><li> wrapper into the row */
.pill-field li { margin: 0; }
.pill-field label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--panel);
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
  text-transform: none; letter-spacing: 0;
  transition: background .14s, border-color .14s, color .14s, transform .1s, box-shadow .14s;
}
.pill-field label:hover { border-color: #c7d2fe; background: #f4f6f9; color: var(--brand); transform: translateY(-1px); }
.pill-field input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill-field label:has(input:checked) {
  background: linear-gradient(135deg, var(--brand), #4f46e5); border-color: var(--brand); color: #fff;
  box-shadow: 0 5px 14px -6px var(--brand-glow);
}

/* ============================================================
   COMPOSE A WORKFLOW · the post form, rebuilt
   ============================================================ */
/* Drop the flat outer card — each section floats as its own raised card on
   the blueprint background. `display: contents` on the form lets the sections
   share ONE flex column with the header, so every vertical gap is identical. */
.compose.formwrap {
  display: flex; flex-direction: column; gap: 18px;
  background: transparent; border: none; box-shadow: none; padding: 0;
}
.compose .fancy-form { display: contents; }
.compose .form-section {
  margin: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 18px 34px -22px rgba(15,23,42,.26);
}
.compose .form-actions-sticky {
  position: sticky; bottom: 16px; z-index: 5;
  margin: 0; padding: 14px 18px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 36px -16px rgba(15,23,42,.32);
}
.compose-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin: 0; padding: 22px 26px;
  background:
    radial-gradient(75% 130% at 0% 0%, rgba(67, 56, 202, .12), transparent 60%),
    radial-gradient(65% 130% at 100% 0%, rgba(55, 48, 163, .12), transparent 55%),
    var(--panel);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 20px 38px -22px rgba(67, 56, 202, .34);
}
.opt { font-weight: 500; font-size: .82em; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 4px; }
.compose-kicker {
  display: inline-block; font-family: var(--mono); font-size: .66rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brand);
  background: rgba(67, 56, 202, .08); border: 1px solid rgba(67, 56, 202, .18);
  border-radius: 5px; padding: 2px 8px;
}
.compose-head h1 { margin: 9px 0 6px; font-size: 1.55rem; letter-spacing: -.02em; }
.compose-head p { margin: 0; color: var(--muted); font-size: .92rem; max-width: 66ch; line-height: 1.55; }
.compose-head p strong { color: var(--ink-2); font-weight: 600; }

/* Numbered, colour-coded section headers */
.form-section-title { display: flex; align-items: center; gap: 11px; }
.sec-ico {
  flex: none; width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-family: var(--mono); font-weight: 700; font-size: .84rem;
  box-shadow: 0 5px 12px -5px rgba(15, 23, 42, .4);
}
.sec-ico-1 { background: var(--ink); }
.sec-ico-2 { background: #475569; }
.sec-ico-3 { background: #94a3b8; }

/* Free-text tag input */
.tag-input-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 10px; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel-2);
  box-shadow: inset 0 1px 2px rgba(15,23,42,.05); transition: border-color .14s, box-shadow .14s, background .14s;
}
.tag-input-box:focus-within { border-color: var(--brand); background: var(--panel); box-shadow: 0 0 0 4px var(--brand-glow); }
.tag-chips { display: contents; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 5px 4px 11px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff;
  font-size: .8rem; font-weight: 600; box-shadow: 0 4px 10px -5px var(--brand-glow);
}
.tag-chip button {
  border: none; cursor: pointer; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,.25); color: #fff; font-size: .82rem; line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.tag-chip button:hover { background: rgba(255,255,255,.45); }
.tag-input-field {
  flex: 1 1 120px; min-width: 120px; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: .9rem; color: var(--ink); padding: 4px 2px;
}
.tag-input-field::placeholder { color: var(--muted); }
.tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 11px; }
.tag-suggest-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.tag-suggest-chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  padding: 4px 12px; border-radius: 999px; font-size: .8rem; cursor: pointer;
  font-family: inherit; transition: background .12s, border-color .12s, color .12s, transform .1s;
}
.tag-suggest-chip:hover { border-color: var(--brand); color: var(--brand); background: #f4f6f9; transform: translateY(-1px); }

/* Pipeline step cards */
.step-formset { display: flex; flex-direction: column; gap: 12px; }
.step-card {
  position: relative; display: grid; grid-template-columns: 54px 1fr;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 10px 22px -16px rgba(15,23,42,.22);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.step-card:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow), 0 14px 28px -18px rgba(15,23,42,.28); }
.step-card.is-removed { display: none; }
.step-del { display: none; }
.step-card-rail {
  display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 14px 0;
  background: var(--panel-2); border-right: 1px solid var(--line);
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: .82rem;
  box-shadow: 0 4px 10px -4px var(--brand-glow);
}
.step-remove {
  width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font-size: .82rem; line-height: 1;
  display: grid; place-items: center; transition: background .12s, color .12s;
}
.step-remove:hover { background: #fee2e2; color: var(--neg); }
.step-card-main { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.step-card-main .field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.step-card-main label { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Stage chosen as a colour chip (matches the pipeline diagram) */
.stage-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-chip {
  --sc: #94a3b8;
  display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--panel);
  font-size: .77rem; font-weight: 600; color: var(--ink-2);
  transition: background .13s, border-color .13s, color .13s, box-shadow .13s, transform .1s;
}
.stage-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stage-chip:hover { border-color: var(--sc); color: var(--sc); transform: translateY(-1px); }
.stage-chip:has(input:checked) {
  background: var(--sc); border-color: var(--sc); color: #fff;
  box-shadow: 0 4px 12px -5px color-mix(in srgb, var(--sc) 75%, transparent);
}
.stage-diagnostic   { --sc: #94a3b8; }
.stage-prep         { --sc: #6366f1; }
.stage-estimation   { --sc: #4f46e5; }
.stage-inference    { --sc: var(--pos); }
.stage-robustness   { --sc: var(--neg); }
.stage-heterogeneity{ --sc: #94a3b8; }
.stage-reporting    { --sc: #94a3b8; }
.stage-other        { --sc: #94a3b8; }

.step-external summary {
  cursor: pointer; font-size: .82rem; color: var(--muted);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.step-external summary::-webkit-details-marker { display: none; }
.step-external summary::before { content: "▸"; font-size: .7rem; transition: transform .15s; }
.step-external[open] summary::before { transform: rotate(90deg); }
.step-ext-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 9px; }
.step-note textarea { min-height: 58px; }

/* Dedicated code editor — a dark, monospace surface with a title bar. */
.code-ed {
  border-radius: 12px; overflow: hidden; border: 1.5px solid #1e293b;
  box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .55);
  transition: border-color .14s, box-shadow .14s;
}
.code-ed:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.code-ed-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: #1e293b; }
.code-ed-dots { display: inline-flex; gap: 5px; }
.code-ed-dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.code-ed-dots i:nth-child(1) { background: #cbd5e1; }
.code-ed-dots i:nth-child(2) { background: #94a3b8; }
.code-ed-dots i:nth-child(3) { background: #cbd5e1; }
.code-ed-tag { margin-left: auto; font-family: var(--mono); font-size: .6rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #94a3b8; }
.stacked-form .code-ed textarea {
  width: 100%; display: block; margin: 0; border: none; border-radius: 0;
  background: #0f172a; color: #e2e8f0;
  font-family: var(--mono); font-size: .85rem; line-height: 1.6; padding: 14px 16px;
  resize: vertical; min-height: 96px; box-shadow: none; tab-size: 2;
}
.stacked-form .code-ed textarea:focus { box-shadow: none; outline: none; background: #0f172a; }
.stacked-form .code-ed textarea::placeholder { color: #5b6b85; }

/* Formula editor — LaTeX in, live KaTeX preview out. */
.formula-ed {
  border-radius: 12px; overflow: hidden; border: 1.5px solid var(--line); background: var(--panel-2);
  transition: border-color .14s, box-shadow .14s;
}
.formula-ed:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.stacked-form .formula-ed textarea {
  width: 100%; display: block; margin: 0; border: none; border-radius: 0;
  background: var(--panel-2); color: var(--ink);
  font-family: var(--mono); font-size: .88rem; line-height: 1.5; padding: 11px 14px;
  resize: vertical; min-height: 46px; box-shadow: none;
}
.stacked-form .formula-ed textarea:focus { box-shadow: none; outline: none; }
.formula-preview {
  border-top: 1px dashed var(--line-2); padding: 14px 16px; background: var(--panel);
  text-align: center; color: var(--ink); overflow-x: auto; min-height: 22px;
}
.formula-preview .katex { font-size: 1.15em; }
.formula-empty { color: var(--muted); font-size: .82rem; font-style: italic; }

.step-add {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  margin-top: 2px; padding: 11px 20px; border-radius: 12px; cursor: pointer;
  border: 1.5px dashed var(--line-2); background: var(--panel); color: var(--brand);
  font-size: .9rem; font-weight: 600; font-family: var(--sans);
  transition: background .14s, border-color .14s, transform .12s, box-shadow .14s;
}
.step-add:hover { border-color: var(--brand); background: #f4f6f9; transform: translateY(-1px); box-shadow: 0 8px 20px -10px var(--brand-glow); }
.step-add span { font-size: 1.15rem; line-height: 1; }
@media (max-width: 640px) {
  .step-card { grid-template-columns: 1fr; }
  .step-card-rail { flex-direction: row; justify-content: space-between; border-right: none; border-bottom: 1px solid var(--line); padding: 8px 14px; }
  .step-ext-grid { grid-template-columns: 1fr; }
}

/* Profile */
.profile-head {
  background: linear-gradient(135deg, #eef2ff 0%, #f4f6f9 100%);
  border: 1px solid #e0e7ff; border-radius: 16px;
  padding: 22px 26px; margin-top: 18px;
}
.profile-head-id { display: flex; align-items: center; gap: 18px; }
.profile-head-id > div:nth-child(2) { flex: 1; min-width: 0; }
.profile-head-icon {
  flex: none; display: grid; place-items: center; width: 72px; height: 72px;
  background: var(--brand); color: #fff; border-radius: 50%;
  font-size: 1.9rem; font-weight: 700;
  box-shadow: 0 6px 16px -8px rgba(79,70,229,.5);
}
.profile-head h1 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -.015em; }
.profile-meta { display: flex; gap: 14px; color: var(--muted); font-size: .9rem; margin-bottom: 4px; flex-wrap: wrap; }
.profile-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-counts { display: flex; gap: 18px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #e0e7ff; }
.profile-count { font-size: .88rem; color: var(--muted); }
.profile-count strong { color: var(--ink); font-size: 1.05rem; font-weight: 700; margin-right: 4px; }
.bio { color: #374151; margin: 6px 0 0; }
@media (max-width: 620px) {
  .profile-head-id { flex-direction: column; align-items: flex-start; }
}

/* Profile workflow cards — a compact mini-feed of created / saved workflows */
.profile-group-heading { font-size: 1.15rem; letter-spacing: -.01em; margin: 26px 0 14px; }
.pf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; margin: 0 0 8px; }
.pf-card {
  --fam: #64748b;
  position: relative; display: flex; flex-direction: column; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 14px 30px -24px rgba(15,23,42,.30);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .25s, border-color .2s;
}
.pf-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 2;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 22%, transparent));
}
.pf-card:hover {
  transform: translateY(-4px); text-decoration: none;
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
  box-shadow: 0 28px 50px -28px rgba(55, 48, 163, .30), 0 6px 14px -8px rgba(15,23,42,.12);
}
/* Source label at the top of the profile mini-card (the card itself links to
   the detail page, where the citation is clickable). */
.pf-src {
  display: flex; align-items: baseline; gap: 5px; padding: 7px 12px 0;
  font-family: var(--mono); font-size: .54rem; color: var(--brand);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-src-k { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); flex: none; }
.pf-up { color: var(--brand); font-size: .78rem; }
.pf-card-cover {
  position: relative; aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(130% 130% at 50% 0%, #fff 52%, #e9eef6 100%);
  box-shadow: inset 0 -1px 0 var(--line); overflow: hidden;
}
.pf-card-cover img { width: 100%; height: 100%; object-fit: contain; }
.pf-card-sigma { font-family: var(--mono); font-size: 2.2rem; color: var(--line-2); }
.pf-card-cats { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 16px); }
.pf-cat {
  --c: #64748b; font-family: var(--mono); font-size: .55rem; font-weight: 700; color: #fff;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  background: var(--c); background: color-mix(in srgb, var(--c) 90%, transparent);
  box-shadow: 0 2px 6px -2px rgba(15,23,42,.4), inset 0 0 0 1px rgba(255,255,255,.18);
}
.pf-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.pf-card-title {
  margin: 0; font-family: var(--serif); font-size: 1rem; font-weight: 600; line-height: 1.3;
  color: var(--ink); letter-spacing: -.003em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pf-card-sum {
  margin: 0; font-size: .8rem; line-height: 1.45; color: var(--muted); flex: 1 1 auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pf-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 2px; padding-top: 9px; border-top: 1px solid var(--line);
}
.pf-author { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pf-author-name { font-family: var(--mono); font-size: .7rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stats { display: inline-flex; gap: 9px; flex: none; font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--muted); }
.pf-empty { grid-column: 1 / -1; color: var(--muted); padding: 26px; text-align: center; background: var(--panel); border: 1px dashed var(--line-2); border-radius: 14px; }

/* Evaluation history (method detail) */
.eval-runs { margin: 12px 0; }
.eval-runs summary { cursor: pointer; color: var(--brand); font-size: .9rem; margin-bottom: 8px; }
.eval-runs .board { margin-top: 8px; }

/* Leaderboard */
.board { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.board th, .board td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92rem; }
.board th { background: #f9fafb; color: var(--muted); font-weight: 600; }
.board .num { text-align: right; }
.board .rank { color: var(--muted); width: 36px; }
.board tr:last-child td { border-bottom: none; }

/* Guide page — interactive, numbered, with live previews */
.guide-hero {
  background: linear-gradient(135deg, #eef2ff 0%, #f4f6f9 100%);
  border: 1px solid #e0e7ff; border-radius: 16px;
  padding: 32px 34px; margin: 20px 0 24px;
}
.guide-kicker { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--brand); font-weight: 700; margin: 0 0 4px; }
.guide-hero h1 { font-size: 2rem; margin: 0 0 10px; letter-spacing: -.02em; }
.guide-hero .lead { color: #475467; font-size: 1.02rem; margin: 0 0 22px; max-width: 660px; }
.guide-jump { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.guide-jump-link {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.guide-jump-link:hover {
  border-color: var(--brand); transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(79,70,229,.28); text-decoration: none;
}
.guide-jump-icon {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--brand); color: #fff; border-radius: 10px; font-size: 1.1rem; font-weight: 700;
}
.guide-jump-link span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.guide-jump-link strong { font-size: .95rem; }
.guide-jump-link em { font-style: normal; font-size: .78rem; color: var(--muted); }

.guide-block {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin: 18px 0; box-shadow: var(--shadow);
  scroll-margin-top: 70px;
}
.guide-block-head { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 16px; }
.guide-num {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px;
  background: var(--brand); color: #fff; border-radius: 12px;
  font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 6px 16px -8px rgba(79,70,229,.5);
}
.guide-block-head h2 { margin: 0 0 4px; font-size: 1.35rem; letter-spacing: -.01em; }
.guide-block-sub { margin: 0; color: var(--muted); font-size: .92rem; }
.guide-block > p { color: #374151; margin: 6px 0 12px; }

.guide-howto { list-style: none; padding: 0; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.guide-howto > li {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .12s, background .12s;
}
.guide-howto > li:hover { background: #f1f5f9; border-color: #cbd5e1; }
.guide-howto-num {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px;
  background: var(--brand); color: #fff; border-radius: 8px;
  font-weight: 700; font-size: .85rem; text-transform: uppercase;
}
.guide-howto > li > div p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.guide-howto strong { font-size: .96rem; }

.guide-side-by-side {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin: 8px 0 16px;
}
.guide-side-by-side > div { min-width: 0; }
.guide-callout {
  padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid #94a3b8; border-radius: 8px;
  color: #78350f; font-size: .9rem; margin: 0 0 12px;
}

.guide-feature-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.guide-feature-list > li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .12s, transform .12s;
}
.guide-feature-list > li:hover { border-color: var(--brand); transform: translateX(2px); }
.guide-feature-list > li > div { font-size: .9rem; line-height: 1.5; flex: 1; min-width: 0; }
.guide-feature-list strong { color: var(--ink); }
.guide-feature-list em { color: var(--muted); font-style: normal; }
.guide-feature-emoji { font-size: 1.05rem; line-height: 1.4; width: 26px; text-align: center; color: var(--brand); flex: none; }
.guide-feature-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 6px; box-shadow: 0 0 0 3px var(--panel); }
.guide-feature-list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.guide-dag-demo {
  padding: 16px 18px; background: linear-gradient(180deg, #fafbff 0%, #f4f6f9 100%);
  border: 1px solid #e0e7ff; border-radius: 12px;
}
.guide-dag-caption { color: var(--muted); font-size: .8rem; margin: 0 0 12px; text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.guide-snippet-label { color: var(--muted); font-size: .82rem; margin: 0 0 6px; font-weight: 600; }

.guide-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 820px) {
  .guide-jump { grid-template-columns: repeat(2, 1fr); }
  .guide-side-by-side { grid-template-columns: 1fr; }
  .guide-feature-list-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   TERMINAL TOPBAR · mono brand identity + status badge
   ============================================================ */
.topbar-inner { height: 64px; gap: 16px; }
.brand { gap: 10px; align-items: center; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.brand-name {
  font-family: var(--sans); font-weight: 800; font-size: 1.12rem;
  letter-spacing: -.02em; color: var(--ink);
}
.brand-name-acc { color: var(--brand); }
.brand-tag {
  font-family: var(--sans); font-size: .68rem; letter-spacing: 0;
  text-transform: none; color: var(--muted); font-weight: 500;
  margin-top: 1px;
}
.nav.nav-center { margin-left: 24px; gap: 18px; font-family: var(--mono); font-size: .82rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.nav-center a { color: var(--ink-2); padding: 4px 2px; border-bottom: 1.5px solid transparent; transition: color .15s, border-color .15s; }
.nav-center a:hover { color: var(--brand); border-bottom-color: var(--brand-2); text-decoration: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-family: var(--sans); font-size: .76rem; font-weight: 600;
  letter-spacing: 0; text-transform: none; color: var(--ink-2);
}
.status-pill .status-num { color: var(--ink); font-size: .8rem; font-weight: 700; }
.status-pill .status-label { color: var(--muted); }
.status-orb {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pos); flex: none; position: relative;
  box-shadow: 0 0 0 0 rgba(5, 150, 105, .55);
  animation: orb-ping 2s ease-out infinite;
}
@keyframes orb-ping {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .6); }
  70% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* ============================================================
   LEFT RAIL · search card + consensus metrics + family list
   ============================================================ */
.rail-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px 12px;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.rail-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), transparent);
  opacity: .8;
}
.rail-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.rail-card-title {
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; color: var(--ink);
  white-space: nowrap;
}
.rail-card-tag {
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand); background: rgba(67, 56, 202, .08);
  border: 1px solid rgba(67, 56, 202, .2); border-radius: 4px;
  padding: 1px 5px;
}
.rail-search { margin: 0 0 12px; }
.rail-search input[type=search] {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-family: var(--mono); font-size: .82rem;
  background: var(--panel-2); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.rail-search input[type=search]:focus {
  outline: none; border-color: var(--brand);
  background: var(--panel); box-shadow: 0 0 0 3px var(--brand-glow);
}

.consensus-card {
  background: linear-gradient(160deg, #1e1b4b 0%, #0f172a 100%);
  border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.consensus-label {
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: #a5b4fc;
}
.consensus-row { display: flex; align-items: baseline; justify-content: space-between; }
.consensus-name { font-family: var(--mono); font-size: .72rem; color: #cbd5e1; }
.consensus-value {
  font-family: var(--mono); font-weight: 800; font-size: 1.05rem;
  color: #34d399; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.consensus-note { margin: 4px 0 0; font-size: .68rem; line-height: 1.45; color: #94a3b8; }

/* Family rail (override leftrail::before — we now use rail-card wrappers) */
.leftrail { background: transparent; border: none; box-shadow: none; padding: 0; }
.leftrail::before { display: none; }

/* ============================================================
   SORT DECK · dark gradient header above the cards
   ============================================================ */
.sort-deck {
  background:
    radial-gradient(ellipse 60% 80% at 12% 0%, rgba(129, 140, 248, .35), transparent 70%),
    radial-gradient(ellipse 70% 90% at 95% 110%, rgba(55, 48, 163, .25), transparent 65%),
    linear-gradient(180deg, rgba(30, 27, 75, .72) 0%, rgba(15, 23, 42, .68) 100%);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(129, 140, 248, .22);
  border-radius: 14px; padding: 16px 18px; margin: 2px 0 16px;
  position: relative; overflow: hidden;
  box-shadow:
    0 12px 36px -20px rgba(15, 23, 42, .28),
    0 1px 0 rgba(255, 255, 255, .06) inset,
    0 -1px 0 rgba(0, 0, 0, .18) inset;
}
.sort-deck::before {
  /* Subtle scan-line texture for the "instrument-panel" vibe */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    180deg, transparent 0 2px, rgba(255, 255, 255, .015) 2px 3px
  );
  border-radius: inherit;
}
.sort-deck::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand) 50%, transparent);
  opacity: .5;
}
.sort-deck-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 1px solid rgba(148, 163, 184, .14);
}
.sort-deck-title {
  font-family: var(--mono); font-size: .88rem; font-weight: 700;
  letter-spacing: .06em; color: #fff;
  display: inline-flex; align-items: center; gap: 8px;
}
.sort-deck-icon { color: #818cf8; font-size: 1.05rem; }
.real-time-node {
  font-family: var(--mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: #34d399;
  background: rgba(5, 150, 105, .12);
  border: 1px solid rgba(5, 150, 105, .35); border-radius: 999px;
  padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px;
}
.real-time-node .status-orb { background: #34d399; }
.sort-deck-body { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.sort-deck-label {
  font-family: var(--mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: #94a3b8;
}
.sort-deck-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: rgba(2, 6, 23, .55);
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px; padding: 4px;
}
.sort-tab {
  text-align: center; padding: 9px 8px; border-radius: 7px;
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  color: #cbd5e1; transition: background .15s, color .15s;
}
.sort-tab:hover { color: #fff; text-decoration: none; background: rgba(15, 23, 42, .55); }
.sort-tab.active {
  color: #fff; background: linear-gradient(180deg, var(--brand) 0%, #3730a3 100%);
  box-shadow: 0 6px 14px -6px rgba(67, 56, 202, .55), inset 0 1px 0 rgba(255,255,255,.18);
}

/* ============================================================
   METHOD CARD · sub-header bar + stats + body + footer
   ============================================================ */
.method-card, .workflow-card, .dataset-card {
  flex-direction: column; gap: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-left-width: 2px;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, .025) 0%, transparent 38%),
    linear-gradient(225deg, rgba(55, 48, 163, .02) 0%, transparent 42%),
    var(--panel);
  transition: transform .18s ease, border-color .18s, box-shadow .25s;
}
.method-card:hover, .workflow-card:hover, .dataset-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  box-shadow:
    0 18px 40px -22px rgba(67, 56, 202, .22),
    0 4px 8px -4px rgba(15, 23, 42, .06);
}
.card-subheader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(99, 102, 241, .035) 0%, transparent 50%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  gap: 12px; flex-wrap: wrap;
}
.sub-pills { display: inline-flex; align-items: center; gap: 6px; }
.sub-stats {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .68rem; font-weight: 700;
}
.pkg-pill {
  font-family: var(--mono); font-size: .62rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  color: #e2e8f0; background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1px solid #334155; border-radius: 4px;
  padding: 2px 7px;
  box-shadow: 0 2px 4px -2px rgba(15,23,42,.4), inset 0 1px 0 rgba(255,255,255,.08);
}
.hot-index {
  color: var(--brand); background: #eef2ff;
  border: 1px solid #c7d2fe; border-radius: 999px;
  padding: 2px 9px; letter-spacing: .04em;
}
.peers-count {
  color: var(--ink-2); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px; letter-spacing: .04em;
  display: inline-flex; align-items: center; gap: 5px;
}
.peers-count .status-orb { width: 6px; height: 6px; }

.card-row { display: flex; gap: 14px; padding: 14px 18px 12px; }
.card-row .votebox { align-self: flex-start; margin-top: 2px; }
.method-card .card-title {
  font-size: 1.05rem; margin: 0 0 4px;
  letter-spacing: -.015em; line-height: 1.25;
}
.method-card .card-summary { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); }

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px; border-top: 1px solid var(--line);
  background: var(--panel-2); gap: 12px; flex-wrap: wrap;
  font-family: var(--mono); font-size: .72rem;
}
.card-footer .byline { font-family: var(--mono); color: var(--ink-2); }
.card-footer .byline a { color: var(--ink); font-weight: 600; }
.card-footer .dot { color: var(--line-2); }
.footer-meta { display: inline-flex; align-items: center; gap: 6px; }
.reviews-chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; color: var(--ink-2); font-weight: 600;
}
.ref-chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; color: var(--ink-2); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.ref-chip code {
  background: var(--panel-2); padding: 0 4px; border-radius: 3px;
  font-size: .68rem; color: var(--brand);
}
.ref-chip:hover { text-decoration: none; border-color: var(--brand); }

/* ============================================================
   Rail CTA button (compose / upload primary action in rail card)
   ============================================================ */
.rail-cta {
  display: block; margin-top: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: linear-gradient(180deg, var(--brand) 0%, #3730a3 100%);
  color: #fff !important; font-weight: 600; font-size: .82rem;
  text-align: center; letter-spacing: .01em;
  border: 1px solid #3730a3;
  box-shadow: 0 6px 14px -8px rgba(67, 56, 202, .55), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .15s, box-shadow .15s;
}
.rail-cta:hover {
  text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 10px 20px -10px rgba(67, 56, 202, .65), inset 0 1px 0 rgba(255, 255, 255, .14);
}

/* ============================================================
   Sort-deck color variants — workflows = indigo + emerald accent
   ============================================================ */
.sort-deck-workflows::after {
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 50%, #34d399 100%);
}
.sort-deck-datasets::after {
  background: linear-gradient(90deg, var(--brand-2) 0%, #94a3b8 50%, #94a3b8 100%);
}

/* ============================================================
   Workflow card extras: pipeline + branch chips
   ============================================================ */
.workflow-card { border-left: 2px solid var(--brand); }
.workflow-card.card { flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.workflow-card .card-row { padding: 14px 18px 12px; }
.badge-pipeline {
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: #3730a3; background: #eef2ff;
  border: 1px solid #c7d2fe; border-radius: 999px;
  padding: 2px 9px;
}
.badge-branch {
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: #a21caf; background: #fdf4ff;
  border: 1px solid #f5d0fe; border-radius: 999px;
  padding: 2px 9px;
}

/* ============================================================
   Dataset card extras: dimensions / synthetic / curated chips
   ============================================================ */
.dataset-card { border-left: 2px solid var(--brand-2); }
.dataset-card.card { flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.card-row-flush { padding: 14px 18px 12px; }
.badge-dim {
  font-family: var(--mono); font-size: .68rem; font-weight: 700;
  letter-spacing: .04em;
  color: var(--brand); background: #eef2ff;
  border: 1px solid #c7d2fe; border-radius: 6px;
  padding: 2px 8px;
}
.badge-synth {
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px;
}
.curated-pill {
  font-family: var(--mono); font-size: .7rem; font-weight: 700;
  letter-spacing: .04em;
  color: var(--brand); background: rgba(67, 56, 202, .08);
  border: 1px solid rgba(67, 56, 202, .25); border-radius: 999px;
  padding: 2px 9px;
  display: inline-flex; align-items: center; gap: 4px;
}

/* ============================================================
   Card thumbnail · small figure inset on method list cards
   ============================================================ */
.card-thumb {
  flex: none; display: block; align-self: flex-start;
  width: 124px; height: 88px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-2);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card-thumb:hover {
  transform: translateY(-1px); border-color: rgba(99, 102, 241, .4);
  box-shadow: 0 6px 18px -8px rgba(67, 56, 202, .35);
  text-decoration: none;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 720px) {
  .card-thumb { width: 88px; height: 66px; }
}

/* Markdown <img> figures in method detail prose — center, rounded, soft shadow */
.prose img {
  max-width: 100%; height: auto; display: block;
  margin: 16px auto; border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px -14px rgba(15, 23, 42, .22);
  background: var(--panel);
}
/* Markdown caption pattern: a paragraph that starts with "*Figure:" italic.
   We can't style by content, but the surrounding emphasis renders as <em>
   in a <p>. So we approximate with a centered, smaller caption look on
   the paragraph that directly follows a figure image. */
.prose p > em:first-child:only-child { color: var(--muted); font-size: .82rem; }
.prose img + p { text-align: center; }
.prose img + p em { color: var(--muted); font-size: .82rem; font-style: italic; }
.prose img + p a { color: var(--brand-2); }

/* Rail tier dots (staff-only datasets) */
.rail-tier-public .rail-dot { background: #94a3b8; }
.rail-tier-private .rail-dot { background: var(--neg); }
.rail-tier-hidden .rail-dot { background: #94a3b8; }

/* ============================================================
   FEED · Xiaohongshu-style masonry grid (homepage)
   ============================================================ */
/* Feed outer width. NO zoom: zoom breaks backdrop-filter (the glass
   cards), so the airy "0.8" size is recreated natively with a narrower
   page (1480px gives ~410px cards on a wide screen, with real side
   whitespace) — and the glass actually renders. The topbar reads the
   same width so the two line up. */
body.body-feed { --feed-page-max: 1620px; --feed-page-px: 28px; }
.body-feed .page {
  display: flex; align-items: flex-start; gap: 28px;
  max-width: var(--feed-page-max); margin: 0 auto; padding: 0 var(--feed-page-px);
}
.body-feed .main { flex: 1 1 auto; min-width: 0; padding-top: 16px; }
.body-feed .main .container { padding: 0; max-width: none; }

/* Left rail — the FIELD catalogue. Pick your field once; it rarely changes,
   so it reads like settled navigation, each field with its own quiet colour. */
.feed-rail {
  flex: none; width: 312px; align-self: flex-start;
  position: sticky; top: 72px; max-height: calc(100vh - 88px);
  /* The rail scrolls independently when its content overflows — your sub-
     categories are reachable without scrolling the whole page. */
  display: flex; flex-direction: column;
  padding: 0 12px 14px; border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--brand) 4%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 18px 40px -30px rgba(15,23,42,.3); margin-top: 16px;
  /* Smooth compact ↔ expanded morph, not an instant jump. */
  transition: width .42s cubic-bezier(.22, .8, .25, 1), padding .42s cubic-bezier(.22, .8, .25, 1);
}
/* Labels and sub-menus fade with the width morph. visibility is delayed off so
   the fade animation completes before they become inert. */
.feed-rail-head-text,
.feed-rail-cat-name, .feed-rail-cat-count,
.feed-rail-toggle, .feed-rail-subs,
.feed-rail-collapse {
  transition: opacity .2s ease, visibility 0s linear .42s;
}
.feed-rail-cats {
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  margin: 0 -12px; padding: 0 12px 4px;
  /* Scrollbar lives in its own gutter: invisible by default; it appears only
     while the user is hovering the rail or actively scrolling, then fades back. */
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  transition: scrollbar-color .25s ease;
}
.feed-rail:hover .feed-rail-cats { scrollbar-color: color-mix(in srgb, var(--brand) 28%, var(--line-2)) transparent; }
.feed-rail-cats::-webkit-scrollbar { width: 5px; }
.feed-rail-cats::-webkit-scrollbar-track { background: transparent; }
.feed-rail-cats::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background .25s ease; }
.feed-rail:hover .feed-rail-cats::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--brand) 28%, var(--line-2)); }
.feed-rail:hover .feed-rail-cats::-webkit-scrollbar-thumb:hover { background: var(--brand); }
.feed-rail-head {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: .65rem; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--brand);
  padding: 12px 14px 11px; margin: 0 -12px 9px;
  /* A light, indigo-lettered section label with a hairline rule — refined,
     part of the system, but not a heavy dark slab. */
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
}
.feed-rail-head-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Admin shortcut into the taxonomy editor — visible only to taxonomy admins. */
.feed-rail-editlink {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: inline-grid; place-items: center; line-height: 1;
  color: var(--brand); text-decoration: none; font-size: .78rem; font-style: normal;
  transition: background .14s;
}
.feed-rail-editlink:hover { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); text-decoration: none; }
.feed-rail.is-compact .feed-rail-editlink { display: none; }
/* Compact mode: thin icon-strip rail once the user has seen it once. Click ⇥
   to pin it back to the full width. */
.feed-rail.is-compact { width: 64px; padding-left: 8px; padding-right: 8px; }
.feed-rail.is-compact .feed-rail-head { justify-content: center; padding: 12px 4px 11px; margin: 0 -8px 4px; }
.feed-rail.is-compact .feed-rail-head-text,
.feed-rail.is-compact .feed-rail-cat-name,
.feed-rail.is-compact .feed-rail-cat-count,
.feed-rail.is-compact .feed-rail-toggle,
.feed-rail.is-compact .feed-rail-collapse {
  opacity: 0; visibility: hidden;
  transition: opacity .12s ease, visibility 0s linear .12s;
}
/* Sub-category panels must COLLAPSE in compact mode, not just hide — otherwise
   an expanded sub (left over from when the rail was wide) keeps its layout
   space and produces big gaps between the dots. */
.feed-rail.is-compact .feed-rail-subs { display: none !important; }
.feed-rail.is-compact .feed-rail-row { margin: 0; display: block; }
/* The chevron toggle has to leave the layout (not just go invisible) — even
   visibility:hidden keeps its 26px width, which would shrink the cat button
   and shove the dot off the rail's centre. */
.feed-rail.is-compact .feed-rail-toggle { display: none !important; }
.feed-rail.is-compact .feed-rail-cats { gap: 2px; }
.feed-rail.is-compact .feed-rail-expand { opacity: 1; visibility: visible; }
/* The dot is positioned absolutely at the button's exact centre, so the
   (still-rendered) cat-name / count don't push it off-axis. Result: every dot
   in the rail sits on the same perfectly vertical line. */
.feed-rail.is-compact .feed-rail-cat {
  position: relative; height: 26px; padding: 0; pointer-events: none;
}
.feed-rail.is-compact .feed-rail-dot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
/* Compact mode: hide the scrollbar entirely (the labels are gone, the list is
   short, no scrollbar needed) and stop hover from re-summoning it. */
.feed-rail.is-compact .feed-rail-cats {
  overflow: hidden; scrollbar-width: none;
}
.feed-rail.is-compact .feed-rail-cats::-webkit-scrollbar { width: 0; display: none; }
.feed-rail.is-compact:hover .feed-rail-cats { scrollbar-color: transparent transparent; }
/* In compact mode the rail is a pure peek — only the ⇥ expand button works.
   Dots LIGHT UP for any field whose sub-category is selected so the shrunk
   rail still tells you at a glance where your filters are. */
.feed-rail.is-compact .feed-rail-cat.active { animation: none; background: transparent; }
.feed-rail.is-compact .feed-rail-cat.active::before { display: none; }
.feed-rail.is-compact .feed-rail-dot { width: 7px; height: 7px; transition: background .18s, transform .18s; }
/* Active state combines the centering translate with the scale. */
.feed-rail.is-compact .feed-rail-cat.active .feed-rail-dot {
  background: var(--brand); transform: translate(-50%, -50%) scale(1.45);
}
/* Expand button always usable when compact; absent when expanded. */
.feed-rail-expand { display: none; opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility 0s linear .15s; }
.feed-rail.is-compact .feed-rail-expand { display: inline-grid; }
.feed-rail-expand { display: none; }
.feed-rail-collapse,
.feed-rail-expand {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: none; border: none; cursor: pointer; color: var(--brand);
  display: inline-grid; place-items: center; line-height: 1;
  transition: background .14s;
}
.feed-rail-collapse::before { content: "⇤"; font-size: .9rem; font-weight: 700; }
/* Close button is mobile-drawer-only; hidden on desktop. */
.feed-rail-close { display: none !important; }
.feed-rail-collapse:hover,
.feed-rail-expand:hover { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); }
.feed-rail-cat {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; border-radius: 12px; color: var(--ink-2);
  font-family: inherit; font-size: .94rem; text-align: left;
  background: none; border: none; cursor: pointer;
  transition: background .14s, color .14s;
}
.feed-rail-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dot, #94a3b8);
}
.feed-rail-cat-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-rail-cat-count { font-family: var(--mono); font-size: .74rem; color: var(--muted); flex: none; }
.feed-rail-cat:hover { text-decoration: none; background: var(--panel-2); color: var(--ink); }
.feed-rail-cat.active {
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  color: var(--ink); font-weight: 600;
  transform-origin: left center; backface-visibility: hidden;
  animation: railFlip .6s cubic-bezier(.2, .8, .25, 1) both;
}
.feed-rail-cat.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.feed-rail-cat.active .feed-rail-dot { background: var(--brand); }
/* "Page-turn" highlight when a field is selected — the row swings in on its left
   hinge like a turned page, with a soft shadow that lifts as it lands flat. */
@keyframes railFlip {
  0%   { transform: perspective(680px) rotateY(-42deg); opacity: .2; box-shadow: 14px 0 22px -14px rgba(55,48,163,.5); }
  60%  { transform: perspective(680px) rotateY(7deg);   opacity: 1; box-shadow: 5px 0 14px -10px rgba(55,48,163,.35); }
  100% { transform: perspective(680px) rotateY(0);      opacity: 1; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .feed-rail-cat.active { animation: none; } }
.feed-rail-cat.is-empty { opacity: .45; }
.feed-rail-cat.is-all .feed-rail-dot { background: var(--ink); box-shadow: none; }
.feed-rail-cat.is-all.active { background: var(--panel-2); }
.feed-rail-cat.is-all.active::before { background: var(--ink); }

/* Sub-categories: an expandable, multi-select list under each field. */
.feed-rail-hint { font-weight: 600; letter-spacing: .04em; opacity: .55; }
.feed-rail-group.is-empty { opacity: .42; }
.feed-rail-row { display: flex; align-items: center; }
.feed-rail-row .feed-rail-cat { flex: 1 1 auto; }
.feed-rail-toggle {
  flex: none; width: 26px; align-self: stretch; margin-right: 2px;
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: .7rem; line-height: 1; border-radius: 8px;
  transition: transform .18s, color .14s, background .14s;
}
.feed-rail-toggle:hover { color: var(--brand); background: var(--panel-2); }
.feed-rail-toggle.open { transform: rotate(180deg); color: var(--brand); }
.feed-rail-subs {
  display: flex; flex-direction: column; gap: 1px; margin: 1px 0 5px 16px; padding-left: 9px;
  border-left: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
}
.feed-rail-sub {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  padding: 6px 10px; border-radius: 9px; color: var(--muted);
  font-family: inherit; font-size: .82rem; text-align: left;
  background: none; border: none; cursor: pointer; transition: background .14s, color .14s;
}
.feed-rail-sub:hover { background: var(--panel-2); color: var(--ink); }
.feed-rail-sub-tick {
  /* Round (radio-style), not square — the rail is single-select ("pick one"),
     so a square checkbox wrongly implied multi-select. */
  flex: none; width: 13px; height: 13px; border-radius: 50%; margin-top: 2px;
  border: 1.5px solid var(--line-2); background: var(--panel);
  transition: background .14s, border-color .14s;
}
/* Labels wrap rather than truncate — the rail is wide enough that almost all
   fit one line, and the rest stay fully readable. */
.feed-rail-sub-name { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.35; }
.feed-rail-sub.active { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.feed-rail-sub.active .feed-rail-sub-tick { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--panel); }

/* Active-filter chips above the grid (removable). */
.feed-selected { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; flex: 1 1 auto; min-width: 0; }
/* "All fields" — placeholder when no filter chip is active. Same pill shape
   as .feed-sel-chip so it doesn't look like a floating text label. */
.feed-sel-all {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px;
  cursor: default;
}
/* Desktop: "All fields" is just a status label — the field list is the
   always-visible left rail, so it must NOT look clickable. On phones the rail
   is a hidden drawer, so make "All fields" tappable: a light brand tint + press
   feedback, at the SAME size as the normal pill (no size bump, no caret). */
@media (max-width: 640px) {
  .feed-sel-all {
    cursor: pointer;
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 9%, var(--panel));
    border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
    transition: background .14s, transform .12s;
  }
  .feed-sel-all:active { background: color-mix(in srgb, var(--brand) 18%, var(--panel)); transform: scale(.96); }
}
.feed-sel-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--line));
  border-radius: 999px; padding: 4px 6px 4px 11px; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.feed-sel-chip:hover { background: color-mix(in srgb, var(--brand) 14%, var(--panel)); border-color: var(--brand); }
.feed-sel-x { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 18%, transparent); font-size: .82rem; line-height: 1; }
/* One-click "Clear all" — neutral, set apart from the brand-coloured chips so
   it reads as a reset, not another selection. */
.feed-sel-clear {
  margin-left: 4px; font-family: var(--mono); font-size: .68rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  background: none; border: none; border-bottom: 1px dashed var(--line-2);
  padding: 4px 0; cursor: pointer; transition: color .14s, border-color .14s;
}
.feed-sel-clear:hover { color: var(--brand); border-bottom-color: var(--brand); }

.feed-head { display: flex; flex-direction: column; gap: 12px; margin: 0 0 18px; }
#feed-inner { position: relative; }
/* Invisible trigger below the grid: when it nears the viewport the next batch
   of cards is revealed (incremental, so a huge field isn't laid out at once). */
.feed-sentinel { height: 8px; }

/* Tags (left) + sort (right) share one row, under the search. */
.feed-filterbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-bottom: 1px solid var(--line); padding-bottom: 11px;
}
.feed-tagrow {
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 7px; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, #000 96%, transparent);
          mask-image: linear-gradient(90deg, #000 96%, transparent);
}
.feed-tagrow::-webkit-scrollbar { display: none; }
.feed-tagchip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--ink-2); font-size: .82rem; font-weight: 500;
  transition: background .14s, border-color .14s, color .14s, transform .12s;
}
.feed-tagchip:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--line-2); color: var(--ink); }
.feed-tagchip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.feed-tagchip.is-all { font-weight: 600; }
.feed-tagchip-n { font-family: var(--mono); font-size: .66rem; opacity: .68; }
.feed-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 3px 3px 3px 16px;
  width: 100%; transition: border-color .15s, box-shadow .15s;
}
.feed-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-glow); }
.feed-search input[type=search] {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--sans); font-size: .9rem; color: var(--ink); padding: 9px 0;
}
.feed-search input::placeholder { color: var(--muted); }
.feed-search button {
  height: 34px; padding: 0 16px; border-radius: 8px; flex: none;
  background: var(--cta);              /* same tone as the Post button */
  color: #fff; border: none; cursor: pointer; font-size: .88rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12); transition: background .15s;
}
.feed-search button:hover { background: var(--cta-h); }
.feed-search-glyph { font-size: 1rem; line-height: 1; }
.feed-search-label { letter-spacing: .01em; }
@media (max-width: 560px) {
  /* On phones drop the label and let the button collapse to a square. */
  .feed-search button { padding: 0; width: 34px; justify-content: center; }
  .feed-search-label { display: none; }
}

.feed-sort { display: flex; gap: 6px; flex: none; font-family: var(--mono); font-size: .62rem; }
/* Pill chips: inactive uses the same quiet outline as the "All fields"
   placeholder; active uses the brand-tint chip shape used by .feed-sel-chip.
   Matches the visual rhythm so the row doesn't have floating bare text. */
.feed-sort a {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--line);
  letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
}
.feed-sort a:hover { color: var(--ink); text-decoration: none; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.feed-sort a.active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 26%, var(--line));
}

/* Tablet sizes (641-900px): rail becomes a horizontal scrolling pill row
   above the cards. On phones (<=640px) the theme-quiet drawer rule
   below takes over, so don't apply these tablet styles there. */
@media (min-width: 641px) and (max-width: 900px) {
  .body-feed .page { flex-direction: column; gap: 0; padding: 0 16px; }
  .feed-rail {
    position: static; width: 100%; margin-top: 12px; padding: 8px 8px 6px;
    background: transparent; border: none; box-shadow: none; backdrop-filter: none;
  }
  .feed-rail-head { display: none; }
  .feed-rail-cats { flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
  .feed-rail-cats::-webkit-scrollbar { display: none; }
  .feed-rail-cat { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; }
  .feed-rail-cat.active::before { display: none; }
  .feed-rail-cat-count { display: none; }
}

/* ── Masonry waterfall ───────────────────────────────────────────────
   JS (.js-masonry) packs cards into balanced columns and gives each cover
   the natural shape of its lead figure, so heights vary like a real
   waterfall and the columns stay level — no lopsided empty corner. Without
   JS it degrades to a tidy centred flex-wrap. */
.feed-grid {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 18px; margin-top: 18px;
}
.feed-grid.js-masonry { display: block; position: relative; }

.feed-card {
  flex: 1 1 250px; max-width: 340px;
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 14px 30px -24px rgba(15,23,42,.26);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .28s, border-color .2s;
  animation: feedCardIn .5s cubic-bezier(.2,.7,.3,1) both;
  animation-delay: calc(min(var(--i, 0), 14) * 40ms);
}
/* In masonry mode JS owns position via --x/--y; opacity drives entrance.
   The first layout positions cards instantly (no transform transition yet);
   `.is-live` is added on the next frame so later reflows/hover glide smoothly. */
.feed-grid.js-masonry .feed-card {
  flex: none; max-width: none; margin: 0; animation: none;
  position: absolute; top: 0; left: 0; opacity: 0;
  transform: translate3d(var(--x, 0), var(--y, 0), 0);
  transition: opacity .5s ease;
}
.feed-grid.js-masonry.is-live .feed-card {
  transition: transform .42s cubic-bezier(.2,.7,.3,1), box-shadow .28s, border-color .2s, opacity .5s ease;
}
.feed-grid.js-masonry .feed-card.is-in { opacity: 1; }
/* Popular sort — the top three cards stand out clearly from the rest through
   four layered cues, no heavy card-wide frame. Only kicks in when no filter
   is active.
     #1: a real INDIGO HEADER BAND with the "★ TOP PICK" label embedded —
         the unmistakable winner. Indigo glow underneath; title color shifts
         to indigo; biggest font; subtle indigo border to bind it together.
     #2: a slim indigo top stripe (4px); medium indigo glow; bigger title.
     #3: a hairline indigo top stripe (2px, lighter); soft glow; slightly
         bigger title. */
.feed-grid:not(.is-filtered) .feed-card.is-feat-1 {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: 0 5px 10px rgba(15,23,42,.06),
              0 32px 60px -20px color-mix(in srgb, var(--brand) 58%, transparent);
}
.feed-grid:not(.is-filtered) .feed-card.is-feat-2 {
  border-color: color-mix(in srgb, var(--brand) 18%, var(--line));
  box-shadow: 0 3px 7px rgba(15,23,42,.05),
              0 22px 40px -18px color-mix(in srgb, var(--brand) 32%, transparent);
}
.feed-grid:not(.is-filtered) .feed-card.is-feat-3 {
  box-shadow: 0 2px 5px rgba(15,23,42,.05),
              0 14px 26px -16px color-mix(in srgb, var(--brand) 18%, transparent);
}

/* All three get a same-thickness indigo top stripe — the only difference is
   the shade: solid indigo on #1, 65% on #2, 35% on #3. No text, no star, no
   header band — the contrast comes from the shadow ladder + title size. */
.feed-grid:not(.is-filtered) .feed-card.is-feat-1::before,
.feed-grid:not(.is-filtered) .feed-card.is-feat-2::before,
.feed-grid:not(.is-filtered) .feed-card.is-feat-3::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  z-index: 5; pointer-events: none;
}
.feed-grid:not(.is-filtered) .feed-card.is-feat-1::before { background: var(--brand); }
.feed-grid:not(.is-filtered) .feed-card.is-feat-2::before { background: color-mix(in srgb, var(--brand) 65%, var(--panel)); }
.feed-grid:not(.is-filtered) .feed-card.is-feat-3::before { background: color-mix(in srgb, var(--brand) 35%, var(--panel)); }


/* Title ladder: bigger AND indigo on #1, just bigger on #2/#3. */
.feed-grid:not(.is-filtered) .feed-card.is-feat-1 .feed-card-title {
  font-size: 1.3rem; color: var(--brand);
}
.feed-grid:not(.is-filtered) .feed-card.is-feat-2 .feed-card-title { font-size: 1.22rem; }
.feed-grid:not(.is-filtered) .feed-card.is-feat-3 .feed-card-title { font-size: 1.17rem; }
/* Client-side field/tag filter: a card fades + shrinks out (then leaves the
   layout); a newly-matching card fades in at its final spot; the rest glide. */
.feed-grid.js-masonry .feed-card.is-out { display: none !important; }
.feed-grid.js-masonry .feed-card.is-leaving {
  opacity: 0 !important; pointer-events: none;
  transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(.86) !important;
}
.feed-grid.js-masonry .feed-card.is-enter { opacity: 0 !important; transition: opacity .42s ease !important; }

.feed-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line-2));
  box-shadow: 0 28px 50px -26px rgba(67, 56, 202, .28), 0 6px 14px -8px rgba(15, 23, 42, .10);
}
.feed-grid.js-masonry .feed-card:hover {
  transform: translate3d(var(--x, 0), var(--y, 0), 0) translateY(-6px); z-index: 4;
}
@keyframes feedCardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .feed-card { animation: none; transition: box-shadow .2s, border-color .2s; }
  .feed-grid.js-masonry .feed-card { opacity: 1; transition: none; }
}
@media (max-width: 560px) { .feed-grid { gap: 12px; } .feed-card { max-width: none; } }

/* Body + footer share one positioned context so the title's stretched link
   covers them (but not the cover, whose slides/arrows stay clickable). */
.feed-card-main { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; }
.feed-card-title a.feed-card-link { color: inherit; text-decoration: none; }
.feed-card-title a.feed-card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.feed-card-title a.feed-card-link:hover { text-decoration: none; }

/* Cover — always an image; the figure is the hero */
.feed-cover { position: relative; width: 100%; background: var(--panel-2); display: block; overflow: hidden; box-shadow: inset 0 -1px 0 var(--line); }
.feed-cover img { width: 100%; height: auto; display: block; }
/* Subtle scrim so the pills overlaid at the bottom stay legible on any figure. */
.feed-cover-scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46%; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, .26));
  opacity: 0; transition: opacity .25s;
}
.feed-card:hover .feed-cover-scrim { opacity: 1; }

/* Swipeable figure gallery */
.feed-carousel { overflow: hidden; }
.feed-carousel-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.feed-carousel-track::-webkit-scrollbar { display: none; }
.feed-slide {
  flex: 0 0 100%; scroll-snap-align: center; display: block;
  aspect-ratio: var(--cover-ar, 1.34); overflow: hidden;
  background:
    radial-gradient(130% 130% at 50% 0%, #ffffff 52%, #e9eef6 100%);
}
.feed-slide img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform .4s cubic-bezier(.2,.7,.3,1);
}
.feed-card:hover .feed-slide img { transform: scale(1.045); }
.feed-car-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(15, 23, 42, .55); color: #fff; font-size: 1.1rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s; z-index: 2;
  backdrop-filter: blur(3px);
}
.feed-car-prev { left: 7px; }
.feed-car-next { right: 7px; }
.feed-card:hover .feed-car-arrow { opacity: 1; }
.feed-car-arrow:hover { background: rgba(15, 23, 42, .8); }
.feed-car-dots {
  position: absolute; bottom: 8px; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: center; gap: 4px; pointer-events: none;
}
.feed-car-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 2px rgba(0,0,0,.4); transition: background .15s, transform .15s; }
.feed-car-dot.is-active { background: #fff; transform: scale(1.3); }
@media (hover: none) { .feed-car-arrow { display: none; } }
/* No figure? Lead with the result instead — the headline formula, or a clean
   summary "snapshot" card (outputs aren't always plots). */
.feed-cover-snap {
  display: flex; flex-direction: column; gap: 10px; justify-content: center;
  min-height: 150px; padding: 20px 18px; color: var(--ink); text-decoration: none;
  background:
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
}
.feed-cover-snap:hover { text-decoration: none; }
.feed-snap-kicker {
  font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.feed-snap-summary { margin: 0; font-size: .92rem; line-height: 1.5; color: var(--ink-2); }
.feed-snap-formula { color: var(--ink); overflow-x: auto; padding: 4px 0; }
.feed-snap-formula .katex { font-size: 1.12em; }
.feed-cover-steps {
  position: absolute; bottom: 8px; left: 8px; z-index: 2;
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 2px 8px; border-radius: 999px;
}


.feed-card-body { padding: 18px 20px 12px; flex: 1 1 auto; }
.feed-card-title {
  font-family: var(--serif);
  font-size: 1.14rem; font-weight: 600; line-height: 1.34; letter-spacing: -.003em; color: var(--ink);
  margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-card:hover .feed-card-title { color: var(--brand); }
.feed-card-summary {
  font-size: .87rem; line-height: 1.58; color: var(--muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* One compact top row per card: the Source citation (with a hairline divider)
   then the user tags — a single line, overflow faded on the right, no wasted
   height. Tags never reach the cover, so the figure is never obscured. */
.feed-topbar {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  padding: 9px 14px 7px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);
          mask-image: linear-gradient(to right, #000 92%, transparent);
}
.feed-src {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  font-family: var(--mono); font-size: .56rem; font-weight: 700;
  color: var(--brand); text-decoration: none; white-space: nowrap;
  padding-right: 7px; margin-right: 1px; border-right: 1px solid var(--line);
}
.feed-src:hover { text-decoration: underline; }
.feed-src-x { opacity: .7; font-weight: 400; }
.feed-tag-chip {
  font-family: var(--mono); font-size: .58rem; font-weight: 600; letter-spacing: .01em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto;
  color: var(--ink-2); background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.feed-tag-chip:hover {
  text-decoration: none; transform: translateY(-1px);
  color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line-2));
  background: color-mix(in srgb, var(--brand) 6%, #fff);
  box-shadow: 0 4px 10px -4px rgba(67, 56, 202, .3);
}
/* Small "verified" check for official package accounts. */
.feed-verified {
  display: inline-grid; place-items: center; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: .56rem; font-weight: 900; line-height: 1;
}
/* Three independent badges: author (filled indigo), platform (filled with a P),
   data (outlined with a D). A card can carry any combination. */
/* Raise badges above the stretched card-link overlay (.feed-card-link::after,
   z-index:1) so hover reaches them and the tooltip fires. The rest of the card
   still navigates; only the tiny badge area opts out of the card click. */
.feed-badges { display: inline-flex; gap: 3px; flex: none; position: relative; z-index: 2; }
.feed-badge {
  display: inline-grid; place-items: center; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  font-family: var(--mono); font-size: .56rem; font-weight: 900; line-height: 1; letter-spacing: 0;
}
.feed-badge.fb-author   { background: var(--brand); color: #fff; }
.feed-badge.fb-platform { background: color-mix(in srgb, var(--brand) 22%, var(--panel)); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line)); }
.feed-badge.fb-data     { background: var(--panel); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line)); }
.feed-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 20px 14px; font-size: .8rem; gap: 8px;
  margin-top: auto; border-top: 1px solid var(--line);
}
.feed-author { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); min-width: 0; }
/* Certified authors get a gold gradient ring around their avatar. */
.feed-ava { display: inline-flex; border-radius: 50%; flex: none; }
.feed-ava.is-cert { padding: 1.5px; background: var(--brand); box-shadow: 0 0 0 1px #fff inset; }
.feed-ava.is-cert .avatar { box-shadow: 0 0 0 1.5px #fff; }
.feed-author-name {
  font-family: var(--mono); font-size: .74rem; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-stats { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.feed-likes, .feed-cmts {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600;
}
.feed-likes .heart { color: var(--brand); font-size: .8rem; line-height: 1; }
.feed-cmts { font-size: .72rem; }
.feed-cmts .cmt-mark { color: var(--muted); font-style: normal; font-variant-emoji: text; }
.feed-empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: .9rem; grid-column: 1 / -1; flex: 1 0 100%; }


/* ============================================================
   WORKFLOW DETAIL · input → pipeline → output tutorial blocks
   ============================================================ */
.wf-detail { max-width: 1100px; margin-left: auto; margin-right: auto; }
/* Discussion lives outside the .wf-detail article — keep it the same width so
   the page doesn't have a narrow article above a wide-open comment section. */
.wf-detail + #comments { max-width: 1100px; margin-left: auto; margin-right: auto; }
.detail + #comments { max-width: 1100px; margin-left: auto; margin-right: auto; }
/* Quieter kicker: no pill, no special glyphs — just a small mono label that
   sits under the title rather than crowding the head. */
.wf-kicker {
  display: inline-block; font-family: var(--mono); font-size: .62rem;
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.wf-kicker-sep { display: inline-block; margin: 0 6px; color: color-mix(in srgb, var(--muted) 50%, var(--line-2)); }
.wf-detail .detail-head h1 { letter-spacing: -.005em; }

/* Source citation under the byline — understated (a dashed-underlined link, not
   a heavy box) with a BibTeX toggle that reveals a copyable entry. */
.wf-cite {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  /* Symmetric breathing room above and below — same gap from the tags as to
     the AI summary that follows. */
  margin: 18px 0 18px; font-size: .88rem;
}
.wf-source {
  display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink);
  text-decoration: none; padding-bottom: 1px;
  border-bottom: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line-2));
}
.wf-source:hover { border-bottom-style: solid; text-decoration: none; }
.wf-source-k {
  flex: none; font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.wf-source-label { font-weight: 600; }
.wf-source-x { color: var(--brand); font-weight: 700; }
.wf-cite-btn {
  font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); cursor: pointer;
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  border-radius: 6px; padding: 4px 9px; transition: background .14s;
}
.wf-cite-btn:hover { background: color-mix(in srgb, var(--brand) 13%, var(--panel)); }
.wf-bibtex {
  flex-basis: 100%; position: relative; margin: 2px 0 0;
  background: var(--ink); border-radius: 10px; overflow: hidden;
}
.wf-bibtex pre {
  margin: 0; padding: 13px 15px; color: #e2e8f0; overflow-x: auto;
  font-family: var(--mono); font-size: .76rem; line-height: 1.55; white-space: pre;
}
.wf-bibtex-copy {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #cbd5e1; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px; padding: 3px 8px; transition: background .14s, color .14s;
}
.wf-bibtex-copy:hover { background: rgba(255,255,255,.16); color: #fff; }

.io-block {
  position: relative;
  display: grid; grid-template-columns: 34px 1fr; gap: 16px;
  margin: 22px 0;
  padding-left: 2px;
}
/* connecting spine between the numbered nodes */
.io-block:not(:last-of-type)::before {
  content: ""; position: absolute; left: 16px; top: 40px; bottom: -22px;
  width: 2px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
  opacity: .25;
}
.io-step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 1rem;
  color: #fff; background: linear-gradient(135deg, var(--brand), #3730a3);
  box-shadow: 0 6px 14px -7px rgba(67, 56, 202, .6);
  position: relative; z-index: 1;
}
.io-output .io-step-num { background: var(--ink); }
.io-content { min-width: 0; }
.io-label {
  font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em;
  margin: 4px 0 12px; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.io-input .io-content {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px;
}
.io-input .io-label { margin-top: 0; }
.io-input .prose { color: var(--ink-2); }
.io-input .prose p { margin: 0; }

/* Result figures: a tidy, centred gallery of uniformly-sized cards instead of
   full-width images sprawling down the page. Tall figures letterbox cleanly. */
/* A justified gallery: each figure keeps its natural shape (wide plots go wide,
   tall ones go narrow) and they tile side by side, wrapping as needed — instead
   of every figure forced into one full-width column. */
/* Uniform gallery: every figure is the SAME size cell (the image is letterboxed
   inside a fixed box), so a tall plot and a wide plot read as one tidy set
   rather than a jumble of big-and-small. */
.io-figures {
  display: grid; gap: 16px; margin: 12px 0;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  justify-content: center;
}
.io-figure {
  margin: 0; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--panel); box-shadow: var(--shadow);
}
.io-figure img {
  display: block; width: 100%; height: 280px; object-fit: contain;
  background: #fff; padding: 10px;
}
/* A lone figure shouldn't stretch full-width — keep it a tidy, centred card. */
.io-figures:has(> .io-figure:only-child) { grid-template-columns: minmax(0, 460px); }
.io-figure figcaption {
  font-size: .8rem; color: var(--ink-2); padding: 9px 13px; line-height: 1.5;
  border-top: 1px solid var(--line); background: var(--panel-2);
  text-align: left;
}
.io-figure figcaption a { color: var(--brand); }
.io-fig-n {
  display: inline-block; font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--brand);
  background: rgba(67, 56, 202, .08); border: 1px solid rgba(67, 56, 202, .16);
  padding: 1px 6px; border-radius: 4px; margin-right: 8px; vertical-align: 1px; white-space: nowrap;
}
.io-fig-count { font-family: var(--mono); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.io-fig-credit { font-size: .76rem; color: var(--muted); margin: 4px 0 10px; }
.io-fig-credit a { color: var(--brand-2); }

/* Result · the numbers — the estimand + estimator output, for tutorials whose
   result is numerical (with or without a figure). A bordered card so the
   numbers read as the concrete deliverable. */
.io-results {
  margin: 12px 0 4px; padding: 13px 16px;
  background: color-mix(in srgb, var(--brand) 4%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
  border-radius: 12px;
}
.io-results-h {
  display: flex; align-items: center; gap: 7px; margin: 0 0 8px;
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--brand);
}
.io-results-mark {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 6px; background: color-mix(in srgb, var(--brand) 14%, transparent);
  font-size: .8rem;
}
.io-results-body { font-size: .95rem; }
.io-results-body :first-child { margin-top: 0; }
.io-results-body :last-child { margin-bottom: 0; }
/* Compact tables of estimates read clearly. */
.io-results-body table { border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0; }
.io-results-body th, .io-results-body td {
  padding: 4px 12px 4px 0; text-align: left; border-bottom: 1px solid var(--line);
}
.io-results-body th { font-weight: 700; color: var(--ink); }
.branch-flag {
  font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: #a21caf; background: #fdf4ff;
  border: 1px solid #f5d0fe; border-radius: 999px; padding: 2px 8px;
}
@media (max-width: 600px) {
  .io-block { grid-template-columns: 28px 1fr; gap: 12px; }
  .io-block:not(:last-of-type)::before { left: 13px; }
  .io-step-num { width: 28px; height: 28px; font-size: .85rem; }
}

/* ============================================================
   TECHNIQUE provenance · library intro · used-in back-links
   ============================================================ */
.lib-intro { text-align: center; margin: 4px 0 4px; }
.lib-title { font-size: 1.6rem; letter-spacing: -.025em; margin: 0 0 4px; }
.lib-title::after { content: none; }
.lib-sub { color: var(--muted); font-size: .92rem; margin: 0 auto; max-width: 64ch; }
.lib-sub a { color: var(--brand); font-weight: 600; }

.provenance-note {
  font-size: .85rem; line-height: 1.55; color: var(--ink-2);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: 10px 14px; margin: 12px 0;
}
.provenance-note a { color: var(--brand); font-weight: 600; }

.used-pill {
  font-family: var(--mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
  background: #eef2ff; color: var(--brand); border: 1px solid #c7d2fe;
}

.used-in { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.used-in h2 { font-size: 1.1rem; margin: 0 0 12px; }
.used-in .cards { gap: 10px; }
.used-in .card { padding: 12px 14px; }

/* Method cover fallback in the Techniques grid (no figure → estimand slab) */
.feed-cover-method {
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,.16), transparent 65%),
    linear-gradient(160deg, #3730a3 0%, #1e1b4b 100%);
}
.feed-cover-estimand {
  font-family: var(--mono); font-weight: 800; font-size: 1.5rem;
  letter-spacing: .04em; color: #fff; text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.byline .avatar { vertical-align: middle; }

/* ============================================================
   PIPELINE · structure diagram (layered DAG) + expandable steps
   ============================================================ */
.wf-diagram {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  margin: 4px 0 20px; padding: 16px;
  background:
    radial-gradient(ellipse 70% 60% at 15% 0%, rgba(99,102,241,.06), transparent 70%),
    radial-gradient(ellipse 70% 60% at 90% 100%, rgba(55,48,163,.05), transparent 70%),
    var(--panel-2);
  border: 1px solid var(--line); border-radius: 14px;
}
.wf-diagram-layer { display: flex; gap: 10px; justify-content: center; align-items: stretch; flex-wrap: wrap; }
.wf-diagram-layer.is-parallel {
  background: linear-gradient(180deg, rgba(99,102,241,.05), rgba(55,48,163,.04));
  border: 1px dashed rgba(99,102,241,.22); border-radius: 10px; padding: 7px;
}
.wf-diagram-arrow { text-align: center; color: rgba(99,102,241,.4); font-size: .7rem; line-height: 1.5; font-family: var(--mono); }
.wf-node {
  display: inline-flex; align-items: center; gap: 9px; text-align: left;
  padding: 8px 13px; border-radius: 9px; min-width: 0; max-width: 320px; flex: 0 1 auto;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  box-shadow: 0 1px 2px rgba(15,23,42,.04); cursor: pointer; font: inherit;
  transition: transform .15s, border-color .15s, box-shadow .2s;
}
.wf-node:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 10px 22px -12px rgba(67,56,202,.3);
}
.wf-node.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow), 0 10px 22px -12px rgba(67,56,202,.35);
}
.wf-node-num {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 800;
  font-size: .72rem; color: #fff; background: linear-gradient(135deg, var(--brand), #3730a3);
}
.wf-node .vpipe-dot { width: 8px; height: 8px; }
.wf-node-text { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.wf-node-stage { font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wf-node-title { font-size: .85rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Detail area: nothing until a node is clicked (JS adds .is-active). */
.pipe-detail-area { margin-top: 4px; }
.pipe-placeholder {
  text-align: center; font-size: .84rem; color: var(--muted); font-family: var(--mono);
  padding: 22px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel-2);
  margin: 0;
}
.pipe-detail { display: none; }
.pipe-detail.is-active { display: block; }
.pipe-detail {
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: 12px; background: var(--panel); padding: 18px 20px;
  animation: pipe-fade .22s ease;
}
@keyframes pipe-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pipe-detail.vpipe-diagnostic { border-left-color: #94a3b8; }
.pipe-detail.vpipe-prep { border-left-color: #6366f1; }
.pipe-detail.vpipe-estimation { border-left-color: var(--brand); }
.pipe-detail.vpipe-inference { border-left-color: var(--pos); }
.pipe-detail.vpipe-robustness { border-left-color: var(--neg); }
.pipe-detail.vpipe-heterogeneity { border-left-color: #94a3b8; }
.pipe-detail.vpipe-reporting { border-left-color: #94a3b8; }
.pipe-detail.vpipe-other { border-left-color: #94a3b8; }

.pipe-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pipe-detail-headtext { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.pipe-detail-headtext .vpipe-stage { font-family: var(--mono); }
.pipe-detail-title { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.pipe-role { margin: 4px 0 14px; color: var(--muted); font-size: .9rem; font-style: italic; }

.pipe-detail .pipe-block { margin-bottom: 14px; }
.pipe-detail .pipe-block-text { font-size: .95rem; line-height: 1.55; }
.pipe-io { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 14px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.pipe-io-item { font-size: .84rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.pipe-io-k { font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pipe-step {
  position: relative;
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: 12px; background: var(--panel);
  padding: 12px 14px; scroll-margin-top: 70px;
  transition: border-color .15s, box-shadow .2s;
}
.pipe-step:target { box-shadow: 0 0 0 3px var(--brand-glow); border-left-color: var(--brand); }
/* stage accent on the left bar */
.pipe-step.vpipe-diagnostic { border-left-color: #94a3b8; }
.pipe-step.vpipe-prep { border-left-color: #6366f1; }
.pipe-step.vpipe-estimation { border-left-color: var(--brand); }
.pipe-step.vpipe-inference { border-left-color: var(--pos); }
.pipe-step.vpipe-robustness { border-left-color: var(--neg); }
.pipe-step.vpipe-heterogeneity { border-left-color: #94a3b8; }
.pipe-step.vpipe-reporting { border-left-color: #94a3b8; }
.pipe-step.vpipe-other { border-left-color: #94a3b8; }

.pipe-step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pipe-step-num {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: .8rem;
  color: #fff; background: linear-gradient(135deg, var(--brand), #3730a3);
}
.pipe-step-head .vpipe-dot { width: 9px; height: 9px; }
.pipe-step-headtext { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.pipe-step-headtext .vpipe-stage { font-family: var(--mono); }
.pipe-step-title { font-weight: 600; font-size: 1rem; color: var(--ink); letter-spacing: -.01em; }
.pipe-step-deps { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.pipe-step-note { margin: 8px 0 0 34px; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }

.pipe-more { margin: 8px 0 0 34px; }
.pipe-more > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: .76rem; font-weight: 700;
  color: var(--brand); letter-spacing: .03em;
  padding: 3px 0;
}
.pipe-more > summary::-webkit-details-marker { display: none; }
.pipe-more > summary::before { content: "▸ "; }
.pipe-more[open] > summary::before { content: "▾ "; }
.pipe-more .pipe-more-close { display: none; }
.pipe-more[open] .pipe-more-open { display: none; }
.pipe-more[open] .pipe-more-close { display: inline; }
.pipe-more-count { color: var(--muted); font-weight: 500; }
.pipe-more-body {
  margin-top: 10px; padding: 12px 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; gap: 14px;
}
.pipe-block-label, .pipe-comments-label {
  display: block; font-family: var(--mono); font-size: .64rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.pipe-code .prose pre { margin: 0; }
.pipe-formula { padding: 8px 2px; overflow-x: auto; }
.pipe-formula .katex { font-size: 1.2em; }
.pipe-ref { margin: 0; font-size: .82rem; }

/* richer expand: meta row + 'what this is' block */
.pipe-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pipe-meta-item {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
}
.pipe-meta-k { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .62rem; margin-right: 4px; }
.pipe-block-text { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); line-height: 1.5; }
.pipe-block-links { display: flex; flex-wrap: wrap; gap: 12px; font-size: .82rem; }
.pipe-block-links code { font-size: .76rem; padding: 0 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; color: var(--brand); }
.io-input-more { margin: 10px 0 0; }

.pipe-comments { border-top: 1px solid var(--line); padding-top: 12px; }
.pipe-comment-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pipe-comment { display: flex; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pipe-comment .votebox { transform: scale(.85); transform-origin: top center; }
.pipe-comment-body { flex: 1; min-width: 0; }
.pipe-comment-body .comment-meta { font-size: .76rem; margin-bottom: 2px; }
.pipe-comment-body .prose { font-size: .88rem; }
.pipe-comment-empty { font-size: .84rem; padding: 4px 2px; list-style: none; }
.pipe-comment-form { display: flex; gap: 8px; align-items: flex-start; }
.pipe-comment-form textarea {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .88rem; resize: vertical; min-height: 38px; background: var(--panel);
}
.pipe-comment-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.pipe-login { font-size: .84rem; margin: 0; }
@media (max-width: 600px) {
  .pipe-step-note, .pipe-more { margin-left: 0; }
}

.formwrap-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.guide-btn { flex: none; white-space: nowrap; }

/* ============================================================
   TAXONOMY ADMIN · /taxonomy/ — edit the left-rail catalogue
   ============================================================ */
.tax-admin { max-width: 1000px; margin: 18px auto 48px; }
.tax-head h1 { font-family: var(--serif); font-size: 1.7rem; letter-spacing: -.005em; margin: 8px 0 8px; }
.tax-sub { color: var(--muted); font-size: .92rem; margin: 0 0 24px; max-width: 720px; line-height: 1.6; }

.tax-field {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.tax-field-head {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
  background: color-mix(in srgb, var(--brand) 4%, var(--panel));
  border-bottom: 1px solid var(--line);
}
.tax-move { display: flex; flex-direction: column; gap: 3px; flex: none; padding-top: 2px; }
.tax-move form { margin: 0; line-height: 0; }
.tax-move button {
  width: 24px; height: 19px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 5px; cursor: pointer; color: var(--muted); font-size: .58rem; line-height: 1;
  transition: color .14s, border-color .14s;
}
.tax-move button:hover:not(:disabled) { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.tax-move button:disabled { opacity: .35; cursor: default; }
.tax-move-h { flex-direction: row; padding-top: 0; }

.tax-field-main { flex: 1 1 auto; min-width: 0; }
.tax-name {
  font-family: var(--serif); font-size: 1.18rem; font-weight: 600; margin: 0;
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
}
.tax-slug {
  font-family: var(--mono); font-size: .64rem; font-weight: 600; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
  padding: 1px 8px; border-radius: 999px;
}
.tax-count { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.tax-blurb { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.tax-tagrow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tax-tagrow-inline { margin-top: 0; }
.tax-tag {
  font-family: var(--mono); font-size: .62rem; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 7px;
}
.tax-tag.is-unused { color: var(--muted); border-style: dashed; opacity: .75; }
.tax-none { color: var(--muted); font-size: .78rem; font-style: italic; }
.tax-none-block { padding: 4px 2px; margin: 0; }

.tax-actions { display: flex; align-items: flex-start; gap: 10px; flex: none; }
.tax-toggle > summary {
  cursor: pointer; list-style: none; display: inline-block;
  font-family: var(--mono); font-size: .66rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--line));
  background: var(--panel); border-radius: 7px; padding: 4px 10px;
  transition: background .14s;
}
.tax-toggle > summary::-webkit-details-marker { display: none; }
.tax-toggle > summary:hover { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.tax-toggle[open] > summary { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); }
.tax-del {
  font-family: var(--mono); font-size: .66rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--neg);
  border: 1px solid #fecaca; background: var(--panel); border-radius: 7px;
  padding: 4px 10px; cursor: pointer; transition: background .14s;
}
.tax-del:hover { background: #fef2f2; }

/* Edit/add forms drop below the row, full width, on a quiet panel. */
.tax-field-head .tax-toggle, .tax-sub-row .tax-toggle { position: relative; }
.tax-form {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 8;
  width: min(560px, 82vw);
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 14px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: 12px; box-shadow: var(--shadow-elev);
}
.tax-add .tax-form { position: static; width: 100%; box-shadow: none; background: var(--panel-2); border-color: var(--line); margin-top: 8px; }
.tax-form label {
  display: block; font-family: var(--mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.tax-form input {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .9rem; background: #fff; color: var(--ink);
}
.tax-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.tax-form .full { grid-column: 1 / -1; }
.tax-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.tax-subs { padding: 10px 16px 14px 44px; display: flex; flex-direction: column; gap: 7px; }
.tax-sub-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel);
}
.tax-sub-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tax-sub-name { font-size: .92rem; font-weight: 600; color: var(--ink); }
.tax-add { margin-top: 4px; }

.tax-new {
  border: 1px dashed var(--line-2); border-radius: 14px; padding: 16px;
  background: color-mix(in srgb, var(--brand) 2%, var(--panel)); margin-top: 24px;
}
.tax-new-h { font-family: var(--serif); font-size: 1.1rem; margin: 0 0 12px; }
.tax-new .tax-form { position: static; width: 100%; box-shadow: none; border: none; padding: 0; background: transparent; }
@media (max-width: 640px) {
  .tax-field-head { flex-wrap: wrap; }
  .tax-subs { padding-left: 16px; }
  .tax-form { position: static; width: 100%; }
}

/* ============================================================
   VERIFICATION · apply (/verification/) + admin review
   ============================================================ */
.vr-form { margin-bottom: 28px; }
.vr-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.vr-kind input { position: absolute; opacity: 0; pointer-events: none; }
.vr-kind { display: block; cursor: pointer; }
.vr-kind.is-held { cursor: default; opacity: .6; }
.vr-kind-card {
  display: flex; flex-direction: column; gap: 7px; height: 100%;
  padding: 14px 15px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, background .15s;
}
.vr-kind:hover .vr-kind-card { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.vr-kind input:checked + .vr-kind-card {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 5%, var(--panel));
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.vr-kind-head { display: flex; align-items: center; gap: 8px; }
.vr-kind-label { font-weight: 600; font-size: .95rem; color: var(--ink); }
.vr-held { font-family: var(--mono); font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pos); }
.vr-kind-blurb { font-size: .8rem; line-height: 1.5; color: var(--muted); }

.vr-fields { display: flex; flex-direction: column; gap: 12px; }
.vr-label { display: block; font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.vr-select, .vr-textarea {
  width: 100%; box-sizing: border-box; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: .92rem; background: var(--panel); color: var(--ink);
}
.vr-select:focus, .vr-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.vr-textarea { resize: vertical; }

.vr-mine { margin-top: 8px; }
.vr-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); margin-bottom: 7px; font-size: .88rem;
}
.vr-row-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.vr-row-kind { font-weight: 600; color: var(--ink); }
.vr-row-wf { font-size: .82rem; }
.vr-row-note { font-size: .8rem; color: var(--muted); font-style: italic; flex-basis: 100%; }
.vr-row-date { font-family: var(--mono); font-size: .7rem; color: var(--muted); flex: none; }
.vr-status {
  flex: none; font-family: var(--mono); font-size: .62rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid;
}
.vr-status-pending  { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: color-mix(in srgb, var(--brand) 7%, var(--panel)); }
.vr-status-approved { color: var(--pos); border-color: #abefc6; background: #ecfdf3; }
.vr-status-rejected { color: var(--neg); border-color: #fecdca; background: #fef3f2; }

.vr-req .tax-field-head { border-bottom: none; }
.vr-req-who { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.vr-req-msg { margin: 8px 0 0; font-size: .9rem; color: var(--ink-2); line-height: 1.55; }
.vr-decide {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; border-top: 1px solid var(--line); background: var(--panel-2);
}
.vr-note { flex: 1 1 auto; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: .85rem; background: var(--panel); }
.vr-note:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.vr-reject { flex: none; }
.vr-history-h { margin-top: 26px; }
.pf-verified { vertical-align: 6px; }

/* Admin moderation buttons */
.btn-admin-del { color: var(--neg); border-color: #fecaca; }
.btn-admin-del:hover { background: #fef2f2; border-color: var(--neg); }
.cmt-del-form { margin-left: 4px; }
.cmt-del {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  font-family: var(--mono); font-size: .66rem; font-weight: 600;
  color: var(--muted); border-bottom: 1px dashed var(--line-2);
  transition: color .14s, border-color .14s;
}
.cmt-del:hover { color: var(--neg); border-bottom-color: var(--neg); }

/* ============================================================
   AI IMPORTER · /import/ — webpage → draft card, chat refinement
   ============================================================ */
.imp-nokey {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
  background: #fef3f2; border: 1px solid #fecdca; color: var(--neg); font-size: .9rem;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.imp-busy {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
  background: #eef2ff; border: 1px solid #c7d2fe; color: var(--brand); font-size: .9rem;
}
.imp-busy-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: none;
  animation: imp-pulse 1.1s ease-in-out infinite;
}
@keyframes imp-pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.imp-textarea {
  width: 100%; box-sizing: border-box; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; resize: vertical;
  font-family: inherit; font-size: .92rem; background: #fff; color: var(--ink);
}
.imp-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.imp-wait { font-size: .8rem; color: var(--brand); margin-right: auto; }
.tax-form-actions { align-items: center; gap: 12px; }
.imp-list-h { margin-top: 26px; }

/* Session page: full-width split — chat left, live preview right. */
.page-wide .container { max-width: none; }
.imp-session { max-width: 1640px; margin: 14px auto 30px; }
.imp-session-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.imp-session-title { font-family: var(--serif); font-size: 1.4rem; letter-spacing: -.005em; margin: 6px 0 4px; }
.imp-back {
  display: inline-block; margin-bottom: 4px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; color: var(--muted); text-decoration: none;
}
.imp-back:hover { color: var(--brand); }
.imp-session-src a { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.imp-session-actions { display: flex; align-items: center; gap: 9px; flex: none; padding-top: 6px; }

.imp-split { display: grid; grid-template-columns: minmax(330px, 2fr) 3fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .imp-split { grid-template-columns: 1fr; } }
.imp-col-h { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 10px; }
.imp-col-hint { font-family: var(--sans); font-size: .78rem; font-weight: 400; color: var(--muted); }

.imp-chat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 14px 16px;
  position: sticky; top: 72px; max-height: calc(100vh - 95px);
  display: flex; flex-direction: column;
}
.imp-chat-log { overflow-y: auto; flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.imp-msg { padding: 9px 12px; border-radius: 11px; max-width: 92%; }
.imp-msg-user { align-self: flex-end; background: color-mix(in srgb, var(--brand) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line)); }
.imp-msg-assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.imp-msg-who { display: block; font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.imp-msg-text { margin: 0; font-size: .88rem; line-height: 1.55; white-space: pre-wrap; }
.imp-chat-form { margin-top: 12px; }
.imp-chat-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.imp-lessons-form { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.imp-guidelink { font-size: .78rem; color: var(--muted); }

.imp-preview { min-width: 0; }
.imp-frame {
  width: 100%; height: calc(100vh - 150px); min-height: 540px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  box-shadow: var(--shadow);
}
/* Double-buffered preview: two stacked iframes; the fresh snapshot loads in
   the hidden one and crossfades in, so the page itself never flashes. */
.imp-frame-stack { position: relative; height: calc(100vh - 150px); min-height: 540px; }
.imp-frame-abs {
  position: absolute; inset: 0; height: 100%; min-height: 0;
  opacity: 0; pointer-events: none; transition: opacity .4s ease;
}
.imp-frame-abs.is-front { opacity: 1; pointer-events: auto; }
.imp-frame-placeholder { position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; }

/* Inline editor on draft cards (admin / author only) — hover any editable
   field to see a pencil affordance, click to open a textarea in place. */
.wf-edit-target {
  position: relative; cursor: text; border-radius: 8px;
  transition: background-color .15s ease, box-shadow .15s ease;
  outline-offset: 2px;
}
.wf-edit-target:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent); }
.wf-edit-target::after {
  content: "✎"; position: absolute; top: 4px; right: 6px;
  font-size: .75rem; color: var(--brand); opacity: 0;
  transition: opacity .15s ease; pointer-events: none;
}
.wf-edit-target:hover::after { opacity: .85; }
.wf-edit-flash { animation: wf-edit-flash 0.9s ease-out; }
@keyframes wf-edit-flash {
  0% { background: color-mix(in srgb, var(--brand) 22%, transparent); }
  100% { background: transparent; }
}
.wf-edit-shell {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--brand);
  border-radius: 10px; background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.wf-edit-input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; color: inherit;
  background: #fff; resize: vertical;
}
.wf-edit-input:focus { outline: none; border-color: var(--brand); }
.wf-edit-shell-mdblock .wf-edit-input { font-family: var(--mono); font-size: .9rem; line-height: 1.55; }
.wf-edit-shell-text .wf-edit-input { font-size: 1rem; }
/* Editing the H1 title: match the heading's typography so the input looks
   like an inline replacement, not a tiny popup. Also break the parent flex
   so the editor stretches to the full content width. */
.wf-edit-shell-h1 { width: 100%; flex: 1 1 100%; box-sizing: border-box; }
.wf-edit-input-h1 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 700;
  letter-spacing: -.005em; padding: 10px 14px;
}
/* While editing the title, give the headmain column 100% of its flex row
   so the editor stretches to the actual page width and the action buttons
   wrap to the next line. */
.imp-session-head.is-editing-title .imp-session-headmain { flex-basis: 100%; width: 100%; }
.imp-session-head.is-editing-title .imp-session-actions { width: 100%; justify-content: flex-end; }
.wf-edit-actions { display: flex; align-items: center; gap: 10px; }
.wf-edit-state { flex: 1 1 auto; font-size: .8rem; color: var(--muted); }

/* "StatsOtter is typing" bubble */
.imp-msg-typing .imp-msg-text { display: flex; align-items: center; gap: 9px; }
.imp-typing-note { font-size: .8rem; color: var(--muted); }
.imp-dots { display: inline-flex; gap: 4px; align-items: center; }
.imp-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  animation: imp-dot 1.2s ease-in-out infinite;
}
.imp-dots i:nth-child(2) { animation-delay: .18s; }
.imp-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes imp-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Guidelines editor */
.imp-doc-form { padding: 12px 14px; }
.imp-doc-textarea {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; resize: vertical;
  font-family: var(--mono); font-size: .8rem; line-height: 1.6;
  background: #fcfcfd; color: var(--ink); tab-size: 2;
}
.imp-doc-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.imp-doc-actions { margin-top: 9px; }

/* Footer */
.footer { margin-top: 40px; padding: 22px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* Sidebar edit history: one row per revision, click for detail. */
.tax-history .tax-head .inline-form { margin-top: 10px; }
.tax-rev-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr) 110px 90px;
  align-items: center; gap: 14px;
  padding: 11px 14px; margin-bottom: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  font-size: .88rem;
}
.tax-rev-when { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.tax-rev-label { font-weight: 600; color: var(--ink); text-decoration: none; }
.tax-rev-label:hover { color: var(--brand); }
.tax-rev-diff { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.tax-rev-who { font-family: var(--mono); font-size: .8rem; color: var(--muted); text-align: right; }
.tax-rev-current {
  justify-self: end; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  color: var(--brand); font-family: var(--mono); font-size: .68rem;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
@media (max-width: 760px) {
  .tax-rev-row { grid-template-columns: 1fr; gap: 6px; }
  .tax-rev-who { text-align: left; }
}

/* Knowledge document pages (view/edit/upload). */
.doc-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.doc-form { margin-top: 6px; }
.doc-actions { display: flex; align-items: center; gap: 12px; }
.doc-hint { flex: 1 1 auto; font-size: .8rem; color: var(--muted); }
.doc-errors ul { margin: 8px 0 0 18px; padding: 0; }
.doc-errors li { margin: 3px 0; }
.doc-readonly {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; font-size: .84rem; line-height: 1.6; overflow-x: auto;
  white-space: pre-wrap; word-break: break-word;
}
.doc-history-h { margin-top: 26px; }
.doc-upload-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.doc-file-label { cursor: pointer; }
.doc-template { margin-top: 22px; }
.doc-template summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.doc-template .doc-readonly { margin-top: 10px; }
.doc-dup .inline-form { display: flex; gap: 10px; margin-top: 10px; }
.doc-dup-line { margin: 6px 0 0; }

/* API-key section on Profile settings (outside the form, same card look). */
.api-key-section { margin-top: 18px; }
.api-key-section .hint { margin: 4px 0 12px; }

/* API-key page: lists + modal. */
.api-key-issued {
  margin-bottom: 22px; padding: 14px 16px;
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  border-radius: 12px;
}
/* "Not your LLM key" clarification callout in the header. Amber so it reads as
   a heads-up distinct from the brand-blue issued-key panel. */
.api-key-clarify {
  display: flex; gap: 10px; align-items: flex-start;
  /* Equal breathing room above and below — the 4px bottom margin let the
     "Active keys" heading sit too close under the box. */
  margin: 16px 0 18px; padding: 12px 14px;
  background: color-mix(in srgb, #f59e0b 9%, var(--panel));
  border: 1px solid color-mix(in srgb, #f59e0b 32%, var(--line));
  border-radius: 12px;
}
.api-key-clarify-mark { color: #b45309; font-size: 1rem; line-height: 1.5; flex: none; }
.api-key-clarify p { margin: 0; font-size: .86rem; line-height: 1.5; color: var(--ink-2); }
.api-key-clarify strong { color: var(--ink); }
.api-key-issued-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.api-key-issued-dot { color: var(--brand); font-size: .9rem; }
.api-key-issued-warn { color: var(--muted); font-size: .82rem; }
.api-key-list { margin-bottom: 22px; }
.api-key-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.api-key-list-head .form-section-title { margin: 0; }
.api-key-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center; gap: 14px;
  padding: 11px 14px; margin-bottom: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  font-size: .88rem;
}
.api-key-row-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.api-key-label { font-weight: 600; color: var(--ink); }
.api-key-mask { font-family: var(--mono); font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.api-key-meta { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.api-key-expired { color: var(--neg); font-weight: 600; }
.api-key-dead-list { opacity: .85; }
.api-key-row-dead { background: color-mix(in srgb, var(--panel) 92%, var(--ink) 8%); border-style: dashed; }
.api-key-row-dead .api-key-label { color: var(--muted); }
.api-key-x {
  width: 26px; height: 26px; padding: 0; line-height: 1;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); font-size: 1.1rem; cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.api-key-x:hover { color: var(--neg); border-color: var(--neg); background: #fef2f2; }
@media (max-width: 720px) {
  .api-key-row { grid-template-columns: 1fr; gap: 6px; }
  .api-key-list-head { flex-direction: column; align-items: flex-start; }
}

/* Site-wide centered modal (sd- prefix avoids any naming collisions). */
body.modal-open { overflow: hidden; }
.sd-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; }
.sd-modal[hidden] { display: none !important; }
.sd-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .48); backdrop-filter: blur(4px); }
.sd-modal-card {
  position: relative; width: 100%; max-width: 480px;
  background: var(--panel); border-radius: 16px; padding: 22px 24px 18px;
  box-shadow: 0 32px 80px -20px rgba(15, 23, 42, .45), 0 0 0 1px rgba(15, 23, 42, .05);
  animation: sdModalIn .22s cubic-bezier(.2, .8, .3, 1.05);
}
@keyframes sdModalIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.sd-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.sd-modal-head h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0; letter-spacing: -.005em; }
.sd-modal-x { background: none; border: 0; cursor: pointer; font-size: 1.55rem; line-height: 1; color: var(--muted); padding: 0 4px; }
.sd-modal-x:hover { color: var(--ink); }
.sd-modal-warn { display: block; margin: 4px 0 6px; font-size: .85rem; line-height: 1.6; }
.sd-modal-card .field { margin-top: 14px; }
.sd-modal-card .field + .field { margin-top: 18px; }
.sd-modal-opt { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.sd-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sd-pill {
  display: inline-flex; align-items: center; cursor: pointer;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: .85rem; color: var(--ink-2);
  letter-spacing: 0; text-transform: none; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}
.sd-pill input { position: absolute; opacity: 0; pointer-events: none; }
.sd-pill:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); color: var(--brand); }
.sd-pill:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  color: var(--brand); font-weight: 700;
}
.sd-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.compose-head-actions { display: flex; gap: 10px; align-items: center; flex: none; }

/* Account pages (allauth) — restrained, matches the rest of the forms. */
.auth-page { max-width: 460px; }
.auth-page .stacked-form { margin-top: 14px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: #fff; color: var(--ink); border: 1.5px solid var(--line);
  font-weight: 600; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.btn-google span { width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(#4285F4, #EA4335, #FBBC05, #34A853, #4285F4);
  color: #fff; font-weight: 800; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.btn-google:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: .8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.auth-alt { margin-top: 14px; font-size: .85rem; color: var(--muted); }

/* Auth pages: narrow centered variant + email-sent emoji + live password rules */
.auth-page.auth-narrow { max-width: 460px; }
.auth-page.auth-narrow h1 { margin: 6px 0 10px; }
.auth-page.auth-narrow p { color: var(--ink-2); line-height: 1.6; }
.auth-page .auth-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }
.auth-page .auth-hint { font-size: .82rem; color: var(--muted); }
.auth-page .form-actions { margin-top: 14px; }
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.pw-rules li {
  position: relative; padding-left: 23px; font-size: .82rem; color: var(--muted);
  transition: color .15s ease;
}
.pw-rules li::before {
  content: "○"; position: absolute; left: 5px; top: -1px; color: var(--line-2);
  font-size: .9rem; transition: color .15s ease;
}
.pw-rules li.is-pending { color: var(--ink-2); }
.pw-rules li.is-pending::before { content: "○"; color: var(--muted); }
.pw-rules li.is-ok { color: var(--pos); }
.pw-rules li.is-ok::before { content: "✓"; color: var(--pos); font-weight: 800; }

/* Inline checkbox row (e.g. "Remember me") — keep the box small & beside text */
.field-check {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: .9rem; font-weight: 500; color: var(--ink-2);
  text-transform: none; letter-spacing: 0; margin: 2px 0;
}
.field-check span { user-select: none; }
.stacked-form .field-check input[type=checkbox],
.stacked-form input[type=checkbox] {
  width: 18px; height: 18px; min-width: 18px; margin: 0; padding: 0;
  accent-color: var(--brand); box-shadow: none; border-radius: 5px;
  flex: none; background: #fff;
}

/* ============================================================
   THEME · QUIET — tech-data confident (body.theme-quiet)
   A calm professional look that doesn't lose the science feel:
   bright workspace + a dark navigation chrome, ONE precise accent
   (electric-cyan/indigo) for action, mono-numbers for stats, fine
   hairlines and intentional shadows for depth. Toggle off with
   SITE_THEME=classic in .env.
   ============================================================ */
body.theme-quiet {
  --bg: #eef1f8;                    /* clean cool paper */
  --panel: #ffffff;
  --panel-2: #eef1f7;
  --panel-3: #e3e8f2;
  --ink: #0b1424;                   /* deep slate */
  --ink-2: #2b3548;
  --muted: #6b7588;
  --line: #e2e6ee;
  --line-2: #c9d0dc;

  /* One accent. Used sparingly: primary buttons, active states, hover focus. */
  --brand: #2563eb;                 /* electric indigo-blue */
  --brand-2: #1e40af;
  --brand-glow: rgba(37, 99, 235, .14);
  --brand-tint: rgba(37, 99, 235, .07);

  /* Dark chrome (topbar / hero strip / data dashboards) */
  --chrome: #0e1424;
  --chrome-2: #161d31;
  --chrome-ink: #e7ecf6;
  --chrome-muted: #8993ab;

  --pos: #047857;
  --neg: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 1px rgba(11,20,36,.04), 0 1px 2px rgba(11,20,36,.05);
  --shadow-elev: 0 14px 36px -18px rgba(11,20,36,.22), 0 2px 6px rgba(11,20,36,.06);

  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(11,20,36,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11,20,36,.035) 1px, transparent 1px);
  background-size: 48px 48px;
  font-size: 15.5px;
  line-height: 1.6;
}

/* — A pale, drifting cool aurora. With backdrop-filter glass working
     (no zoom), this is what frosts THROUGH the cards and shows as slowly
     flowing colour. Kept light-blue/periwinkle and modest so the page
     stays clean while the motion is visible through the frost. — */
/* Faint static base tint — the lively motion lives in .bg-aurora below. */
body.theme-quiet::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% -5%, rgba(96,165,250,.05), transparent 70%),
    radial-gradient(60% 50% at 50% 105%, rgba(125,211,252,.045), transparent 70%);
}

/* ── "Otter" aurora: soft pale-blue blobs that bound and hop around the
   page independently (springy overshoot easing = lively, puppy-like),
   instead of one flat drift. Sits behind everything; the glass cards
   frost the motion as a blob passes behind them. ── */
body.theme-quiet .bg-aurora {
  display: block; position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
body.theme-quiet .bg-aurora span {
  position: absolute; border-radius: 50%;
  /* Less blur + smaller sizes (below) so each blob reads as a distinct
     bounding "otter", not one uniform haze. */
  filter: blur(50px); will-change: transform;
}
/* Springy overshoot easing gives the playful "Otter hop" — kept at a calm
   tempo and light colour so it's lively, not distracting. */
/* Springy overshoot easing = the playful "Otter hop"; the blobs roam the
   whole viewport (puppy bounding across the page). Colours kept very
   faint so all that motion doesn't tint the page blue. */
/* Five compact, distinct blobs — each reads as its own bounding puppy.
   Springy overshoot easing + the wide hoppy paths below = several otters
   bounding across the screen. Visible enough to register, small enough
   not to flood the page with blue. */
body.theme-quiet .bg-aurora span:nth-child(1) {
  width: 22vw; height: 22vw; left: -2%; top: -2%;
  background: radial-gradient(circle, rgba(59,130,246,.34), transparent 66%);
  animation: otter-bound-1 9.5s cubic-bezier(.5,-.45,.5,1.55) infinite;
}
body.theme-quiet .bg-aurora span:nth-child(2) {
  width: 19vw; height: 19vw; right: 0%; top: -2%;
  background: radial-gradient(circle, rgba(37,99,235,.32), transparent 66%);
  animation: otter-bound-2 12s cubic-bezier(.5,-.45,.5,1.55) infinite;
}
body.theme-quiet .bg-aurora span:nth-child(3) {
  width: 21vw; height: 21vw; left: 4%; bottom: -6%;
  background: radial-gradient(circle, rgba(99,102,241,.30), transparent 66%);
  animation: otter-bound-3 13.5s cubic-bezier(.5,-.45,.5,1.55) infinite;
}
body.theme-quiet .bg-aurora span:nth-child(4) {
  width: 20vw; height: 20vw; right: 2%; bottom: -4%;
  background: radial-gradient(circle, rgba(59,130,246,.32), transparent 66%);
  animation: otter-bound-4 10.5s cubic-bezier(.5,-.45,.5,1.55) infinite;
}
body.theme-quiet .bg-aurora span:nth-child(5) {
  width: 16vw; height: 16vw; left: 42%; top: 36%;
  background: radial-gradient(circle, rgba(37,99,235,.26), transparent 66%);
  animation: otter-bound-5 8.5s cubic-bezier(.5,-.45,.5,1.55) infinite;
}
/* Each path has little vertical "hops" (the y value dips up between
   steps) so the blob springs along like a trotting puppy, not a smooth
   glide. Kept short in range + faint in colour so it stays ambient. */
/* Wide paths (puppy bounding across the whole viewport) with little
   vertical hops between steps for the springy trot. */
@keyframes otter-bound-1 {
  0%,100% { transform: translate(0,0) scale(1); }
  20% { transform: translate(28vw, -10vh) scale(1.1); }
  40% { transform: translate(58vw, 22vh)  scale(.9); }
  60% { transform: translate(86vw, -8vh)  scale(1.08); }
  80% { transform: translate(40vw, 30vh)  scale(.94); }
}
@keyframes otter-bound-2 {
  0%,100% { transform: translate(0,0) scale(1); }
  20% { transform: translate(-26vw, -12vh) scale(1.09); }
  40% { transform: translate(-56vw, 24vh)  scale(.9); }
  60% { transform: translate(-84vw, -6vh)  scale(1.08); }
  80% { transform: translate(-38vw, 32vh)  scale(.94); }
}
@keyframes otter-bound-3 {
  0%,100% { transform: translate(0,0) scale(1); }
  20% { transform: translate(30vw, 10vh)   scale(1.08); }
  40% { transform: translate(60vw, -22vh)  scale(.9); }
  60% { transform: translate(90vw, 6vh)    scale(1.07); }
  80% { transform: translate(42vw, -28vh)  scale(.94); }
}
@keyframes otter-bound-4 {
  0%,100% { transform: translate(0,0) scale(1); }
  20% { transform: translate(-28vw, 12vh)  scale(1.07); }
  40% { transform: translate(-58vw, -22vh) scale(.9); }
  60% { transform: translate(-86vw, 6vh)   scale(1.08); }
  80% { transform: translate(-40vw, -30vh) scale(.94); }
}
@keyframes otter-bound-5 {
  0%,100% { transform: translate(0,0) scale(1); }
  20% { transform: translate(-40vw, -22vh) scale(1.1); }
  40% { transform: translate(34vw, -26vh)  scale(.88); }
  60% { transform: translate(48vw, 24vh)   scale(1.08); }
  80% { transform: translate(-34vw, 26vh)  scale(.92); }
}
/* Phones: the otter wash sits BEHIND the feed (z:0, like desktop). The cards are
   frosted glass (translucent + backdrop-blur, see the mobile .feed-card rule),
   so the bouncing blobs glow through the card surface; and chart images use
   mix-blend-mode: multiply, so the blobs also show through the figure's white
   areas. Blobs are bumped brighter/larger than desktop so they read clearly
   through the glass. */
@media (max-width: 1020px) {
  body.theme-quiet .bg-aurora {
    z-index: 0;                 /* BEHIND .page (z:1) — a background, not an overlay */
    pointer-events: none;
  }
  body.theme-quiet .bg-aurora span { filter: blur(40px); }
  body.theme-quiet .bg-aurora span:nth-child(1) {
    width: 38vw; height: 38vw;
    background: radial-gradient(circle, rgba(37,99,235,.66), transparent 66%);
  }
  body.theme-quiet .bg-aurora span:nth-child(2) {
    width: 34vw; height: 34vw;
    background: radial-gradient(circle, rgba(59,130,246,.62), transparent 66%);
  }
  body.theme-quiet .bg-aurora span:nth-child(3) {
    width: 36vw; height: 36vw;
    background: radial-gradient(circle, rgba(99,102,241,.58), transparent 66%);
  }
  body.theme-quiet .bg-aurora span:nth-child(4) {
    width: 32vw; height: 32vw;
    background: radial-gradient(circle, rgba(37,99,235,.62), transparent 66%);
  }
  body.theme-quiet .bg-aurora span:nth-child(5) {
    width: 30vw; height: 30vw;
    background: radial-gradient(circle, rgba(59,130,246,.58), transparent 66%);
  }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .bg-aurora span { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet::before { animation: none; }
}
body.theme-quiet .page, body.theme-quiet .footer { position: relative; z-index: 1; }
body.theme-quiet .topbar { position: relative; z-index: 50; }
body.theme-quiet .nav-menu-panel { z-index: 60; }

/* ── Topbar instrument readouts: small monospace dashboard chips
   sandwiched between the brand and the user nav, so the chrome reads
   like a control panel rather than a SaaS header. Glass-tinted to
   match the cards below. ── */
body.theme-quiet .topbar-readouts {
  display: inline-flex; align-items: center; gap: 14px;
  margin-right: 16px; padding-right: 16px;
  border-right: 1px solid rgba(11,20,36,.12);
}
body.theme-quiet .tb-readout {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 9px; border-radius: 7px;
  background: linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.4));
  border: 1px solid rgba(37,99,235,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 1px 2px rgba(30,58,138,.05);
  font-family: var(--mono); font-size: .64rem;
  letter-spacing: .14em; text-transform: uppercase;
  white-space: nowrap;
}
/* leading data-tick — a small glowing brand bar, like a channel indicator */
body.theme-quiet .tb-readout::before {
  content: ""; width: 2px; height: 11px; border-radius: 1px;
  background: linear-gradient(180deg, #3b82f6, #4f46e5);
  box-shadow: 0 0 6px rgba(59,130,246,.45);
}
body.theme-quiet .tb-readout-status { padding-left: 11px; }
body.theme-quiet .tb-readout-status::before { display: none; }
body.theme-quiet .tb-readout-k { color: var(--muted); }
body.theme-quiet .tb-readout-v {
  color: var(--ink);
  font-feature-settings: "tnum"; font-weight: 700;
  letter-spacing: .04em;
}
/* "LIVE · UPLINK" status chip — slightly highlighted with a pulsing
   green dot to signal real-time uplink. */
body.theme-quiet .tb-readout-status {
  background: rgba(52,211,153,.08);
  border-color: rgba(52,211,153,.24);
}
body.theme-quiet .tb-readout-status .tb-readout-k { color: #34d399; }
body.theme-quiet .tb-readout-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px rgba(52,211,153,.7);
  animation: tb-pulse 2.4s ease-in-out infinite;
}
@keyframes tb-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(52,211,153,.55); }
  50%      { box-shadow: 0 0 10px rgba(52,211,153,.95); }
}
/* Animated "signal bars" indicator for the live uplink chip — four small
   bars that rise + fall on staggered timings, like an audio EQ readout. */
body.theme-quiet .tb-signal {
  display: inline-flex; align-items: flex-end; gap: 2px;
  height: 11px;
}
body.theme-quiet .tb-signal i {
  display: block; width: 2px; height: 4px;
  background: #34d399; border-radius: 1px;
  box-shadow: 0 0 4px rgba(52,211,153,.55);
  transform-origin: bottom;
  animation: tb-signal-bar 1.1s ease-in-out infinite;
}
body.theme-quiet .tb-signal i:nth-child(1) { animation-delay: 0s; }
body.theme-quiet .tb-signal i:nth-child(2) { animation-delay: .15s; }
body.theme-quiet .tb-signal i:nth-child(3) { animation-delay: .3s; }
body.theme-quiet .tb-signal i:nth-child(4) { animation-delay: .45s; }
@keyframes tb-signal-bar {
  0%, 100% { transform: scaleY(.35); }
  50%      { transform: scaleY(2.4); }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .tb-readout-dot,
  body.theme-quiet .tb-signal i { animation: none; }
}

/* (Topbar corner brackets removed — they read as floating debris.
   The chrome's tech feel comes from the readout chips + the calm
   hairline divider, not decorative frame corners.) */

/* On narrower desktop widths drop the status chip first; on tablet drop
   the peers number; on phone hide the whole cluster (the topbar already
   gets compact rules elsewhere). */
@media (max-width: 1180px) {
  body.theme-quiet .tb-readout-status { display: none; }
}
@media (max-width: 980px) {
  body.theme-quiet .topbar-readouts .tb-readout:nth-child(2) { display: none; }
}
@media (max-width: 760px) {
  body.theme-quiet .topbar-readouts {
    display: none;
  }
}

/* — Links: ink by default, brand only on hover. No purple flood — */
body.theme-quiet a:not(.btn):not(.feed-src):not(.rail-link):not(.feed-card-link) { color: var(--ink-2); transition: color .12s; }
body.theme-quiet a:not(.btn):not(.feed-src):not(.rail-link):not(.feed-card-link):hover { color: var(--brand); }

/* — Mono numerals everywhere stats live (tech feel without visual noise) — */
body.theme-quiet .vote-score, body.theme-quiet .feed-likes-n,
body.theme-quiet .rail-count, body.theme-quiet .status-num,
body.theme-quiet .feed-cmts, body.theme-quiet .api-key-mask,
body.theme-quiet .api-key-meta { font-family: var(--mono); font-feature-settings: "tnum"; }

/* ──────────────── TOPBAR · dark navigation chrome ──────────────── */
body.theme-quiet .topbar {
  /* Frosted-glass navy chrome: translucent + backdrop blur so the feed
     softly blurs behind it on scroll (modern, premium). */
  background:
    repeating-linear-gradient(90deg, rgba(37,99,235,.045) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, rgba(255,255,255,.72) 0%, rgba(255,255,255,.54) 100%);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  backdrop-filter: saturate(150%) blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 1px 0 rgba(255,255,255,.75) inset, 0 10px 30px -22px rgba(30,58,138,.22);
}
/* Align the topbar inner row with the feed content below by reading from
   the SAME variables the feed page uses — including the zoom. Without the
   matching zoom the topbar (1760px) is wider than the zoomed feed (1408px
   visual), so the logo sits left of the rail. !important because the base
   .container rule's max-width has matching specificity in some cascades. */
body.theme-quiet .topbar-inner {
  /* Keep the topbar IDENTICAL on every page. The feed (widest page) sets
     --feed-page-max / --feed-page-px; other pages don't, so fall back to the
     same literals. Without this, detail/profile/auth pages dropped to the
     1200px .container width and the brand + readouts visibly "narrowed" when
     navigating off the feed. */
  max-width: var(--feed-page-max, 1620px) !important;
  padding: 0 var(--feed-page-px, 28px) !important;
}

/* The +Post button lives in the topbar as a normal .btn-post chip. The
   bottom-right floating slot is now owned by the StatsClaw chat FAB (CSS
   for it lives near the end of this file). */

/* Bottom edge of the bar: a single, calm hairline. (The animated cyan
   scanline was removed — it read as gaudy.) */
body.theme-quiet .topbar::after {
  display: block; height: 1px; opacity: 1; border: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(37,99,235,.0) 8%, rgba(37,99,235,.5) 22%, rgba(99,102,241,.6) 50%, rgba(37,99,235,.5) 78%, rgba(37,99,235,0) 92%, transparent 100%);
  background-size: 240% 100%;
  animation: tb-scan 9s linear infinite;
}
@keyframes tb-scan { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { body.theme-quiet .topbar::after { animation: none; background-position: 50% 0; } }
body.theme-quiet .brand, body.theme-quiet .brand-name { color: var(--ink); }
/* "Otter" picks up a soft cyan gradient — a small typographic detail that
   reads as premium, never neon. */
body.theme-quiet .brand-name-acc {
  background: linear-gradient(180deg, #3b82f6 0%, #4f46e5 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.theme-quiet .brand-mark {
  /* A holographic chip: navy plate with a subtle cyan-blue gradient
     inside and a hairline rim. Hover lifts a faint glow. */
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(125,211,252,.22), transparent 60%),
    linear-gradient(180deg, #1e3a8a, #16213f);
  color: #bae6fd;
  border: 1px solid rgba(147,197,253,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 0 0 1px rgba(96,165,250,.05);
  transition: box-shadow .3s ease, border-color .25s ease;
}
body.theme-quiet .brand:hover .brand-mark {
  border-color: rgba(147,197,253,.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 0 16px -4px rgba(96,165,250,.45);
}
/* When the mascot image is present, swap the navy σ chip for a soft white
   tile so the otter's dark outline and blue hood read on the dark topbar. */
body.theme-quiet .brand-mark:has(.brand-logo-img) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
body.theme-quiet .brand:hover .brand-mark:has(.brand-logo-img) {
  box-shadow: none; transform: translateY(-1px);
}
/* Mono small-caps tagline — instrument label detail (no sci-fi noise).
   The ::after appends a precise build/version tag like a lab software
   readout ("CAUSAL INFERENCE WORKFLOWS  v0.1 · BETA"). */
body.theme-quiet .brand-tag {
  color: var(--muted);
  font-family: var(--mono); font-size: .62rem; letter-spacing: .18em; text-transform: uppercase;
  display: inline-flex; align-items: baseline; gap: 10px;
}
body.theme-quiet .brand-tag::after {
  content: "v0.1 · BETA";
  padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 3px;
  color: var(--brand); letter-spacing: .14em; font-size: .58rem;
}
/* Thin vertical hairline before the right nav, like a panel rule on a
   control surface. Keep margin-left: auto (set by the base .nav-right
   rule) so the nav stays pushed to the far right — overriding it
   clusters the whole bar on the left. */
body.theme-quiet .nav-right { position: relative; padding-left: 16px; }
body.theme-quiet .nav-right::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 22px;
  background: linear-gradient(180deg, transparent, rgba(11,20,36,.14), transparent);
}
/* !important required: the generic theme rule
   `body.theme-quiet a:not(.btn):not(.feed-src)...{ color: var(--ink-2) }` has
   higher specificity (0,6,1) than .topbar a (0,3,1) and was painting
   "Log in" dark slate on dark navy = unreadable. */
body.theme-quiet .topbar a:not(.btn) { color: var(--ink-2) !important; }
/* !important is required: a generic theme rule
   `body.theme-quiet a:not(.btn):not(.feed-src)...:hover { color: var(--brand) }`
   has higher specificity (0,6,2) than `.topbar a:not(.btn):hover` (0,4,2)
   and would push the trigger text to blue — which disappears against the
   dark navy chrome. Force it light. */
body.theme-quiet .topbar a:not(.btn):hover { color: var(--brand) !important; }
body.theme-quiet .topbar .nav-menu-trigger:hover .nav-menu-name,
body.theme-quiet .topbar .nav-menu-trigger:hover .nav-menu-caret { color: var(--brand) !important; }
/* The base sets `.nav-menu-trigger:hover { background: #f3f4f6 }` (a light
   gray meant for the light theme). On the dark navy bar the white-on-hover
   text disappears against that light pill. Override to a translucent
   highlight that works on dark chrome. */
body.theme-quiet .topbar .nav-menu-trigger:hover {
  background: rgba(37,99,235,.08);
}
/* Peers readout removed per request — too "dashboard". */
body.theme-quiet .status-peers { display: none; }
/* Generic status pill kept neutral in case it's used elsewhere. */
body.theme-quiet .status-pill {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); color: var(--chrome-ink);
}
body.theme-quiet .status-pill .status-num { color: var(--chrome-ink); }
body.theme-quiet .status-pill .status-label { color: var(--chrome-muted); }
body.theme-quiet .status-orb { background: #34d399; box-shadow: none; }
body.theme-quiet .nav-menu-name { color: var(--ink-2); }
body.theme-quiet .nav-menu-caret { color: var(--muted); }
body.theme-quiet .nav-menu-panel { background: #fff; box-shadow: 0 18px 50px -16px rgba(11,20,36,.40), 0 2px 6px rgba(11,20,36,.10); }
/* The dropdown panel sits inside .topbar — and the topbar rule
   `body.theme-quiet .topbar a:not(.btn) { color: var(--chrome-ink) !important }`
   (specificity 0,3,2, !important) was painting the panel's <a> items in
   chrome-ink (a light colour intended for the dark topbar bg), making them
   near-invisible on the dropdown's white background. <button class="linklike">
   Log out wasn't an <a>, so it stayed dark and looked correct.
   Scope this override THROUGH .topbar so it ties on specificity (0,3,2) and
   wins on later source order. */
body.theme-quiet .topbar .nav-menu-panel a,
body.theme-quiet .nav-menu-panel .linklike { color: var(--ink) !important; }
body.theme-quiet .topbar .nav-menu-panel a:hover,
body.theme-quiet .nav-menu-panel .linklike:hover {
  color: var(--ink) !important; background: rgba(37,99,235,.08);
}

/* ──────────────── BUTTONS · precise CTA, neutral rest ──────────────── */
body.theme-quiet .btn {
  border-radius: 8px; transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
body.theme-quiet .btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border: 1px solid #1d4ed8; color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 4px 12px -10px rgba(37,99,235,.4);
}
/* +Post in the topbar: ghost chip on the dark chrome. Specificity 0,3,1
   so it beats any later .btn-primary/.btn-post rules in this file. */
body.theme-quiet .topbar .btn-post {
  height: 30px; padding: 0 16px;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  border: 1px solid #1d4ed8;
  border-radius: 999px;
  font-weight: 600; font-size: .85rem; letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px -10px rgba(37,99,235,.5);
  transition: background .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
body.theme-quiet .topbar .btn-post:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
  transform: translateY(-1px);
  color: #fff;
}
/* Slim the topbar Post button so it lines up with the @username trigger
   pill (the base .btn-post hardcodes height: 34px which made it the tallest
   thing in the bar). */
body.theme-quiet .topbar .btn-post {
  height: 28px; padding: 0 12px; font-size: .84rem; font-weight: 600;
}
body.theme-quiet .btn-primary:hover, body.theme-quiet .btn-post:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 10px 24px -8px rgba(37,99,235,.65);
}

/* ──────────────── TYPOGRAPHY · serif heads + tighter tracking ──────────────── */
body.theme-quiet h1, body.theme-quiet h2 { letter-spacing: -.012em; }
body.theme-quiet .wf-kicker, body.theme-quiet .compose-kicker, body.theme-quiet .feed-snap-kicker {
  font-family: var(--mono); color: var(--muted); letter-spacing: .12em;
}

/* ──────────────── LEFT RAIL · clearer hierarchy ──────────────── */
body.theme-quiet .leftrail { background: transparent; border-right: 1px solid var(--line); }
body.theme-quiet .leftrail::before { display: none; }
body.theme-quiet .rail-heading { color: var(--muted); font-weight: 700; }
body.theme-quiet .rail-link { color: var(--ink-2); border-radius: 7px; }
body.theme-quiet .rail-link:hover { background: var(--brand-tint); color: var(--brand); }
body.theme-quiet .rail-link.active {
  background: var(--brand-tint); color: var(--brand); font-weight: 700;
  box-shadow: inset 2px 0 0 var(--brand);
}
body.theme-quiet .rail-link.active::after { background: var(--brand); }
body.theme-quiet .rail-count { color: var(--muted); background: var(--panel-2); border-radius: 4px; padding: 1px 6px; }

/* ──────────────── FEED · grouped, scannable, layered ──────────────── */
/* The card's box-shadow / background / border are owned by the glass
   block ~150 lines below — DON'T re-declare them here or the glass dies.
   This block only sets the layout transition. */
body.theme-quiet .feed-card {
  border-radius: 14px;
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .25s, border-color .18s, background .25s;
}
body.theme-quiet .feed-grid.js-masonry .feed-card:hover {
  transform: translate3d(var(--x,0), var(--y,0), 0) translateY(-3px);
}
/* (Legacy ".feed-card::before { display: none }" removed — the
   is-feat indigo stripe it suppressed never rendered anyway, and the
   rule was killing the glass card's top-edge specular highlight, which
   also lives on ::before.) */

/* top bar inside card: source pill + tag chips, with a hairline below */
body.theme-quiet .feed-topbar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
body.theme-quiet .feed-src {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  font-family: var(--mono); font-size: .72rem; padding: 3px 8px; border-radius: 4px; font-weight: 600;
}
body.theme-quiet .feed-src:hover { border-color: var(--brand); color: var(--brand); }
body.theme-quiet .feed-tag-chip {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-size: .7rem; padding: 2px 8px; border-radius: 999px; font-weight: 500;
}
/* cover area: clean frame, lighter scrim */
body.theme-quiet .feed-cover { border-bottom: 1px solid var(--line); background: var(--panel); }
body.theme-quiet .feed-cover-scrim { background: linear-gradient(to top, rgba(11,20,36,.05), transparent 35%); }

/* body grouped: title block (h2 + summary) clearly separated from foot via spacing */
body.theme-quiet .feed-card-main { padding: 16px 18px 14px; }
body.theme-quiet .feed-card-title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; margin: 0 0 7px; letter-spacing: -.005em; }
body.theme-quiet .feed-card-title a { color: var(--ink); }
body.theme-quiet .feed-card:hover .feed-card-title a { color: var(--brand); }
body.theme-quiet .feed-card-summary { color: var(--ink-2); font-size: .9rem; line-height: 1.55; margin: 0; }

/* foot: two clear groups (author / stats) separated, mono numerals */
body.theme-quiet .feed-card-foot {
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line);
  font-size: .78rem; color: var(--muted);
}
body.theme-quiet .feed-author-name { color: var(--ink-2); font-weight: 500; }
body.theme-quiet .feed-likes .heart { color: #f59e0b; }       /* star = warm */
body.theme-quiet .feed-cmts { color: var(--muted); }
body.theme-quiet .feed-cmts .cmt-mark { color: var(--brand); }

/* filterbar / sort: precise, tab-like */
body.theme-quiet .feed-filterbar { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 18px; }
/* Theme-quiet variant: keep the pill shape, just match the theme's slightly
   bolder type. !important is required for `color` because the broader
   body.theme-quiet a:not(.btn):not(.feed-src):not(.rail-link):not(.feed-card-link)
   rule (specificity 0,5,2) otherwise wins on selector count. */
body.theme-quiet .feed-sort a { font-weight: 700; font-size: .68rem; letter-spacing: .04em; color: var(--muted) !important; }
body.theme-quiet .feed-sort a.active { color: var(--brand) !important; }
body.theme-quiet .feed-sort a:hover { color: var(--brand) !important; }

/* Filter-row pills as frosted glass — match the search bar + cards so the
   whole row reads as one glass family floating over the page/aurora. */
body.theme-quiet .feed-sel-all,
body.theme-quiet .feed-sel-chip,
body.theme-quiet .feed-sort a {
  background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.30) 100%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%);
          backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255,255,255,.72) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    0 6px 16px -13px rgba(30,58,138,.3);
}
/* Active sort / selected-field chip keep a brand-blue glass tint. */
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-chip {
  background: linear-gradient(180deg, rgba(191,219,254,.55) 0%, rgba(191,219,254,.30) 100%) !important;
  border-color: rgba(125,211,252,.78) !important;
}
body.theme-quiet .feed-sort a:hover {
  border-color: rgba(125,211,252,.6) !important;
}

/* ──────────────── DETAIL · clear vertical rhythm, science feel ──────────────── */
body.theme-quiet .detail { background: transparent; box-shadow: none; }
body.theme-quiet .detail::before { display: none; }
body.theme-quiet .wf-detail .detail-head h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -.015em; }
body.theme-quiet .ai-summary {
  background: linear-gradient(180deg, var(--brand-tint), transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 14px;
}
body.theme-quiet .ai-summary-mark {
  background: linear-gradient(135deg, var(--brand), #6d28d9); color: #fff;
  box-shadow: 0 4px 14px -4px rgba(37,99,235,.5);
}
/* Mascot badge: white disc so the otter reads, keeping the blue glow ring. */
body.theme-quiet .ai-summary-mark:has(> img) {
  background: #fff;
  box-shadow: 0 4px 14px -4px rgba(37,99,235,.5), inset 0 0 0 1px rgba(37,99,235,.18);
}
body.theme-quiet .io-block { border-color: var(--line); margin-bottom: 28px; }
body.theme-quiet .io-step-num {
  background: var(--chrome); color: #fff; font-family: var(--mono); font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(11,20,36,.4);
}
body.theme-quiet .io-label { letter-spacing: -.008em; }
body.theme-quiet .wf-node, body.theme-quiet .pipe-detail { border-color: var(--line); }

/* ──────────────── BADGES & chips: keep semantic colour, calmer hues ──────────────── */
body.theme-quiet .badge {
  background: var(--panel-2); border-color: var(--line); color: var(--ink-2);
  border-radius: 5px; font-family: var(--mono); font-size: .7rem; letter-spacing: .04em;
}
body.theme-quiet .feed-badge { font-family: var(--mono); font-weight: 700; }

/* Left rail — same glass treatment as the feed cards (translucent +
   backdrop blur + saturate so the bounding otters show THROUGH the rail
   too, plus a brand-blue radiance halo around the panel). */
body.theme-quiet .feed-rail {
  background:
    linear-gradient(180deg,
      rgba(255,255,255,.72) 0%,
      rgba(255,255,255,.36) 12%,
      rgba(255,255,255,.20) 100%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(150%);
          backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid rgba(255,255,255,.85) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.5),
    0 1px 2px rgba(11,20,36,.04),
    0 0 60px -12px rgba(37,99,235,.10),
    0 0 150px -34px rgba(59,130,246,.08),
    0 28px 56px -32px rgba(30,58,138,.26) !important;
}
/* Compact-mode rail keeps the glass; the header band loses its solid
   tint so the frost runs unbroken from top to bottom. */
body.theme-quiet .feed-rail-head {
  background: transparent !important;
  border-bottom-color: rgba(255,255,255,.4) !important;
}

/* Compact rail: head-text + collapse are hidden but still in the flex
   row. head-text has flex-grow:1 (expands) AND the head has gap:6px
   (offsets the button even when neighbours are 0-width). Force the
   hidden items to take no space AND zero the head's gap, so the expand
   button is the only thing in a centered row → it sits exactly above
   the dot column. */
body.theme-quiet .feed-rail.is-compact .feed-rail-head {
  gap: 0 !important; justify-content: center !important;
}
body.theme-quiet .feed-rail.is-compact .feed-rail-head-text,
body.theme-quiet .feed-rail.is-compact .feed-rail-collapse {
  display: none !important;
}

/* ──────────────── SEARCH bar — HUD / instrument-panel ─────────────
   Glass-frosted body with a lead magnifier glyph, a mono "QUERY:" cue,
   four cyan corner brackets (the sci-fi HUD detail), and a refined
   focus state. Reads like a control surface, not a SaaS input. */
body.theme-quiet .feed-search {
  position: relative;
  align-items: center !important;  /* every glyph/text sits on one line */
  background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.30) 100%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
          backdrop-filter: blur(22px) saturate(145%);
  border: 1px solid rgba(255,255,255,.7) !important;
  border-radius: 14px !important;
  padding: 4px 4px 4px 14px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.4),
    0 1px 2px rgba(11,20,36,.04),
    0 14px 32px -22px rgba(30,58,138,.22);
  transition: box-shadow .25s ease, border-color .25s ease;
}
/* Four cyan-blue corner brackets — sci-fi HUD detail. Built with two
   overlaid linear-gradients clipped at corners; very subtle at rest,
   brighter on focus-within. */
/* (Corner brackets removed — they read as detached debris on the bar.
   The search bar's identity now comes from the glass shell + lead
   magnifier + mono QUERY: cue.) */
body.theme-quiet .feed-search:focus-within {
  border-color: rgba(125,211,252,.85) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.5),
    0 0 0 4px rgba(59,130,246,.14),
    0 0 24px -4px rgba(59,130,246,.30),
    0 14px 32px -22px rgba(30,58,138,.30);
}
/* All three text elements (lead glyph, QUERY: cue, input) share the
   same mono font, size, and letter-spacing so they read as one
   continuous readout — no jarring scale break between the label and
   the text. */
body.theme-quiet .feed-search-lead {
  flex: none; color: #60a5fa; line-height: 1;
  font-family: var(--mono); font-size: .92rem; font-weight: 600;
  margin-right: 8px;
}
body.theme-quiet .feed-search-prompt {
  flex: none; color: var(--muted); line-height: 1;
  font-family: var(--mono); font-size: .92rem; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; margin-right: 8px;
}
/* Input: no inner box (the legacy theme-quiet input rule added a panel
   + border + radius on focus). Force them off. Same size/font as the
   prompt so the whole readout reads as one line of mono text. */
body.theme-quiet .feed-search input[type=search],
body.theme-quiet .feed-search input[type=search]:focus {
  background: transparent !important; border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important; outline: none !important;
  font-family: var(--mono); font-size: .92rem; letter-spacing: .01em;
  line-height: 1.4;
}
body.theme-quiet .feed-search input::placeholder {
  font-family: var(--mono); color: var(--muted); letter-spacing: .02em;
}
/* Search button: match the cyan-blue brand (was using the old indigo
   --cta variable, which read purple). Same gradient family as the FAB. */
body.theme-quiet .feed-search button {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%) !important;
  border: 1px solid rgba(186,230,253,.55) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    0 6px 14px -6px rgba(37,99,235,.45);
  transition: background .2s ease, box-shadow .25s ease, transform .2s ease;
}
body.theme-quiet .feed-search button:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 55%, #6366f1 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.32),
    0 10px 20px -6px rgba(37,99,235,.55),
    0 0 0 4px rgba(96,165,250,.16);
}
@media (max-width: 560px) {
  /* On phones drop the prompt cue to save width. */
  body.theme-quiet .feed-search-prompt { display: none; }
  body.theme-quiet .feed-search { padding-left: 12px !important; }
}

/* Style search-like inputs elsewhere on the site (e.g. left-rail
   search) but NOT the feed search bar — that one gets its own glass
   look above. We can't use a descendant `:not(.feed-search input)`
   because :not() only accepts simple selectors; instead, only target
   the explicit .search-input class, which the feed bar doesn't use. */
body.theme-quiet .search-input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
body.theme-quiet input:focus, body.theme-quiet textarea:focus, body.theme-quiet select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px var(--brand-glow) !important;
}

/* ============================================================
   THEME · QUIET — uniform CSS-GRID gallery, large image-first card
   The eye reads pictures faster than text — make each card feel like
   a beautiful figure on a page, regularly aligned, equal height, with
   a clean text plate below. Grid replaces masonry in this theme so
   nothing wobbles; classic theme still uses masonry.
   ============================================================ */

/* Background: keep only a hint of grid */
body.theme-quiet { background-size: 64px 64px; background-image:
  linear-gradient(to right, rgba(11,20,36,.022) 1px, transparent 1px),
  linear-gradient(to bottom, rgba(11,20,36,.022) 1px, transparent 1px); }

/* Switch the feed to a regular CSS Grid: 3 / 2 / 1 columns, equal-height rows */
body.theme-quiet .feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;       /* every card in a row gets the same height */
  gap: 26px;
  height: auto !important;   /* override masonry height stash */
}
@media (max-width: 1020px) { body.theme-quiet .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* On the narrow (≤1020px) JS flex-masonry the cards are arranged by JS AFTER
   first paint, so without this they visibly flip from a plain stack into
   balanced columns ("the cards refreshing"). Keep the grid hidden until the
   one-shot placement is done (JS removes .is-settling right after it). Desktop
   (>1020px, pure CSS grid) is never hidden. Fail-safe: if JS never runs, the
   animation reveals the grid at 2.5s so a no-JS visitor still sees the feed.
   Reveal is INSTANT (no opacity transition): the cards are already in their
   final positions when .is-settling is removed, so they just appear — no fade,
   which on a slow link read as the feed "refreshing" in. */
@media (max-width: 1020px) {
  body.theme-quiet .feed-grid.is-settling {
    opacity: 0;
    animation: feedSettleReveal .01s linear 2.5s forwards;
  }
}
@keyframes feedSettleReveal { to { opacity: 1; } }
/* The JS flex-masonry now runs across the WHOLE 2-column range (≤1020), not
   just phones. Without this, large phones / small tablets (641–1020px) fell
   into the plain 2-col grid where grid-auto-rows:1fr stretched every card to
   its row's tallest sibling, leaving whitespace under the shorter card's
   footer. These structural rules apply wherever the JS adds .feed-grid-mason;
   the ≤640 block later overrides gap/padding for the tight phone look. */
@media (max-width: 1020px) {
  body.theme-quiet .feed-grid.feed-grid-mason {
    display: flex; flex-direction: row; align-items: flex-start;
    grid-template-columns: none; grid-auto-rows: auto; gap: 18px;
    background: transparent;
  }
  body.theme-quiet .feed-grid-col {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; gap: 18px;
  }
}
/* Phones: tightly-packed two-column card feed.
   - Edge-to-edge page (almost no side padding) so cards fill the screen.
   - Tight gutter between cards (6-8px).
   - Cover is the dominant element; titles tight; no description.
   - Drop the card glass radiance halo (gets clipped by neighbours at
     this density) and use a cleaner thin border so cards read crisply
     side-by-side. */
/* Desktop web: keep the top chrome pinned while the feed scrolls (same intent
   as mobile). The topbar is sticky at the very top; the search bar and the
   "All fields / POPULAR / NEWEST" filter row stick directly beneath it, so
   search + sort stay reachable through the whole waterfall. Scoped to the feed
   page (body.body-feed) so other pages keep their normal flow. The two rows get
   a frosted-glass surface so the cards scroll behind them legibly. */
@media (min-width: 641px) {
  body.body-feed .topbar { position: sticky; top: 0; z-index: 50; }
  /* No "hood" panel. The bar bg starts as the exact page colour at the top and
     FADES to transparent at its bottom edge — there's no hard seam, just the
     cards emerging from behind the search/filter as you scroll. The opaque top
     still covers the cards that scroll right under the search box and labels;
     the soft tail at the bottom dissolves into the feed. */
  /* Keep the bouncing aurora ON for the desktop/tablet feed too — the glass
     feed cards (translucent + backdrop-blur) are built to light up as a blob
     passes behind them, the same lively motion phones already show. */
  /* No backing band behind the search row — let the rounded glass search
     bar float over the page/aurora on its own. (The bar's own backdrop-blur
     frosts any cards that scroll up behind it.) */
  body.theme-quiet.body-feed .feed-head {
    position: sticky; top: 66px; z-index: 12;
    padding: 10px 0 14px; margin-bottom: 0;
    background: transparent;
  }
  /* No background on the filterbar — the horizontal gap between "All fields"
     and "POPULAR / NEWEST" used to show the bar's grey filling, which read as a
     meaningless gray band stretched across the row. Transparent means the
     labels just sit on the page; the search bar above still has its own bg. */
  body.theme-quiet.body-feed .feed-filterbar {
    position: sticky; top: 132px; z-index: 11;
    padding: 6px 0; margin-bottom: 0;
    background: transparent;
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  /* TRUE masonry on phones via JS-managed flex columns. CSS columns
     was buggy on iOS (cards split across columns / right column empty
     at the top). The JS in feed.html now creates two .feed-grid-col
     children of .feed-grid and distributes cards into them. */
  /* Sticky search bar + filter row on mobile: they pin to the bottom of the
     fixed topbar (h:66) so the user keeps search/sort within reach while the
     feed scrolls behind them. Both get the same frosted-glass surface as the
     cards so the otter wash + scrolling figures show through softly. Negative
     side margins counter the .body-feed page padding so the glass spans the
     full viewport width (no white side bands). */
  body.theme-quiet .feed-head {
    position: sticky !important; top: 66px !important; z-index: 12;
    margin: 0 -9px !important; padding: 8px 12px 6px !important;
    background: rgba(255,255,255,.62) !important;
    -webkit-backdrop-filter: blur(18px) saturate(150%);
            backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid rgba(11,20,36,.06);
  }
  body.theme-quiet .feed-filterbar {
    position: sticky !important; top: 130px !important; z-index: 11;
    margin: 0 !important; padding: 6px 0 !important;
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
            backdrop-filter: none !important;
    border-bottom: 0 !important;
  }
  /* Small page padding + gaps so the glass cards FLOAT and the otter wash shows
     through the margins and between them (not just through the glass). */
  body.body-feed { --feed-page-px: 9px; }
  body.theme-quiet .feed-grid.feed-grid-mason {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    grid-template-columns: none !important;
    gap: 9px !important;
    background: transparent !important;
  }
  body.theme-quiet .feed-grid-col {
    flex: 1 1 0; min-width: 0;
    display: flex !important; flex-direction: column !important;
    gap: 9px;
  }
  body.theme-quiet .feed-card {
    width: 100% !important;
    margin: 0 !important;
  }
  /* body.theme-quiet.body-feed (0,3,1) beats the desktop glass-card rule
     (0,2,1) so THIS frosted surface wins on phones. Translucent + backdrop-blur
     so the otter wash behind the page (z:0) clearly glows through the card; the
     chart images (mix-blend: multiply) also let it through their white areas. */
  body.theme-quiet.body-feed .feed-card {
    border-radius: 14px !important;
    border: 1px solid rgba(255,255,255,.65) !important;
    background: rgba(255,255,255,.42) !important;
    -webkit-backdrop-filter: blur(18px) saturate(150%) !important;
            backdrop-filter: blur(18px) saturate(150%) !important;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.75),
      0 4px 18px -8px rgba(30,58,138,.2) !important;
    /* Don't stretch the card to fill the grid row — let it size to its
       actual content (image + 2-line title + 1-line foot). Otherwise
       the .feed-card-main's flex:1 1 auto stretches and leaves blank
       space between title and footer / below footer. */
    align-self: start !important;
  }
  body.theme-quiet .feed-card-main {
    flex: 0 0 auto !important;   /* no stretch */
  }
  body.theme-quiet .feed-card::after { display: none !important; }

  /* Image is the hero — 3:4 portrait dominates the card, edge-to-edge,
     no inset margin/border. object-fit: cover so the plot fills the
     frame instead of being centred with whitespace around it (which
     made the visible plot look tiny). Slight loss of edge labels is
     the acceptable trade for a clearly readable figure. */
  body.theme-quiet .feed-topbar { display: none; }
  /* Cover height = the FIRST figure's natural aspect ratio (the carousel JS
     sets --cover-ar on the card from the first image). That gives the cover a
     DEFINITE height, which is the whole trick:
       • the first (visible) figure fills it exactly — shown in full, no crop,
         no letterbox, no white gap;
       • EVERY carousel slide is locked to that same height, so a taller later
         figure can't stretch the track and leave a gap (the old bug);
       • later figures with a different ratio are letterboxed (object-fit:
         contain) — shown in full — and the white letterbox blends into the
         white card.
     Swipeable carousel + dots restored so multi-figure cards are navigable. */
  body.theme-quiet .feed-cover {
    margin: 0 !important; border-radius: 0 !important;
    /* Heights VARY with each first image's natural aspect, but clamped to a
       narrow band (1.05–1.55) so the layout reads as "mostly uniform with
       gentle waterfall" rather than dramatically irregular. Outliers (very
       portrait / very wide charts) letterbox into the band — the letterbox is
       transparent so the glass + otter wash shows through it. */
    aspect-ratio: clamp(1.05, var(--cover-ar, 1.3), 1.55) !important;
    height: auto !important;
    border: 0 !important; box-shadow: none !important;
    background: transparent !important;
    overflow: hidden !important;
    position: relative;
  }
  body.theme-quiet .feed-cover.feed-carousel .feed-carousel-track {
    position: absolute !important; inset: 0 !important;
    display: flex !important; flex-direction: row !important;
    overflow-x: auto !important; overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    height: auto !important;
  }
  body.theme-quiet .feed-cover .feed-slide {
    position: static !important;
    flex: 0 0 100% !important; width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    display: block !important;
    overflow: hidden;
    scroll-snap-align: center;
  }
  body.theme-quiet .feed-cover .feed-slide img,
  body.theme-quiet .feed-cover > img {
    padding: 0 !important;
    width: 100% !important; height: 100% !important;
    display: block;
    object-fit: contain !important;
    /* drop the chart's white background/letterbox so the frosted glass + otter
       wash behind the card glow through the figure */
    mix-blend-mode: multiply !important;
  }
  /* Dots back (so multi-figure cards are navigable by swipe); arrows stay
     hidden — swipe is the mobile gesture. */
  body.theme-quiet .feed-cover .feed-car-dots { display: flex !important; }
  body.theme-quiet .feed-cover .feed-car-arrow { display: none !important; }
  /* Fallback panel (no figure): bounded height so text-only cards
     don't tower over image cards in the waterfall. */
  body.theme-quiet .feed-cover-snap { min-height: 120px !important; max-height: 180px; }
  /* Fallback cover panel (no figure / formula card): make summary +
     formula visibly fill the cover on mobile instead of just showing a
     tiny RESULT kicker on an otherwise blank tile. */
  body.theme-quiet .feed-cover-snap {
    padding: 10px 11px !important; gap: 6px !important;
    min-height: 0 !important;
    background: linear-gradient(180deg, #fff 0%, #f1f4fa 100%) !important;
  }
  body.theme-quiet .feed-cover-snap .feed-snap-kicker { font-size: .54rem !important; margin: 0 !important; }
  body.theme-quiet .feed-snap-summary {
    font-size: .7rem !important; line-height: 1.4 !important; margin: 0 !important;
    display: -webkit-box !important; -webkit-line-clamp: 10;
    -webkit-box-orient: vertical; overflow: hidden;
    color: var(--ink-2) !important;
  }
  body.theme-quiet .feed-snap-formula {
    overflow: hidden !important; white-space: normal !important;
    flex: 1 1 auto; align-items: center; justify-content: center;
  }
  body.theme-quiet .feed-snap-formula .katex {
    font-size: .8em !important; white-space: normal !important;
  }

  /* Text plate beneath the image: as tight as legible — author/stats
     row sits flush with the card's bottom edge (no padding below). */
  /* Tight text plate: title + author hug the figure, author row flush to the
     card's bottom edge (only 4px below it). */
  body.theme-quiet .feed-card-main { padding: 6px 9px 4px !important; gap: 0 !important; flex: 0 0 auto !important; }
  body.theme-quiet .feed-card-body { padding: 0; min-height: 0; flex: 0 0 auto; }
  body.theme-quiet .feed-card-summary { display: none !important; }
  body.theme-quiet .feed-card-title {
    font-size: .82rem !important; line-height: 1.32; font-weight: 600;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important;
    overflow: hidden !important; overflow-wrap: anywhere;
    /* Reserve two lines so 1- and 2-line titles give the same card height. */
    min-height: 2.64em;
    padding-bottom: 1px;
  }

  /* Footer: ONE compact horizontal line. Avatar + name truncates from
     the right; stars + comments pin to the right edge.
     All children get line-height:1 + center align so the ★/✎ glyphs,
     the digits, and the avatar share a single baseline (this was the
     source of the misaligned author / stats rows). */
  body.theme-quiet .feed-card-foot {
    display: flex !important; flex-direction: row !important;
    align-items: center !important; justify-content: space-between !important;
    /* Full padding shorthand: the desktop .feed-card-foot rule leaks a
       14px padding-BOTTOM (and 20px sides) onto mobile because the earlier
       rule only set padding-top. That 14px bottom pad — not any layout gap —
       is the big empty band under the author row. Zero it out; the card-main
       already supplies the side padding. */
    margin-top: 4px !important; padding: 3px 0 0 !important;
    border-top: 1px solid rgba(11,20,36,.05) !important;
    gap: 6px !important; font-size: .68rem;
    min-height: 18px !important;
  }
  body.theme-quiet .feed-card-foot > * { line-height: 1; }
  body.theme-quiet .feed-author {
    display: inline-flex !important; align-items: center !important; gap: 6px;
    min-width: 0; flex: 1 1 auto; line-height: 1;
  }
  body.theme-quiet .feed-ava {
    width: 16px !important; height: 16px !important; flex: none;
    display: inline-flex !important; align-items: center !important; justify-content: center;
    overflow: hidden; border-radius: 50%;
    line-height: 16px !important; vertical-align: middle !important;
  }
  /* The inline style on .avatar (set by the {% avatar %} tag with
     size=22) was making the inner circle 22px and bumping it visually
     off-axis from the @name + stats text. Force it to match the 16px
     wrapper so the avatar sits on the foot's baseline. */
  body.theme-quiet .feed-ava .avatar {
    width: 16px !important; height: 16px !important;
    font-size: 9px !important; line-height: 16px !important;
  }
  body.theme-quiet .feed-ava img { width: 100%; height: 100%; }
  body.theme-quiet .feed-author-name {
    font-size: .7rem; flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1;
  }
  body.theme-quiet .feed-badges { display: none; }
  body.theme-quiet .feed-stats {
    display: inline-flex !important; align-items: center !important;
    gap: 9px; flex: none; line-height: 1;
  }
  body.theme-quiet .feed-likes,
  body.theme-quiet .feed-cmts {
    display: inline-flex !important; align-items: center !important;
    gap: 3px; line-height: 1; font-size: .7rem;
  }
  body.theme-quiet .feed-likes .heart,
  body.theme-quiet .feed-cmts .cmt-mark { font-size: .78rem; line-height: 1; }

  .feed-filter-toggle { left: 12px; bottom: 14px; }
}

/* ============================================================
   THEME · QUIET — mobile polish
   At phone widths the topbar was wrapping ("Log in" -> two lines,
   tagline -> two lines) and the empty collapsed-rail strip ate
   vertical real estate. Tighten the chrome and hide secondary bits.
   ============================================================ */
@media (max-width: 640px) {
  /* Tighten topbar inner padding so the row has room (all pages, not just
     the feed — keeps the bar consistent on phones too). */
  body.theme-quiet .topbar-inner { padding: 0 12px !important; }
  body.theme-quiet .topbar-inner { gap: 10px; }
  /* Brand: smaller mark, drop the tagline + v0.1 BETA chip on phones —
     they don't read at this size and forced the row to wrap. */
  body.theme-quiet .brand-mark { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; }
  body.theme-quiet .brand-name { font-size: 1rem; }
  body.theme-quiet .brand-tag { display: none; }
  body.theme-quiet .brand-tag::after { display: none; }
  /* All topbar links/buttons must never wrap. */
  body.theme-quiet .topbar a, body.theme-quiet .topbar .btn { white-space: nowrap; }
  /* Slimmer Sign up / Log in buttons. */
  body.theme-quiet .topbar .btn-sm { padding: 6px 12px; font-size: .85rem; }
  /* Topbar fixed (sticky is fragile on mobile when ancestors clip) so
     it always stays visible while scrolling. Push the page below the
     bar's height. */
  body.theme-quiet .topbar {
    position: fixed !important; top: 0; left: 0; right: 0;
    z-index: 60;
  }
  /* Push every page below the fixed topbar (the previous version
     only padded body-feed, so detail / profile / auth pages had the
     bar covering their first row of content). */
  body.theme-quiet { padding-top: 60px; }
  /* The Fields drawer + scrim already account for the 56px topbar. */
  /* Left rail becomes a slide-in drawer (off-screen by default; opened
     via the floating Fields button). Full glass treatment retained.
     html.is-rail-open slides it in and dims the page with a scrim.
     Important: the drawer sits BELOW the sticky topbar (top: 60px)
     so its close × isn't hidden under the bar, and its height is
     bounded so its inner list actually scrolls. */
  body.theme-quiet .feed-rail,
  body.theme-quiet .feed-rail.is-compact {
    position: fixed; left: 0; top: 60px;
    height: calc(100vh - 60px); height: calc(100dvh - 60px);
    bottom: auto;
    width: min(82vw, 320px) !important; max-height: none;
    padding: 0 12px 14px !important;
    margin-top: 0; border-radius: 0 18px 18px 0;
    z-index: 80;
    transform: translateX(-110%);
    transition: transform .35s cubic-bezier(.22,.8,.25,1);
  }
  html.is-rail-open body.theme-quiet .feed-rail,
  html.is-rail-open body.theme-quiet .feed-rail.is-compact { transform: translateX(0); }
  /* Scrim covers everything from the bottom of the topbar down. */
  .feed-rail-scrim { top: 60px !important; }
  /* Lock background scroll while the drawer is open so the page doesn't
     pull underneath. */
  html.is-rail-open, html.is-rail-open body { overflow: hidden !important; }
  /* Drop the entire rail head on mobile (the "FIELDS · PICK ONE" band
     and any padding above it). The × close button floats absolutely
     over the top-right of the drawer, on the same visual line as the
     first list item ("All fields"). */
  body.theme-quiet .feed-rail .feed-rail-head,
  body.theme-quiet .feed-rail.is-compact .feed-rail-head {
    display: none !important;
  }
  body.theme-quiet .feed-rail .feed-rail-close {
    display: inline-grid !important; place-items: center;
    position: absolute; top: 10px; right: 10px; z-index: 5;
    width: 32px; height: 32px;
    background: rgba(125,211,252,.12); border: 1px solid rgba(125,211,252,.28);
    color: var(--ink-2); font-size: 1.3rem; line-height: 1;
    border-radius: 8px; cursor: pointer;
  }
  body.theme-quiet .feed-rail .feed-rail-close:hover { background: rgba(125,211,252,.2); color: var(--brand); }
  /* Pad the top of the first row so it doesn't sit under the × button
     (but they share the same horizontal line). */
  body.theme-quiet .feed-rail .feed-rail-cats { padding-top: 14px; }
  /* Compact-mode hid labels and squeezed cats into icon dots — undo
     all of that so users see real labels + counts in the drawer. */
  body.theme-quiet .feed-rail.is-compact .feed-rail-cat-name,
  body.theme-quiet .feed-rail.is-compact .feed-rail-cat-count,
  body.theme-quiet .feed-rail.is-compact .feed-rail-toggle {
    opacity: 1 !important; visibility: visible !important;
    width: auto !important; flex: initial;
  }
  body.theme-quiet .feed-rail.is-compact .feed-rail-subs { display: block !important; }
  body.theme-quiet .feed-rail.is-compact .feed-rail-cat {
    height: auto !important; padding: 11px 14px !important;
    pointer-events: auto !important; display: flex !important;
    position: relative; gap: 12px;
  }
  body.theme-quiet .feed-rail.is-compact .feed-rail-dot {
    position: static !important; transform: none !important;
  }
  /* Make the cats list the scrollable region. The drawer is a flex
     column: head is fixed-height, cats fills the rest and scrolls. */
  body.theme-quiet .feed-rail {
    display: flex !important; flex-direction: column !important;
    overflow: hidden !important;
  }
  body.theme-quiet .feed-rail .feed-rail-head { flex: 0 0 auto; }
  body.theme-quiet .feed-rail .feed-rail-cats {
    flex: 1 1 auto; min-height: 0; overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px; gap: 3px !important;
  }
  /* Floating "Filter" button (bottom-left) — only on mobile. */
  .feed-filter-toggle {
    position: fixed; left: 16px; bottom: 18px; z-index: 70;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 16px 11px 14px; border-radius: 999px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%);
    color: #fff; border: 1px solid rgba(186,230,253,.55);
    font-family: var(--sans); font-size: .9rem; font-weight: 600;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.28),
      0 10px 22px -8px rgba(37,99,235,.5);
    cursor: pointer;
  }
  .feed-filter-toggle-icon { font-size: 1.1rem; line-height: 1; }
  /* Backdrop scrim behind the open drawer. */
  .feed-rail-scrim {
    position: fixed; inset: 0; z-index: 75;
    background: rgba(11,20,36,.42);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: scrim-in .22s ease;
  }
  @keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
  /* Page padding tighter so cards reach the screen edges nicely. */
  body.body-feed { --feed-page-px: 14px; }
}
/* The filter toggle + scrim are mobile-only — keep them hidden everywhere
   else (the rail is right there on desktop, no toggle needed). */
.feed-filter-toggle { display: none; }
.feed-rail-scrim { display: none; }
@media (max-width: 640px) {
  .feed-filter-toggle { display: inline-flex; }
  .feed-rail-scrim[hidden] { display: none; }
  .feed-rail-scrim:not([hidden]) { display: block; }
}
/* Cards are normal grid children, not absolute-positioned masonry items */
body.theme-quiet .feed-grid .feed-card,
body.theme-quiet .feed-grid.js-masonry .feed-card {
  position: relative; left: auto; top: auto; transform: none !important;
  width: 100%; max-width: none; opacity: 1;
  margin: 0; flex: initial;
  display: flex; flex-direction: column;
}
body.theme-quiet .feed-grid.js-masonry .feed-card:hover { transform: translateY(-3px) !important; }
body.theme-quiet .feed-grid .feed-card.is-out { display: none !important; }

/* Card visuals — glassmorphism: a translucent panel with backdrop blur
   so the colourful gradient-mesh behind the page glows through. The
   background opacities are intentionally low — the saturated mesh above
   needs to reach the eye through the glass for the effect to read.
   A bright top inner highlight + outer brand-tinted bloom + crisp white
   rim simulates a beveled glass plate. */
/* GLASS cards (now that zoom is gone, backdrop-filter renders). The card
   is translucent + blurred so the drifting wash behind the page frosts
   through it; a bright top sheen baked into the gradient + a crisp white
   bevel rim give the beveled-glass read; a layered float shadow lifts it.
   !important defends the surface against legacy cascade rules. */
body.theme-quiet .feed-card {
  position: relative;
  border: 1px solid rgba(255,255,255,.85) !important;
  border-radius: 18px; overflow: hidden;
  background:
    linear-gradient(180deg,
      rgba(255,255,255,.72) 0%,
      rgba(255,255,255,.36) 12%,
      rgba(255,255,255,.20) 100%) !important;
  /* Moderate saturate (150% — stays blue, doesn't tip to cyan/green like
     210% did) concentrates a blob's colour as it passes behind the card,
     so the glass clearly "lights up" — the interaction the user liked. */
  -webkit-backdrop-filter: blur(40px) saturate(150%);
          backdrop-filter: blur(40px) saturate(150%);
  /* "radiate" — a wide soft brand-blue glow halo radiates outward from the
     card, so the glass reads as luminous and dispersing colour outward,
     not just sitting flat. */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.5),
    0 1px 2px rgba(11,20,36,.04),
    0 0 60px -12px rgba(37,99,235,.10),
    0 0 150px -34px rgba(59,130,246,.08),
    0 30px 60px -32px rgba(30,58,138,.24) !important;
  transition: transform .34s cubic-bezier(.2,.7,.3,1), box-shadow .34s, border-color .25s, background .25s;
}
/* Suppress the legacy "is-feat" indigo stripe on the top-3 cards. */
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-1::before,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-2::before,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-3::before {
  display: none !important;
}
body.theme-quiet .feed-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255,255,255,1) !important;
  background:
    linear-gradient(180deg,
      rgba(255,255,255,.86) 0%,
      rgba(255,255,255,.56) 12%,
      rgba(255,255,255,.40) 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.6),
    0 2px 4px rgba(11,20,36,.05),
    0 40px 80px -34px rgba(37,99,235,.34) !important;
}

/* Quiet top strip: just the source label, no tag chip wall */
body.theme-quiet .feed-topbar { padding: 12px 18px 0; background: transparent; border-bottom: none; }
body.theme-quiet .feed-topbar .feed-tag-chip { display: none; }
body.theme-quiet .feed-src {
  background: transparent; border: none; padding: 0; color: var(--muted);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
}
body.theme-quiet .feed-src:hover { color: var(--brand); }

/* THE FIGURE — a soft framed plate at a fixed, pleasant landscape ratio that
   scales with the card width (so cards keep their proportion, never go tall &
   skinny). Charts are contained, never cropped. */
body.theme-quiet .feed-cover {
  /* width:auto is required: the base rule sets width:100%, and with the
     14px side margins below that over-constrains the box, forcing
     margin-right:-14px — which pushes the cover 14px past the card edge
     where overflow:hidden clips its right border + image. auto lets both
     margins apply so the frame sits centered and fully inside the card. */
  margin: 10px 14px 0; width: auto; height: auto; aspect-ratio: 23 / 10;
  border: 1px solid rgba(255,255,255,.5); border-radius: 12px;
  /* Figure plate is glass too — transparent so the card's frosted surface
     (and the drifting wash) carry through the figure region. Aspect is
     wide/short (23:10) so the card stays wider than it is tall. */
  background: transparent;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}
/* Plot images have opaque white backgrounds covering ~half the card;
   mix-blend-mode: multiply drops the white out so the plot looks drawn
   directly on the glass (lines/labels stay dark), and the frosted wash
   shows through the plot's whitespace. */
body.theme-quiet .feed-cover .feed-slide img,
body.theme-quiet .feed-cover > img {
  mix-blend-mode: multiply;
}
body.theme-quiet .feed-cover .feed-carousel-track,
body.theme-quiet .feed-cover .feed-slide,
body.theme-quiet .feed-cover-snap { height: 100%; }
body.theme-quiet .feed-cover .feed-slide img,
body.theme-quiet .feed-cover > img {
  width: 100%; height: 100%; object-fit: contain; padding: 6px; box-sizing: border-box;
  background: #fff; transform: scale(1); transform-origin: center;
  transition: transform .55s cubic-bezier(.2,.7,.3,1);
  will-change: transform;
}
body.theme-quiet .feed-cover-scrim { display: none; }
body.theme-quiet .feed-cover-snap { height: 100%; box-sizing: border-box; padding: 22px; display: flex; flex-direction: column; }
body.theme-quiet .feed-cover-snap-formula {
  background: var(--panel-2);
  /* Centre the formula in the figure plate and let it scroll horizontally
     instead of wrapping into ugly multiple lines. */
  align-items: stretch; justify-content: center;
}
body.theme-quiet .feed-cover-snap-formula .feed-snap-kicker { margin-bottom: 14px; }
body.theme-quiet .feed-snap-formula {
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  overflow-x: auto; overflow-y: hidden;
  white-space: nowrap; padding: 0 4px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
body.theme-quiet .feed-snap-formula::-webkit-scrollbar { height: 4px; }
body.theme-quiet .feed-snap-formula::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
body.theme-quiet .feed-snap-formula .katex { font-size: 1em; white-space: nowrap; }
body.theme-quiet .feed-snap-formula .katex-display { margin: 0; }

/* Text plate below: title leads, dek invites, foot is one quiet line */
body.theme-quiet .feed-card-main {
  padding: 16px 20px 18px; flex: 1 1 auto; display: flex; flex-direction: column;
}
body.theme-quiet .feed-card-body { flex: 1 1 auto; min-height: 0; }
body.theme-quiet .feed-card-title {
  font-family: var(--serif); font-size: 1.28rem; line-height: 1.26;
  letter-spacing: -.012em; font-weight: 600; margin: 0 0 9px;
  /* Balance the two lines so the 2nd is never a lone "(did)" orphan.
     text-wrap: balance needs block display (it's ignored on -webkit-box),
     so cap height with max-height instead of -webkit-line-clamp. */
  display: block; overflow: hidden; text-wrap: balance; max-height: 2.65em;
}
body.theme-quiet .feed-card-title a { color: var(--ink); }
body.theme-quiet .feed-card:hover .feed-card-title a { color: var(--brand); }
/* uniform sizing — top-3 no longer jump bigger */
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-1 .feed-card-title,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-2 .feed-card-title,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-3 .feed-card-title { font-size: 1.28rem; }
body.theme-quiet .feed-card-summary {
  color: var(--ink-2); font-size: .92rem; line-height: 1.56; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.theme-quiet .feed-card-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--muted);
}
body.theme-quiet .feed-author-name { color: var(--ink-2); font-weight: 500; }
body.theme-quiet .feed-likes .heart { color: #f59e0b; }

/* ============================================================
   THEME · QUIET — hover choreography
   (Resting shadow and box-shadow are owned by the glass card rule
   ~150 lines above; we only define the hover rise + bloom here.
   The old "paper-soft resting shadow" blocks were removed because
   they overrode the glass card's translucency.)
   ============================================================ */
/* Hover: rise a touch more + deepen the float (shadow/border owned by
   the clean card rule above; just amplify here). */
body.theme-quiet .feed-grid .feed-card:hover,
body.theme-quiet .feed-grid.js-masonry .feed-card:hover {
  transform: translateY(-6px) !important;
}

/* Always-on gradient-ring border — the signature "tech" cue. A blue→
   violet hairline traces the rounded edge, faint at rest and brighter on
   hover. (mask-composite cuts the fill so only the 1px ring shows.) */
body.theme-quiet .feed-card::after {
  content: ""; position: absolute; inset: 0; border-radius: 18px;
  padding: 1px; pointer-events: none; z-index: 3;
  background: linear-gradient(135deg,
    rgba(59,130,246,.55) 0%, rgba(129,140,248,.32) 42%,
    rgba(59,130,246,0) 70%, rgba(59,130,246,.30) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; transition: opacity .35s ease;
}
body.theme-quiet .feed-card:hover::after { opacity: 1; }

/* Figure breathes in inside its frame; the frame's halo softens up */
body.theme-quiet .feed-card:hover .feed-cover .feed-slide img,
body.theme-quiet .feed-card:hover .feed-cover > img { transform: scale(1.06); }
body.theme-quiet .feed-cover { transition: box-shadow .35s ease, border-color .3s ease; }
body.theme-quiet .feed-card:hover .feed-cover {
  border-color: color-mix(in srgb, var(--brand) 16%, var(--line));
  box-shadow: 0 12px 30px -20px rgba(37,99,235,.24);
}

/* Text settles into the accent */
body.theme-quiet .feed-card-title { transition: color .25s ease; }
body.theme-quiet .feed-author-name, body.theme-quiet .feed-src { transition: color .2s ease; }

/* Reduced-motion: keep the soft glow, drop the movement & zoom */
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .feed-grid .feed-card:hover,
  body.theme-quiet .feed-grid.js-masonry .feed-card:hover { transform: none !important; }
  body.theme-quiet .feed-card:hover .feed-cover .feed-slide img,
  body.theme-quiet .feed-card:hover .feed-cover > img { transform: none; }
}

/* ============================================================
   THEME · QUIET — neutralise the top-3 'feature' cards
   The is-feat-1/2/3 cards carry a high-specificity resting shadow
   that out-ranks the generic hover, so the first row looked dead on
   hover. Force them to behave exactly like every other card: same
   resting float, same dreamy bloom on hover, no stripe.
   ============================================================ */
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-1,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-2,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-3 {
  border-color: rgba(255,255,255,.85) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 0 0 1px rgba(255,255,255,.5),
    0 1px 2px rgba(11,20,36,.04),
    0 28px 56px -32px rgba(30,58,138,.30) !important;
}
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-1::before,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-2::before,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-3::before { display: none !important; }

body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-1:hover,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-2:hover,
body.theme-quiet .feed-grid:not(.is-filtered) .feed-card.is-feat-3:hover {
  transform: translateY(-7px) !important;
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line)) !important;
  box-shadow:
    0 2px 4px rgba(11,20,36,.05),
    0 18px 40px -24px rgba(11,20,36,.22),
    0 40px 90px -38px rgba(37,99,235,.30),
    0 0 0 1px rgba(37,99,235,.05) !important;
}

/* ============================================================
   THEME · QUIET — feed motion (entrance + filter FLIP helpers)
   ============================================================ */
@keyframes qRise {
  from { opacity: 0; transform: translateY(20px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
body.theme-quiet .feed-card.q-rise {
  animation: qRise .62s cubic-bezier(.22,.72,.24,1) both;
}
/* leavers are pinned out of flow and fade+shrink (JS sets the geometry) */
body.theme-quiet .feed-card.q-leaving {
  transition: opacity .34s ease, transform .34s cubic-bezier(.4,0,.6,1) !important;
  pointer-events: none; box-shadow: none !important;
}
body.theme-quiet .feed-card.q-leaving::after { opacity: 0 !important; }

/* Scroll-in: cards fade + lift into place as they enter the viewport. JS
   adds .scroll-in (resting hidden state) on load and .in-view once an
   IntersectionObserver fires. Above-the-fold cards still use q-rise. */
body.theme-quiet .feed-card.scroll-in {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1);
  will-change: opacity, transform;
}
body.theme-quiet .feed-card.scroll-in.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .feed-card.scroll-in { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   THEME · QUIET — global page polish (consistency across the site)
   Every page already shares the dark chrome + cool-paper background +
   single accent. This gives shared containers the same soft-paper,
   science-quiet finish so detail / forms / importer / profile /
   taxonomy all feel like one product.
   ============================================================ */

/* Shared containers: soft paper float, hairline, calm radius */
body.theme-quiet .formwrap,
body.theme-quiet .profile-block,
body.theme-quiet .tax-admin .tax-field,
body.theme-quiet .imp-session .imp-chat,
body.theme-quiet .vr-row,
body.theme-quiet .doc-readonly,
body.theme-quiet .api-key-row,
body.theme-quiet .tax-rev-row {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11,20,36,.03), 0 16px 38px -30px rgba(11,20,36,.16);
}
body.theme-quiet .vr-row, body.theme-quiet .api-key-row, body.theme-quiet .tax-rev-row { border-radius: 10px; }

/* Editorial headlines everywhere — serif, tight, confident */
body.theme-quiet .formwrap-head h1,
body.theme-quiet .tax-head h1,
body.theme-quiet .compose-head h1,
body.theme-quiet .auth-page h1,
body.theme-quiet .imp-session-title { font-family: var(--serif); letter-spacing: -.012em; }

/* Section kickers / eyebrows: mono, muted — the "lab notebook" cue */
body.theme-quiet .compose-kicker,
body.theme-quiet .wf-kicker,
body.theme-quiet .tax-head .wf-kicker,
body.theme-quiet .modal-eyebrow { font-family: var(--mono); color: var(--muted); letter-spacing: .12em; }

/* Inputs: consistent calm fields + accent focus on every form */
body.theme-quiet input[type=text], body.theme-quiet input[type=email],
body.theme-quiet input[type=password], body.theme-quiet input[type=url],
body.theme-quiet input[type=search], body.theme-quiet textarea, body.theme-quiet select {
  border-radius: 10px;
}

/* Tables of mono data (versions, keys, history) read as data */
body.theme-quiet .tax-rev-when, body.theme-quiet .tax-rev-diff,
body.theme-quiet .api-key-mask, body.theme-quiet .api-key-meta,
body.theme-quiet .doc-key { font-family: var(--mono); }

/* Guide / static prose pages: comfortable measure + serif headings */
body.theme-quiet .prose h1, body.theme-quiet .prose h2, body.theme-quiet .prose h3 { font-family: var(--serif); letter-spacing: -.01em; }

/* The importer preview iframe + chat already inherit; just calm the frame */
body.theme-quiet .imp-frame { border-color: var(--line); border-radius: 14px; }

/* ============================================================
   THEME · QUIET — centering, AJAX-swap transitions, single-line
   API-key hint, calmer formula plate.
   ============================================================ */

/* Centre the content column on pages without a left rail (profile,
   settings, auth, doc pages, …) so they're not glued to the gutter.
   The homepage feed ALSO renders a rail but drives its layout through
   .body-feed (not .has-rail), so it must be excluded — otherwise this
   squeezes the 3-column grid into a narrow 980px column and leaves a big
   empty gap beside the rail. */
body.theme-quiet:not(.body-feed) .page:not(.has-rail) .main { display: flex; justify-content: center; }
body.theme-quiet:not(.body-feed) .page:not(.has-rail) .main .container { max-width: 980px; padding: 0 24px; }
body.theme-quiet .formwrap { margin-left: auto; margin-right: auto; }
body.theme-quiet .formwrap-wide { max-width: 1000px; }

/* Compress the API-key hint to one line on wide screens (it was wrapping
   onto three lines on a wide card and looked verbose). */
body.theme-quiet .api-key-section .hint {
  margin: 4px 0 12px; font-size: .88rem; line-height: 1.45;
  max-width: none; white-space: normal;
}

/* View-transition tuning: keep movement subtle so the "morph" reads as a
   tidy re-sort, not a flying-cards animation. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: .42s; animation-timing-function: cubic-bezier(.22,.72,.24,1);
  }
  /* Survivors (named .feed-card morphs) glide; leavers/newcomers cross-fade */
  ::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.22,.72,.24,1); }
  ::view-transition-old(*) { animation-duration: .28s; }
  ::view-transition-new(*) { animation-duration: .42s; }
}

/* ============================================================
   THEME · QUIET — roomier feed + readable titles
   On wide screens the 1200px cap squeezed 3 columns into narrow,
   title-truncating cards while the right third sat empty. Give the
   workspace more room so cards breathe.
   ============================================================ */
body.theme-quiet .page.has-rail { max-width: 1480px; }
body.theme-quiet .feed-grid { gap: 30px; }
/* Titles get more width now, so relax the clamp to 2 generous lines and
   trim the size a touch — fewer awkward "…" cut-offs. */
body.theme-quiet .feed-card-title { font-size: 1.24rem; line-height: 1.3; }
body.theme-quiet .feed-card-main { padding: 14px 22px 14px; }
/* formula plate: the JS scales long equations to fit; keep it centered */
body.theme-quiet .feed-snap-formula { overflow: hidden; }

/* ─────────────────── StatsClaw chat FAB + side panel ─────────────────────
   The FAB owns the bottom-right slot (formerly +Post). Carries the same
   entrance + ambient-pulse + scroll-collapse animations that the +Post FAB
   had so the page feels the same; only the action and the icon differ. */
/* StatsClaw palette (matches the scorpion mark): warm cream-white pill,
   deep-navy "Stats" + amber-orange "Claw" wordmark, navy ring around the
   scorpion. No blue gradient — it should read as the scorpion's own brand,
   not a generic "AI button". */
.sc-fab {
  --claw-navy: #0f2750;
  --claw-amber: #2563eb;
  --claw-cream: #f4f7ff;
  /* Suppress the iOS Safari long-press callout (the "save image / magnify"
     popup) so a long-press triggers voice input instead of zooming the icon. */
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed; right: 26px; bottom: 30px; z-index: 110;
  display: inline-flex; align-items: center;
  padding: 9px 22px 9px 9px; border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, var(--claw-cream) 100%);
  color: var(--claw-navy);
  border: 1px solid rgba(15,39,80,.18);
  font-family: var(--sans); font-size: .95rem; font-weight: 700; letter-spacing: .005em;
  cursor: pointer; white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 14px 32px -10px rgba(15,39,80,.22),
    0 2px 6px -1px rgba(15,39,80,.12);
  /* Entrance + a soft ambient pulse that lives without dominating. */
  animation: sc-fab-in .55s cubic-bezier(.2,.7,.3,1), sc-fab-pulse 4s ease-in-out 1.2s infinite;
  transition: transform .26s cubic-bezier(.2,.7,.3,1), box-shadow .26s ease,
              border-color .2s ease, background .2s ease, opacity .15s ease,
              padding .35s cubic-bezier(.2,.7,.3,1);
}
@keyframes sc-fab-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sc-fab-pulse {
  0%, 100% { box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 14px 32px -10px rgba(15,39,80,.22),
    0 2px 6px -1px rgba(15,39,80,.12); }
  50% { box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 18px 40px -10px rgba(37,99,235,.32),
    0 0 0 6px rgba(37,99,235,.08); }
}
.sc-fab:hover,
.sc-fab:focus-visible {
  transform: translateY(-3px); color: var(--claw-navy);
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  border-color: rgba(37,99,235,.45);
  animation: sc-fab-in .55s cubic-bezier(.2,.7,.3,1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 22px 50px -12px rgba(37,99,235,.35),
    0 0 0 8px rgba(37,99,235,.10);
}
/* Shake animation — fired by long-press to invite voice input. Larger
   amplitude + longer duration so the user clearly sees that the long-press
   registered, even on a small screen. */
@keyframes sc-fab-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  8%  { transform: translate(-4px, -2px) rotate(-6deg); }
  20% { transform: translate(6px,  2px) rotate(6deg); }
  35% { transform: translate(-6px, -2px) rotate(-6deg); }
  50% { transform: translate(5px,  2px) rotate(5deg); }
  65% { transform: translate(-4px, -1px) rotate(-4deg); }
  80% { transform: translate(3px,  1px) rotate(3deg); }
  92% { transform: translate(-1px, 0)   rotate(-1deg); }
}
.sc-fab.is-shaking { animation: sc-fab-shake .72s cubic-bezier(.36, .07, .19, .97); }
/* Listening state (after the long-press unlocks voice). */
.sc-fab.is-listening {
  background: linear-gradient(180deg, #fff 0%, #e0e9ff 100%);
  border-color: rgba(37,99,235,.7);
  animation: sc-fab-listen 1.2s ease-in-out infinite;
}
@keyframes sc-fab-listen {
  0%, 100% { box-shadow: 0 14px 32px -10px rgba(37,99,235,.4), 0 0 0 6px rgba(37,99,235,.10); }
  50%      { box-shadow: 0 18px 40px -8px rgba(37,99,235,.55), 0 0 0 12px rgba(37,99,235,.18); }
}
/* Icon: circular cream patch with a navy ring; scorpion image fills it.
   Image 4 has a subtle blue-tinted ring around the scorpion. */
.sc-fab-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  background: transparent; border: 0;
  font-size: 1rem; line-height: 1;
  flex: none;
}
.sc-fab-icon img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* The long-press must land on the button, not the <img> — and iOS must not
     offer to save/magnify the image. */
  pointer-events: none;
  -webkit-user-drag: none; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
}
.sc-fab-icon.no-logo::before { content: "🦦"; font-size: 1.05rem; }
.sc-fab:hover .sc-fab-icon img,
.sc-fab:focus-visible .sc-fab-icon img { transform: scale(1.06); transition: transform .35s cubic-bezier(.2,.7,.3,1); }
/* "Stats" (navy) + "Claw" (amber) wordmark — split via a ::before + the
   visually-hidden literal label so the existing JS doesn't need to render
   two separate spans. */
.sc-fab-label {
  display: inline-flex; align-items: baseline; gap: 0;
  line-height: 1.35; margin-left: 10px;
  max-width: 240px; opacity: 1; overflow: hidden; white-space: nowrap;
  transition: max-width .35s cubic-bezier(.2,.7,.3,1), opacity .22s ease,
              margin-left .35s cubic-bezier(.2,.7,.3,1);
}
/* Wordmark split: "Stats" navy, "Claw" amber. Spans in the HTML — no
   pseudo-element trick (which collided with another .sc-panel-name strong
   rule on the same selector and rendered "StatsStatsClawClaw"). */
.sc-w { font-size: .95rem; font-weight: 700; letter-spacing: .005em; line-height: 1.35; }
.sc-w-stats { color: #0f2750; }
.sc-w-claw  { color: #2563eb; }
/* Scroll-collapse: JS adds .is-collapsed while the page is scrolling. */
.sc-fab.is-collapsed { padding-left: 13px; padding-right: 13px; }
.sc-fab.is-collapsed .sc-fab-label { max-width: 0; opacity: 0; margin-left: 0; }
.sc-fab.is-collapsed:hover,
.sc-fab.is-collapsed:focus-visible { padding-left: 14px; padding-right: 18px; }
.sc-fab.is-collapsed:hover .sc-fab-label,
.sc-fab.is-collapsed:focus-visible .sc-fab-label { max-width: 180px; opacity: 1; margin-left: 9px; }
/* Hover tooltip pill above the FAB. */
.sc-fab-tooltip {
  position: absolute; right: 4px; bottom: calc(100% + 10px);
  padding: 7px 11px; border-radius: 7px;
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line);
  font-family: var(--sans); font-size: .74rem; font-weight: 500; white-space: nowrap;
  box-shadow: 0 12px 26px -12px rgba(11,20,36,.32);
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity .2s ease, transform .26s cubic-bezier(.2,.7,.3,1);
}
.sc-fab-tooltip::after {
  content: ""; position: absolute; right: 24px; bottom: -5px;
  width: 8px; height: 8px; transform: rotate(45deg);
  background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sc-fab:hover .sc-fab-tooltip,
.sc-fab:focus-visible .sc-fab-tooltip { opacity: 1; transform: translateY(0); }
/* Periodic "nudge" speech bubble above the FAB — invites the user to ask.
   The chat JS shows it on a timer with rotating messages; it hides while the
   panel is open and after the user dismisses it (once per session). */
.sc-bubble {
  position: fixed; right: 24px; bottom: 110px; z-index: 109;
  max-width: 244px; box-sizing: border-box;
  padding: 10px 28px 10px 13px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  font-family: var(--sans); font-size: .82rem; line-height: 1.42; font-weight: 500;
  box-shadow: 0 14px 32px -12px rgba(15,39,80,.30), 0 2px 6px -1px rgba(15,39,80,.12);
  cursor: pointer;
  opacity: 0; transform: translateY(16px) scale(.82); transform-origin: bottom right;
  pointer-events: none;
  /* Hide: drop down + shrink (quick ease-in). */
  transition: opacity .2s ease, transform .26s cubic-bezier(.4, 0, 1, 1);
}
/* Show: spring up from small with a soft overshoot (a real "pop"). */
.sc-bubble.is-show {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
  transition: opacity .3s ease, transform .46s cubic-bezier(.2, 1.3, .4, 1);
}
.sc-bubble::after {
  /* The tail points at the Otter icon. Its offset (--sc-tail) is measured in
     JS from the icon's real position, so it stays correct across fonts, widths,
     and the scroll-collapse (where the icon slides right). 144px is just a
     pre-JS fallback. */
  content: ""; position: absolute; right: var(--sc-tail, 144px); bottom: -6px;
  width: 11px; height: 11px; transform: rotate(45deg);
  background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sc-bubble-text { display: block; }
.sc-bubble-close {
  position: absolute; top: 5px; right: 6px;
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: var(--panel-2); color: var(--muted);
  font-size: .82rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.sc-bubble-close:hover { background: var(--line); color: var(--ink); }
body.sc-open .sc-bubble { opacity: 0 !important; transform: translateY(16px) scale(.82) !important; pointer-events: none !important; }
@media (prefers-reduced-motion: reduce) {
  .sc-bubble { transition: opacity .2s ease; transform: none; }
  .sc-bubble.is-show { transform: none; }
}
@media (max-width: 640px) {
  .sc-bubble { right: 14px; bottom: 72px; max-width: min(74vw, 240px); }
  /* tail offset still comes from JS (--sc-tail); it measures the icon wherever
     it sits on mobile too. */
}
/* Hide the FAB while the panel is open. */
body.sc-open .sc-fab { opacity: 0; pointer-events: none; transform: translateY(8px); animation: none; }
@media (prefers-reduced-motion: reduce) {
  .sc-fab { animation: none !important; }
  .sc-fab, .sc-fab-icon img, .sc-fab-label, .sc-fab-tooltip { transition: none !important; }
  .sc-fab:hover, .sc-fab:focus-visible { transform: none; }
}

/* Pop-up popover anchored above the FAB (bottom-right corner). Springs UP
   from the button location instead of sliding in from the screen edge —
   feels like the button itself is opening into a panel. */
/* StatsClaw chat panel. The FAB keeps its cream/navy/amber identity, but the
   chat surface itself uses the calm white/indigo palette (the one the rest of
   the site speaks) — just polished. Amber stays only as the voice accent. */
.sc-panel {
  --claw-amber: #2563eb;
  position: fixed; right: 26px; bottom: 100px; z-index: 120;
  width: min(420px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 140px));
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--line));
  border-radius: 18px;
  box-shadow:
    0 30px 60px -18px rgba(11,20,36,.30),
    0 10px 28px -8px rgba(11,20,36,.18);
  transform-origin: bottom right;
  transform: translateY(20px) scale(.86);
  opacity: 0; pointer-events: none;
  transition: transform .26s cubic-bezier(.16, 1, .3, 1),
              opacity .18s ease;
  overflow: hidden;
}
/* Panel stays in the DOM (never display:none) so the open/close transition
   actually runs. Closed = opacity 0 + pointer-events none; open adds .sc-open. */
body.sc-open .sc-panel { transform: none; opacity: 1; pointer-events: auto; }

.sc-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
}
.sc-panel-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sc-panel-mark {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  flex: none; background: transparent; border: 0;
  color: #0f2750; font-family: var(--serif); font-weight: 700; font-size: 1.15rem;
}
.sc-panel-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-panel-mark.no-logo::before { content: "🦦"; font-size: 1.05rem; }
.sc-panel-name { display: flex; flex-direction: column; min-width: 0; }
.sc-panel-name strong { font-size: 1rem; line-height: 1.1; }
.sc-panel-name strong .sc-w { font-size: 1rem; }
.sc-panel-sub { color: var(--muted); font-size: .72rem; line-height: 1.3; margin-top: 2px; }
.sc-panel-close {
  background: none; border: none; cursor: pointer; padding: 4px 10px;
  font-size: 1.5rem; line-height: 1; color: var(--muted); border-radius: 8px;
}
.sc-panel-close:hover { color: var(--ink); background: var(--panel-2); }

.sc-thread {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: #fafbff;
  scroll-behavior: smooth;
}
.sc-msg {
  max-width: 92%;
  padding: 10px 14px; border-radius: 14px;
  font-size: .92rem; line-height: 1.5; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 2px 6px -3px rgba(11,20,36,.08);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.sc-msg p { margin: 0 0 .5em; }
.sc-msg p:last-child { margin-bottom: 0; }
.sc-msg ul, .sc-msg ol { margin: .25em 0 .5em; padding-left: 1.25em; }
.sc-msg code { background: var(--panel-2); color: var(--ink); padding: 1px 4px; border-radius: 4px; font-size: .85em; }
.sc-msg a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.sc-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px -6px rgba(37,99,235,.5), 0 1px 0 rgba(255,255,255,.2) inset;
}
.sc-msg-user a { color: #fff; text-decoration-color: rgba(255,255,255,.65); }
.sc-msg-user code { background: rgba(255,255,255,.18); color: #fff; }
.sc-msg-bot { align-self: flex-start; }
.sc-msg.is-streaming::after {
  content: ""; display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); margin-left: 4px;
  animation: scTyping 1s ease-in-out infinite;
  vertical-align: 2px;
}
@keyframes scTyping { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.sc-greeting { font-style: italic; color: var(--ink-2); background: #fff; }
.sc-greeting strong { color: var(--ink); }

/* Voice banner — amber is the "listening" accent. */
.sc-voice-banner {
  align-self: stretch;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #e0e9ff 100%);
  border: 1px solid rgba(37,99,235,.45);
  color: #7c2d12; font-size: .9rem; font-weight: 600;
}
.sc-voice-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--claw-amber);
  animation: sc-voice-dot 1s ease-in-out infinite;
  flex: none;
}
@keyframes sc-voice-dot { 0%,100% { opacity: .35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.35); } }
.sc-msg-error {
  align-self: flex-start; background: color-mix(in srgb, #ef4444 8%, #fff);
  border-color: color-mix(in srgb, #ef4444 30%, var(--line));
  color: #991b1b;
}
.sc-msg-info {
  align-self: stretch; max-width: none;
  padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--ink-2) 6%, #fff);
  border: 1px dashed color-mix(in srgb, var(--ink-2) 22%, var(--line));
  color: var(--ink-2); font-style: italic; font-size: .88rem; line-height: 1.45;
  box-shadow: none;
}

.sc-input {
  display: flex; gap: 8px; align-items: stretch;
  padding: 12px; background: #fff;
  border-top: 1px solid var(--line);
}
.sc-input textarea {
  flex: 1 1 auto; min-width: 0; resize: none;
  font-family: var(--sans); font-size: .92rem; line-height: 1.45; color: var(--ink);
  padding: 9px 11px; min-height: 2.9em; max-height: 140px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel);
  transition: border-color .12s, background .12s, box-shadow .12s;
  overflow-y: auto;
}
.sc-input textarea::placeholder { color: var(--muted); opacity: 1; }
.sc-input textarea:focus {
  outline: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow, rgba(37,99,235,.16));
}
/* Mic toggle inside the input row — activate / stop voice. */
.sc-mic {
  flex: none; width: 42px; align-self: stretch;
  display: grid; place-items: center;
  border-radius: 10px; cursor: pointer;
  background: var(--panel); color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 1.15rem; line-height: 1;
  transition: background .14s, border-color .14s, color .14s;
}
.sc-mic:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.sc-mic.is-on {
  background: linear-gradient(180deg, #fff 0%, #e0e9ff 100%);
  border-color: rgba(37,99,235,.7); color: #1d4ed8;
  animation: sc-mic-on 1.1s ease-in-out infinite;
}
@keyframes sc-mic-on {
  0%,100% { box-shadow: 0 0 0 0 rgba(37,99,235,.0); }
  50%     { box-shadow: 0 0 0 5px rgba(37,99,235,.16); }
}
.sc-mic[hidden] { display: none; }
.sc-send {
  flex: none; padding: 0 20px; border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%); color: #fff;
  border: 1px solid rgba(255,255,255,.14); cursor: pointer;
  font-family: var(--sans); font-size: .88rem; font-weight: 700; letter-spacing: .005em;
  align-self: stretch;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 12px -6px rgba(37,99,235,.5);
  transition: filter .14s ease, transform .14s ease;
}
.sc-send:disabled { opacity: .5; cursor: not-allowed; }
.sc-send:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }

/* Phones: collapse the FAB to a scorpion-only circle, and open the full-screen
   sheet by SCALING it out of the FAB's corner. transform: scale() (not
   clip-path) is used here because iOS Safari animates transforms reliably,
   whereas its clip-path: circle() transitions are flaky — that's why the
   open/close had no animation before. transform-origin is pinned to the FAB's
   centre so the panel visibly grows out of the StatsClaw button and shrinks
   back into it on close. */
@media (max-width: 640px) {
  /* Same baseline + size as the Fields FAB so they share one horizontal line. */
  .sc-fab {
    right: 16px; bottom: 18px; padding: 0; width: 44px; height: 44px;
    justify-content: center; gap: 0;
  }
  .sc-fab-label, .sc-fab-tooltip { display: none; }
  .sc-fab-icon { width: 28px; height: 28px; font-size: 1.05rem; background: transparent; }
  .sc-panel {
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100vw; max-width: none; max-height: none;
    border: 0; border-radius: 22px 0 0 0;   /* a soft corner toward the FAB */
    /* Grow from / shrink into the FAB's centre (right:16+22=38, bottom:18+22=40). */
    transform-origin: calc(100% - 38px) calc(100% - 40px);
    transform: scale(.04);
    opacity: 0; pointer-events: none;
    transition: transform .4s cubic-bezier(.2, .85, .25, 1), opacity .22s ease;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
  }
  body.sc-open .sc-panel {
    transform: scale(1); opacity: 1; pointer-events: auto;
  }
  .sc-panel-head { padding: 12px 14px; }
  .sc-greeting { padding: 9px 12px; font-size: .9rem; }
  /* >=16px text stops iOS Safari from auto-zooming the page when the textarea
     is focused (the autofocus on open was the "sudden zoom-in" on phones). */
  .sc-input textarea { font-size: 16px; }
}

/* Recommended-card chip: when the assistant's reply contains a markdown link
   to /workflows/w/<slug>/, the chat JS upgrades that <a> to .sc-card-link so
   it reads as a prominent, clickable card instead of inline blue text. */
.sc-card-link {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0; padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  border: 1px solid rgba(37,99,235,.32);
  border-radius: 12px;
  color: #0f2750; text-decoration: none;
  font-size: .92rem; font-weight: 600;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 6px -2px rgba(15,39,80,.10);
}
.sc-card-link:hover {
  transform: translateY(-1px); text-decoration: none;
  border-color: rgba(37,99,235,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 8px 18px -8px rgba(37,99,235,.35);
}
.sc-card-link-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 50%; flex: none;
  background: #e9f1fb; border: 1.5px solid rgba(15,39,80,.55);
  color: #0f2750; font-size: 1rem;
}
.sc-card-link-body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sc-card-link-title { color: #0f2750; line-height: 1.2; overflow-wrap: anywhere; }
.sc-card-link-sub { color: var(--muted); font-size: .72rem; font-weight: 500; margin-top: 2px; }
.sc-card-link-arrow { color: #2563eb; font-size: 1.1rem; line-height: 1; flex: none; }
/* Bot links inside a message: never inherit the user-bubble's white color. */
.sc-msg-bot a { color: #1e3a8a; }

/* Print: hide the chat. */
@media print { .sc-fab, .sc-panel { display: none !important; } }

/* ════════════════ TOPBAR · DARK GLASS CONSOLE (final design) ════════════════
   Supersedes the light-glass topbar rules earlier in this file. A translucent
   DARK glass bar (the page/aurora still blurs through it) with restrained
   data-terminal detailing: faint circuit grid, a soft brand corner-glow, a
   slow luminous scan baseline, holo logo chip and instrument readouts. Dark +
   glass + tech, kept simple via a restrained palette (ink + one cyan accent). */
body.theme-quiet .topbar {
  background:
    radial-gradient(120% 200% at 8% -75%, rgba(56,130,246,.22), transparent 55%),
    repeating-linear-gradient(90deg, rgba(125,180,255,.04) 0 1px, transparent 1px 60px),
    linear-gradient(180deg, rgba(12,18,34,.74), rgba(9,13,26,.80)) !important;
  -webkit-backdrop-filter: saturate(150%) blur(20px) !important;
          backdrop-filter: saturate(150%) blur(20px) !important;
  border-bottom: 1px solid rgba(125,180,255,.16) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 14px 36px -26px rgba(0,0,0,.7) !important;
}
body.theme-quiet .topbar::after {
  display: block; height: 1px; opacity: 1; border: 0;
  background: linear-gradient(90deg, transparent 6%, rgba(56,189,248,.55) 24%, rgba(99,102,241,.65) 50%, rgba(56,189,248,.55) 76%, transparent 94%) !important;
  background-size: 240% 100% !important;
  animation: tb-scan 9s linear infinite !important;
}
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .topbar::after { animation: none !important; background-position: 50% 0 !important; }
}
/* wordmark */
body.theme-quiet .brand, body.theme-quiet .brand-name { color: #eef3ff !important; }
body.theme-quiet .brand-name-acc {
  background: linear-gradient(180deg, #7dd3fc, #60a5fa) !important;
  -webkit-background-clip: text !important; background-clip: text !important;
  -webkit-text-fill-color: transparent !important; color: transparent !important;
}
body.theme-quiet .brand-tag { color: #8090ac !important; }
body.theme-quiet .brand-tag::after {
  border: 1px solid rgba(125,211,252,.30) !important; color: #93c5fd !important;
  background: rgba(125,211,252,.06) !important;
}
/* otter in a subtle holo-glass chip so it pops on the dark bar */
body.theme-quiet .brand-mark:has(.brand-logo-img) {
  background: radial-gradient(120% 95% at 50% 0, rgba(125,211,252,.18), transparent 62%), rgba(255,255,255,.06) !important;
  border: 1px solid rgba(147,197,253,.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 18px -9px rgba(56,189,248,.55) !important;
}
body.theme-quiet .brand:hover .brand-mark:has(.brand-logo-img) {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 0 22px -6px rgba(56,189,248,.75) !important;
  transform: translateY(-1px);
}
/* nav + menu text light */
body.theme-quiet .topbar a:not(.btn) { color: #cdd7ee !important; }
body.theme-quiet .topbar a:not(.btn):hover { color: #ffffff !important; }
body.theme-quiet .nav-menu-name { color: #eef3ff !important; }
body.theme-quiet .nav-menu-caret { color: #8090ac !important; }
body.theme-quiet .topbar .nav-menu-trigger:hover { background: rgba(125,180,255,.10) !important; }
body.theme-quiet .topbar .nav-menu-trigger:hover .nav-menu-name,
body.theme-quiet .topbar .nav-menu-trigger:hover .nav-menu-caret { color: #fff !important; }
body.theme-quiet .nav-right::before { background: linear-gradient(180deg, transparent, rgba(147,197,253,.30), transparent) !important; }
/* instrument readouts — dark glass, cyan data-tick, simple */
body.theme-quiet .topbar-readouts { border-right: 1px solid rgba(147,197,253,.16) !important; }
body.theme-quiet .tb-readout {
  background: rgba(125,180,255,.06) !important;
  border: 1px solid rgba(125,180,255,.16) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05) !important;
}
body.theme-quiet .tb-readout::before {
  background: linear-gradient(180deg, #38bdf8, #6366f1) !important;
  box-shadow: 0 0 7px rgba(56,189,248,.7) !important;
}
body.theme-quiet .tb-readout-k { color: #8aa0c8 !important; }
body.theme-quiet .tb-readout-v { color: #eef3ff !important; }
/* +Post stays a bright brand CTA; avatar handle light */
body.theme-quiet .topbar .btn-post {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border: 1px solid #1d4ed8 !important; color: #fff !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 20px -10px rgba(37,99,235,.6) !important;
}

/* ════════════ TOPBAR · nav + signature tech polish (most-tech pass) ════════════ */
body.theme-quiet .brand-tag { display: none !important; }   /* drop tagline; nav carries wayfinding */

/* Section nav (replaces the old stat chips) */
body.theme-quiet .tb-nav { display: flex; align-items: center; gap: 2px; margin-left: 28px; }
body.theme-quiet .tb-nav-link {
  position: relative; padding: 9px 14px 10px; border-radius: 9px;
  font-family: var(--sans); font-size: .86rem; font-weight: 600; letter-spacing: .004em;
  color: #c3cfe8 !important; white-space: nowrap;
  transition: color .16s ease, background .16s ease;
}
body.theme-quiet .tb-nav-link:hover { color: #fff !important; background: rgba(125,180,255,.08); text-decoration: none; }
body.theme-quiet .tb-nav-link.is-active { color: #fff !important; }
body.theme-quiet .tb-nav-link.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 3px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #22d3ee, #6366f1);
  box-shadow: 0 0 10px rgba(56,189,248,.75);
}

/* Signature: a slow rotating holographic ring around the otter mark */
body.theme-quiet .brand-mark:has(.brand-logo-img) {
  position: relative; isolation: isolate;
  overflow: visible !important;
  background: #0d1428 !important;
  border: 0 !important;
  box-shadow: 0 0 18px -7px rgba(56,189,248,.5) !important;
}
body.theme-quiet .brand-mark:has(.brand-logo-img)::after {
  content: ""; position: absolute; inset: -1.5px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from 0deg, #22d3ee, #6366f1, #22d3ee, #38bdf8, #22d3ee);
  animation: tb-ring 5.5s linear infinite;
}
@keyframes tb-ring { to { transform: rotate(1turn); } }

/* CTA + avatar accents */
body.theme-quiet .topbar .btn-post {
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 0 0 1px rgba(56,189,248,.0), 0 8px 22px -10px rgba(37,99,235,.8) !important;
}
body.theme-quiet .nav-menu-trigger .avatar {
  box-shadow: 0 0 0 1.5px rgba(56,189,248,.45), 0 0 12px -4px rgba(56,189,248,.6);
}

@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .brand-mark:has(.brand-logo-img)::after { animation: none; }
}
@media (max-width: 760px) { body.theme-quiet .tb-nav { display: none; } }  /* nav collapses on phones */

/* ════════════════ TOPBAR · APPLE-MINIMAL (final — supersedes all topbar rules above) ════════════════
   Clean, light, spacious, monochrome. Frosted near-white bar + hairline divider,
   thin grey nav, no tech effects (no glow / scan line / holo ring / grid). */
body.theme-quiet .topbar {
  background: rgba(250,250,252,.72) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
          backdrop-filter: saturate(180%) blur(20px) !important;
  border-bottom: 1px solid rgba(0,0,0,.08) !important;
  box-shadow: none !important;
}
body.theme-quiet .topbar::after { display: none !important; }
body.theme-quiet .topbar-inner { height: 64px !important; }

/* logo: small otter, no chip / ring; clean monochrome wordmark */
body.theme-quiet .brand-mark, body.theme-quiet .brand-mark:has(.brand-logo-img) {
  width: 44px !important; height: 44px !important;
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  overflow: visible !important;
}
body.theme-quiet .brand-mark:has(.brand-logo-img)::after { display: none !important; }
body.theme-quiet .brand-name { color: #1d1d1f !important; font-weight: 600 !important; font-size: 1.02rem !important; letter-spacing: -.012em !important; }
body.theme-quiet .brand-name-acc { background: none !important; -webkit-text-fill-color: #2563eb !important; color: #2563eb !important; }

/* nav: thin grey, generous spacing, quiet hover, no pills / underline */
body.theme-quiet .tb-nav { gap: 30px !important; margin-left: 38px !important; }
body.theme-quiet .tb-nav-link {
  padding: 0 !important; border-radius: 0 !important; background: none !important;
  font-size: .82rem !important; font-weight: 400 !important; letter-spacing: .01em !important;
  color: #515154 !important;
}
body.theme-quiet .tb-nav-link:hover { color: #1d1d1f !important; background: none !important; }
body.theme-quiet .tb-nav-link.is-active { color: #1d1d1f !important; font-weight: 500 !important; }
body.theme-quiet .tb-nav-link.is-active::after { display: none !important; }

/* right side: minimal, monochrome */
body.theme-quiet .topbar a:not(.btn) { color: #515154 !important; }
body.theme-quiet .topbar a:not(.btn):hover { color: #1d1d1f !important; }
body.theme-quiet .nav-menu-name { color: #1d1d1f !important; font-weight: 400 !important; }
body.theme-quiet .nav-menu-caret { color: #86868b !important; }
body.theme-quiet .nav-menu-trigger .avatar { box-shadow: none !important; }
body.theme-quiet .nav-right::before { display: none !important; }

/* +Post: small clean blue pill, no glow */
body.theme-quiet .topbar .btn-post {
  height: 30px !important; padding: 0 15px !important;
  background: #2563eb !important; border: 0 !important; color: #fff !important;
  border-radius: 980px !important; font-weight: 500 !important; font-size: .82rem !important;
  box-shadow: none !important;
}
body.theme-quiet .topbar .btn-post:hover { background: #1d4ed8 !important; transform: none !important; }

/* ════════════════ PAGE · APPLE-MINIMAL (overrides the glass theme) ════════════════
   Calm solid background, no grid, no bouncing aurora; white cards with soft
   shadows; clean search / pills / rail. Light, spacious, restrained. */
body.theme-quiet { background-color: #f5f5f7 !important; background-image: none !important; }
body.theme-quiet::before { display: none !important; }
body.theme-quiet .bg-aurora { display: none !important; }

/* feed cards: solid white, large radius, soft Apple shadow, no glass */
body.theme-quiet .feed-card {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,.06) !important;
  border-radius: 18px !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px -18px rgba(0,0,0,.16) !important;
}
body.theme-quiet .feed-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(0,0,0,.09) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.06), 0 22px 48px -22px rgba(0,0,0,.22) !important;
}

/* sticky search row: solid page colour so cards tuck cleanly behind it (no box, since bg matches) */
body.theme-quiet.body-feed .feed-head { background: #f5f5f7 !important; }

/* search bar: clean white field */
body.theme-quiet .feed-search {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,.10) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
  border-radius: 12px !important;
}
body.theme-quiet .feed-search:focus-within {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12) !important;
}

/* filter pills: clean monochrome, solid blue when active */
body.theme-quiet .feed-sel-all,
body.theme-quiet .feed-sort a {
  background: #ffffff !important; border: 1px solid rgba(0,0,0,.10) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: none !important; color: #515154 !important;
}
body.theme-quiet .feed-sort a:hover { border-color: rgba(0,0,0,.18) !important; color: #1d1d1f !important; }
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-chip {
  background: #2563eb !important; border-color: #2563eb !important; color: #ffffff !important;
}

/* left rail: clean white card */
body.theme-quiet .feed-rail,
body.theme-quiet .feed-rail.is-compact {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,.06) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px -20px rgba(0,0,0,.12) !important;
  border-radius: 18px !important;
}

/* ════════════════ APPLE × GLASS FUSION (signature vibrancy on the clean Apple base) ════════════════
   Keep Apple calm/spacing/radius/soft-shadows, but restore the translucent
   frosted surfaces + a gentle bouncing aurora glowing through them. */
body.theme-quiet { background-color: #eef1f6 !important; }      /* soft cool white, room for the glow */
body.theme-quiet .bg-aurora { display: block !important; opacity: .9 !important; }   /* ambient glow, a touch stronger so it reads through the deeper glass */

/* feed cards: frosted glass (aurora glows through) with Apple shape + soft shadow */
body.theme-quiet .feed-card {
  background: rgba(255,255,255,.48) !important;
  -webkit-backdrop-filter: blur(36px) saturate(190%) !important;
          backdrop-filter: blur(36px) saturate(190%) !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  border-radius: 18px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 1px 2px rgba(20,30,60,.05), 0 16px 40px -20px rgba(30,45,90,.26) !important;
}
body.theme-quiet .feed-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(255,255,255,.9) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 2px 6px rgba(20,30,60,.06), 0 26px 56px -24px rgba(30,45,90,.3) !important;
}

/* sticky search row transparent so the aurora flows behind it */
body.theme-quiet.body-feed .feed-head { background: transparent !important; }

/* search bar: frosted glass */
body.theme-quiet .feed-search {
  background: rgba(255,255,255,.44) !important;
  -webkit-backdrop-filter: blur(26px) saturate(185%) !important;
          backdrop-filter: blur(26px) saturate(185%) !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 8px 26px -16px rgba(30,45,90,.2) !important;
  border-radius: 14px !important;
}
body.theme-quiet .feed-search:focus-within {
  border-color: rgba(37,99,235,.45) !important;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12), inset 0 1px 0 rgba(255,255,255,.8) !important;
}

/* filter pills: frosted glass; active stays solid blue */
body.theme-quiet .feed-sel-all,
body.theme-quiet .feed-sort a {
  background: rgba(255,255,255,.52) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%) !important;
          backdrop-filter: blur(14px) saturate(140%) !important;
  border: 1px solid rgba(255,255,255,.75) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8) !important;
  color: #515154 !important;
}
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-chip {
  background: #2563eb !important; border-color: #2563eb !important; color: #fff !important;
}

/* left rail: frosted glass card */
body.theme-quiet .feed-rail,
body.theme-quiet .feed-rail.is-compact {
  background: rgba(255,255,255,.48) !important;
  -webkit-backdrop-filter: blur(36px) saturate(185%) !important;
          backdrop-filter: blur(36px) saturate(185%) !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 14px 38px -22px rgba(30,45,90,.2) !important;
  border-radius: 18px !important;
}

/* topbar: keep Apple, but make it a touch more translucent so the glow whispers through */
body.theme-quiet .topbar { background: rgba(248,249,252,.62) !important; }

/* ════════════════ REFINE · wordmark + buttons + pills (cohesive) ════════════════ */
/* Wordmark: punchier, modern logo weight + tight tracking */
body.theme-quiet .brand-name {
  font-family: var(--sans) !important;
  font-weight: 800 !important; font-size: 1.3rem !important; letter-spacing: -.03em !important;
}

/* Shared CTA language: a soft blue-gradient pill with depth + glow.
   +Post, active sort and the selected-field chip all speak it, so nothing clashes. */
body.theme-quiet .topbar .btn-post,
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-chip {
  background: linear-gradient(180deg, #5b9bff, #2563eb) !important;
  border: 1px solid rgba(37,99,235,.85) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 16px -7px rgba(37,99,235,.6) !important;
}
body.theme-quiet .topbar .btn-post {
  height: 32px !important; padding: 0 16px !important; border-radius: 999px !important;
  font-family: var(--sans) !important; font-weight: 600 !important; font-size: .85rem !important; letter-spacing: 0 !important;
}
body.theme-quiet .topbar .btn-post:hover {
  background: linear-gradient(180deg, #4f8bff, #1d4ed8) !important; transform: translateY(-1px) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 10px 24px -8px rgba(37,99,235,.85) !important;
}

/* Pills: clean sans (no more mono), frosted-glass when inactive */
body.theme-quiet .feed-sort,
body.theme-quiet .feed-sort a,
body.theme-quiet .feed-sel-all,
body.theme-quiet .feed-sel-chip {
  font-family: var(--sans) !important;
}
body.theme-quiet .feed-sort a,
body.theme-quiet .feed-sel-all {
  font-weight: 600 !important; font-size: .78rem !important; letter-spacing: .02em !important;
  padding: 6px 14px !important; border-radius: 999px !important;
  color: #515154 !important;
  background: rgba(255,255,255,.5) !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  -webkit-backdrop-filter: blur(16px) saturate(170%) !important; backdrop-filter: blur(16px) saturate(170%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75) !important;
}
body.theme-quiet .feed-sort a:hover,
body.theme-quiet .feed-sel-all:hover { color: #1d1d1f !important; border-color: rgba(0,0,0,.16) !important; }
body.theme-quiet .feed-sort a.active { font-weight: 600 !important; font-size: .78rem !important; padding: 6px 14px !important; border-radius: 999px !important; }
body.theme-quiet .feed-sel-chip {
  font-weight: 600 !important; font-size: .8rem !important; letter-spacing: .01em !important;
  padding: 6px 8px 6px 14px !important; border-radius: 999px !important;
}
body.theme-quiet .feed-sel-x { background: rgba(255,255,255,.28) !important; color: #fff !important; }

/* ════════════════ UNIFIED BUTTON SYSTEM (one primary + one secondary, identical metrics) ════════════════
   Every actionable pill shares the SAME height(34) / radius(999) / font / shadow.
   PRIMARY (blue): +Post, Search submit, active sort, selected field chip.
   SECONDARY (frosted): inactive sort, All fields. */
body.theme-quiet .topbar .btn-post,
body.theme-quiet .feed-search button,
body.theme-quiet .feed-sort a,
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-all,
body.theme-quiet .feed-sel-chip {
  height: 34px !important; box-sizing: border-box !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  font-family: var(--sans) !important; font-weight: 600 !important; font-size: .82rem !important;
  letter-spacing: 0 !important; text-transform: none !important; line-height: 1 !important;
  transition: filter .14s ease, transform .14s ease, box-shadow .14s ease, border-color .14s ease !important;
}
/* PRIMARY */
body.theme-quiet .topbar .btn-post,
body.theme-quiet .feed-search button,
body.theme-quiet .feed-sort a.active,
body.theme-quiet .feed-sel-chip {
  background: linear-gradient(180deg, #5b9bff, #2563eb) !important;
  border: 1px solid rgba(37,99,235,.85) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 4px 12px -6px rgba(37,99,235,.5) !important;
}
body.theme-quiet .topbar .btn-post:hover,
body.theme-quiet .feed-search button:hover,
body.theme-quiet .feed-sort a.active:hover,
body.theme-quiet .feed-sel-chip:hover {
  filter: brightness(1.04) !important; transform: translateY(-1px) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 18px -7px rgba(37,99,235,.65) !important;
}
/* SECONDARY */
body.theme-quiet .feed-sort a,
body.theme-quiet .feed-sel-all {
  background: rgba(255,255,255,.5) !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  color: #515154 !important;
  -webkit-backdrop-filter: blur(16px) saturate(170%) !important; backdrop-filter: blur(16px) saturate(170%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75) !important;
}
body.theme-quiet .feed-sort a:hover,
body.theme-quiet .feed-sel-all:hover { color: #1d1d1f !important; border-color: rgba(0,0,0,.16) !important; }
/* selected-field chip: leave room for its × on the right */
body.theme-quiet .feed-sel-chip { padding: 0 8px 0 16px !important; }
body.theme-quiet .feed-sel-x {
  width: 18px !important; height: 18px !important; border-radius: 50% !important;
  background: rgba(255,255,255,.28) !important; color: #fff !important; font-size: .8rem !important;
}
/* keep the search submit compact (icon-only) on phones */
@media (max-width: 640px) {
  body.theme-quiet .feed-search button { width: 34px !important; padding: 0 !important; }
}

/* ════════════════ BUTTON ROLES — same blue family, distinct jobs (avoid mis-clicks) ════════════════ */

/* PRIMARY CTA — +Post: boldest, gradient + glow */
body.theme-quiet .topbar .btn-post {
  background: linear-gradient(180deg, #5b9bff, #2563eb) !important;
  border: 1px solid rgba(37,99,235,.9) !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 16px -6px rgba(37,99,235,.6) !important;
}

/* ACTION — Search submit: solid utility blue, flatter than the CTA */
body.theme-quiet .feed-search button {
  background: #2563eb !important; border: 1px solid #2563eb !important; color: #fff !important;
  box-shadow: 0 1px 2px rgba(37,99,235,.22) !important;
}
body.theme-quiet .feed-search button:hover {
  background: #1d4ed8 !important; transform: none !important; filter: none !important;
  box-shadow: 0 2px 6px rgba(37,99,235,.3) !important;
}

/* TOGGLE — sort: an iOS-style segmented control (a switch, not a CTA) */
body.theme-quiet .feed-sort {
  display: inline-flex !important; align-items: center !important;
  background: rgba(0,0,0,.05) !important; border: 1px solid rgba(0,0,0,.05) !important;
  border-radius: 999px !important; padding: 3px !important; gap: 2px !important;
  -webkit-backdrop-filter: blur(8px) !important; backdrop-filter: blur(8px) !important;
}
body.theme-quiet .feed-sort a {
  height: 28px !important; padding: 0 14px !important; border-radius: 999px !important;
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  color: #6b7280 !important; font-weight: 600 !important; font-size: .8rem !important;
}
body.theme-quiet .feed-sort a:hover { color: #1d1d1f !important; background: transparent !important; border: 0 !important; transform: none !important; }
body.theme-quiet .feed-sort a.active {
  background: #ffffff !important; color: #1d1d1f !important; border: 0 !important; transform: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.14), 0 1px 1px rgba(0,0,0,.06) !important;
}

/* FILTER TAG — selected field: a light blue removable chip (not a button) */
body.theme-quiet .feed-sel-chip {
  height: 34px !important; padding: 0 8px 0 14px !important;
  background: rgba(37,99,235,.10) !important; border: 1px solid rgba(37,99,235,.24) !important;
  color: #2563eb !important; box-shadow: none !important;
}
body.theme-quiet .feed-sel-chip:hover { background: rgba(37,99,235,.16) !important; transform: none !important; filter: none !important; box-shadow: none !important; }
body.theme-quiet .feed-sel-x { background: rgba(37,99,235,.18) !important; color: #2563eb !important; }

/* NEUTRAL — All fields: subtle frosted ghost (secondary status) */
body.theme-quiet .feed-sel-all {
  background: rgba(255,255,255,.5) !important; border: 1px solid rgba(0,0,0,.08) !important; color: #515154 !important;
}

/* Search submit: restore the nicer gradient (the flat fill read worse) */
body.theme-quiet .feed-search button {
  background: linear-gradient(180deg, #5b9bff, #2563eb) !important;
  border: 1px solid rgba(37,99,235,.9) !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 16px -6px rgba(37,99,235,.6) !important;
}
body.theme-quiet .feed-search button:hover {
  background: linear-gradient(180deg, #5b9bff, #2563eb) !important;
  filter: brightness(1.05) !important; transform: translateY(-1px) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 10px 22px -8px rgba(37,99,235,.8) !important;
}

/* Search submit: blue→indigo diagonal gradient, rounded-rect (the look the user liked) */
body.theme-quiet .feed-search button {
  background: linear-gradient(115deg, #38bdf8 -10%, #3b82f6 42%, #4f46e5 112%) !important;
  border: 0 !important; color: #fff !important;
  height: 40px !important; padding: 0 18px !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 16px -5px rgba(67,86,217,.55), 0 1px 2px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.35) !important;
}
body.theme-quiet .feed-search button:hover {
  background: linear-gradient(115deg, #38bdf8 -10%, #3b82f6 42%, #4f46e5 112%) !important;
  filter: brightness(1.05) !important; transform: translateY(-1px) !important;
  box-shadow: 0 10px 24px -6px rgba(67,86,217,.7), inset 0 1px 0 rgba(255,255,255,.4) !important;
}

/* Enlarge the floating chat button's otter so it's recognizable */
body.theme-quiet .sc-fab-icon { width: 46px !important; height: 46px !important; }
body.theme-quiet .sc-fab-icon img { object-fit: contain !important; }

/* ════════════════ +Post — a delightful, alive CTA ════════════════ */
@keyframes post-flow { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
body.theme-quiet .topbar .btn-post {
  position: relative !important; overflow: hidden !important; isolation: isolate;
  background: linear-gradient(110deg, #22d3ee, #3b82f6, #6366f1, #3b82f6, #22d3ee) !important;
  background-size: 220% 100% !important;
  animation: post-flow 8s linear infinite !important;
  border: 0 !important; color: #fff !important; font-weight: 700 !important;
  box-shadow: 0 6px 18px -6px rgba(79,70,229,.55), inset 0 1px 0 rgba(255,255,255,.45) !important;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.25), box-shadow .2s ease !important;
}
/* glossy top sheen */
body.theme-quiet .topbar .btn-post::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, rgba(255,255,255,.4), rgba(255,255,255,0));
  pointer-events: none; z-index: 1;
}
/* shine streak that sweeps across on hover */
body.theme-quiet .topbar .btn-post::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -65%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-18deg); pointer-events: none; z-index: 2;
  transition: left .55s cubic-bezier(.4,0,.2,1);
}
body.theme-quiet .topbar .btn-post:hover {
  transform: translateY(-2px) scale(1.04) !important;
  box-shadow: 0 14px 30px -8px rgba(79,70,229,.85), 0 0 0 3px rgba(99,102,241,.14), inset 0 1px 0 rgba(255,255,255,.55) !important;
  filter: none !important;
}
body.theme-quiet .topbar .btn-post:hover::after { left: 125%; }
body.theme-quiet .topbar .btn-post:active { transform: translateY(0) scale(.97) !important; }
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .topbar .btn-post { animation: none !important; }
  body.theme-quiet .topbar .btn-post:hover { transform: none !important; }
  body.theme-quiet .topbar .btn-post::after { transition: none !important; }
}

/* ════════════════ Inner-page headers — give the floating header a glass panel ════════════════
   The admin/taxonomy/AI-import pages had their kicker+title+intro floating bare
   on the gradient. Wrap them in a frosted panel that matches the feed cards. */
body.theme-quiet .tax-head {
  background: rgba(255,255,255,.55) !important;
  -webkit-backdrop-filter: blur(30px) saturate(180%) !important; backdrop-filter: blur(30px) saturate(180%) !important;
  border: 1px solid rgba(255,255,255,.7) !important;
  border-radius: 18px !important;
  padding: 26px 30px !important;
  margin: 0 0 24px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 2px rgba(20,30,60,.04), 0 14px 38px -22px rgba(30,45,90,.18) !important;
}
body.theme-quiet .tax-head .tax-sub { margin-bottom: 0 !important; }

/* Save / Delete-card action row: keep the buttons on one baseline */
body.theme-quiet .links { align-items: center; }
body.theme-quiet .links .inline-form { display: inline-flex; align-items: center; margin: 0; }

/* The mobile hero is phone-only; the wide feed is its own hero on desktop. */
.feed-hero { display: none; }

/* ════════════════ MOBILE REDESIGN · Apple × glass × living aurora ════════════════
   Goal: the phone home greets you with a refined, premium first frame — a glass
   hero glowing on a rich, slowly-moving multi-hue aurora, above frosted cards.
   All phone-only (≤640); desktop and reduced-motion are untouched. */
@media (max-width: 640px) {
  /* ── Topbar: fits one clean row (avatar only), tighter brand + Post ── */
  body.theme-quiet .nav-menu-name,
  body.theme-quiet .nav-menu-caret { display: none !important; }
  body.theme-quiet .nav-right { gap: 10px !important; padding-left: 12px !important; }
  body.theme-quiet .brand-name { font-size: 1.12rem !important; letter-spacing: -.02em !important; }
  body.theme-quiet .brand-mark,
  body.theme-quiet .brand-mark:has(.brand-logo-img) { width: 38px !important; height: 38px !important; }
  body.theme-quiet .topbar .btn-post { height: 32px !important; padding: 0 13px !important; font-size: .8rem !important; }
  body.theme-quiet .topbar-inner { gap: 8px !important; }
  /* Topbar even more translucent so the hero glow flows up behind it */
  body.theme-quiet .topbar { background: rgba(247,249,253,.55) !important; }

  /* ── Living aurora: a richer, harmonious palette (blue · indigo · cyan ·
       periwinkle) on a soft cool wash, large + heavily blurred so it reads as
       a premium moving glow, not blobs. ── */
  body.theme-quiet {
    background-color: #e7ecf9 !important;
    background-image:
      radial-gradient(120% 60% at 50% -8%, rgba(99,102,241,.10), transparent 60%),
      radial-gradient(120% 50% at 50% 108%, rgba(56,189,248,.08), transparent 60%) !important;
  }
  body.theme-quiet .bg-aurora { opacity: 1 !important; }
  body.theme-quiet .bg-aurora span { filter: blur(46px) !important; mix-blend-mode: normal; }
  body.theme-quiet .bg-aurora span:nth-child(1) {
    width: 56vw !important; height: 56vw !important;
    background: radial-gradient(circle, rgba(59,130,246,.80), transparent 62%) !important;
  }
  body.theme-quiet .bg-aurora span:nth-child(2) {
    width: 50vw !important; height: 50vw !important;
    background: radial-gradient(circle, rgba(99,102,241,.78), transparent 62%) !important;
  }
  body.theme-quiet .bg-aurora span:nth-child(3) {
    width: 52vw !important; height: 52vw !important;
    background: radial-gradient(circle, rgba(56,189,248,.72), transparent 62%) !important;
  }
  body.theme-quiet .bg-aurora span:nth-child(4) {
    width: 48vw !important; height: 48vw !important;
    background: radial-gradient(circle, rgba(129,140,248,.74), transparent 62%) !important;
  }
  body.theme-quiet .bg-aurora span:nth-child(5) {
    width: 44vw !important; height: 44vw !important;
    background: radial-gradient(circle, rgba(37,99,235,.70), transparent 62%) !important;
  }

  /* ── The glass HERO — the wow on open ──────────────────────────────── */
  body.theme-quiet .feed-hero {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    position: relative; isolation: isolate;
    gap: 7px; padding: 14px 20px 20px; margin: 2px 0 4px;
    animation: heroRise .85s cubic-bezier(.2,.75,.3,1) both;
  }
  /* a bright concentrated halo so the hero is the luminous focal point */
  body.theme-quiet .feed-hero::before {
    content: ""; position: absolute; z-index: -1;
    left: 50%; top: 30%; width: 92vw; height: 240px; transform: translate(-50%,-50%);
    background:
      radial-gradient(50% 60% at 50% 50%, rgba(56,189,248,.30), transparent 70%),
      radial-gradient(60% 70% at 38% 40%, rgba(99,102,241,.30), transparent 72%),
      radial-gradient(60% 70% at 64% 56%, rgba(59,130,246,.28), transparent 72%);
    filter: blur(26px); pointer-events: none;
    animation: heroHalo 9s ease-in-out infinite;
  }
  body.theme-quiet .feed-hero-mark {
    width: 66px; height: 66px; display: grid; place-items: center;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.5));
    -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255,255,255,.9);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 26px -10px rgba(37,99,235,.5), 0 2px 6px rgba(20,30,60,.08);
  }
  body.theme-quiet .feed-hero-mark img { width: 78%; height: 78%; object-fit: contain; display: block;
    filter: drop-shadow(0 4px 8px rgba(15,39,80,.18)); }
  body.theme-quiet .feed-hero-mark.no-logo::after { content: "🦦"; font-size: 32px; }
  body.theme-quiet .feed-hero-title {
    margin: 4px 0 0; font-family: var(--sans);
    font-size: 2.15rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.02;
    color: #14213d;
  }
  body.theme-quiet .feed-hero-title span { color: #2563eb; }
  body.theme-quiet .feed-hero-sub {
    margin: 0; max-width: 19rem;
    font-size: .92rem; line-height: 1.4; font-weight: 500; color: #51607a;
  }

  /* ── Sticky search: a luminous frosted pill that glows over the aurora ── */
  body.theme-quiet.body-feed .feed-head { padding-top: 4px !important; }
  body.theme-quiet .feed-search {
    background: rgba(255,255,255,.42) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important; backdrop-filter: blur(28px) saturate(190%) !important;
    border: 1px solid rgba(255,255,255,.85) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 30px -16px rgba(30,45,90,.28) !important;
    border-radius: 16px !important;
  }

  /* ── Cards: deeper frosted glass, crisp white rim, soft layered lift so the
       moving aurora clearly lights each plate; gentle entrance. ── */
  body.theme-quiet.body-feed .feed-card {
    border-radius: 18px !important;
    background: rgba(255,255,255,.34) !important;
    -webkit-backdrop-filter: blur(26px) saturate(195%) !important; backdrop-filter: blur(26px) saturate(195%) !important;
    border: 1px solid rgba(255,255,255,.85) !important;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.9),
      0 1px 2px rgba(20,30,60,.05),
      0 16px 34px -18px rgba(30,45,90,.3) !important;
  }
  body.theme-quiet.body-feed .feed-card:hover { transform: translateY(-2px) !important; }
  body.theme-quiet .feed-card-title { letter-spacing: -.02em !important; }
}
@keyframes heroRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes heroHalo {
  0%, 100% { opacity: .85; transform: translate(-50%,-50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%,-52%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-quiet .feed-hero { animation: none !important; }
  body.theme-quiet .feed-hero::before { animation: none !important; }
}
