/* ==========================================================================
   Agent Search — Design System (theme.css)
   --------------------------------------------------------------------------
   Calm, warm and quietly literary. Katie uses this to decide who to trust her
   novel with, so the surface should feel like a good reading chair: soft cream
   ground, muted sage and eucalyptus, a warm clay accent, a soft rose used only
   as a highlight. Nothing shouty — no near-black, no all-caps headlines, no
   heavy admin drop-shadows.

   Deliberately NOT the Off-Field voice. That system leads with an acid
   chartreuse and Anton, a heavy ultra-condensed sports face; both are wrong
   here. The structure is inherited (it works); the character is new.

   Two open-licence (SIL OFL 1.1) faces, VENDORED and SELF-HOSTED under
   app/static/fonts/ — NO CDN, NO fonts.googleapis.com / gstatic.com requests
   at runtime:
     - Display + wordmark = LORA (variable transitional serif, 400–700) — warm,
       brushed-curve, bookish. Mixed case, never uppercase.
     - Body / UI = INTER (variable neo-grotesque, 400–700) — quiet and legible
       at small sizes, which is what a dense agent record needs.
   License texts: app/static/fonts/lora-OFL.txt, inter-OFL.txt.
   See PLAN.md §7.

   Light theme only. Mobile-first. Every text colour clears WCAG AA on every
   surface it is used on (verified, not assumed — scripts/contrast_check.py).
   ========================================================================== */

/* ==========================================================================
   Self-hosted webfonts (SIL OFL 1.1) — NO external requests
   --------------------------------------------------------------------------
   Both faces are variable and declared with a 400–700 range, so every weight
   the UI asks for maps onto a real master with NO synthetic bold. latin +
   latin-ext subsets each carry their own unicode-range.
   ========================================================================== */
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/lora-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/lora-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* --- Brand palette ----------------------------------------------------- */
  /* The whole palette sits in a narrow, low-contrast-to-each-other range so
     nothing fights for attention; contrast is spent on TEXT against ground,
     not on colour against colour. The rose is the only overtly feminine note
     and it is used sparingly — an active-nav underline, the wordmark dot, a
     highlight rule — never as a large fill. Token NAMES are inherited from the
     Off-Field system so the shared component rules keep working; the VALUES
     are all new.                                                             */
  --ink:       #2C3A33;  /* deep eucalyptus — primary text, not near-black   */
  --green:     #3F5A4C;  /* eucalyptus — links, dark surfaces, strong accent */
  --chartreuse:#D9AEB4;  /* soft rose — ACCENT ONLY (carries ink text)       */
  --pale:      #F3EEE5;  /* oat — banding, quote boxes, table header         */
  --pale2:     #FBF8F3;  /* soft cream — page background                     */
  --rust:      #9E4F35;  /* terracotta — warnings / stale / unverified flags */
  --grey:      #55605A;  /* muted (AA on cream, oat and white) — secondary   */
  --line:      #E6DFD4;  /* warm stone rule / borders                        */
  --white:     #FFFFFF;

  /* Extra tokens this system adds (the Off-Field one had no equivalents).    */
  --sage:      #6E8C7B;  /* muted sage — fills/borders/chips, NEVER text     */
  --sage-soft: #E4EBE4;  /* palest sage — success + "sourced" backgrounds    */
  --clay:      #9C5C3C;  /* warm clay — secondary accent, AA on cream        */
  --clay-soft: #F6E9E0;  /* palest clay — warning backgrounds                */
  --rose:      #D9AEB4;  /* soft rose — the one feminine highlight. Carries
                            INK text only (AA 6.06); --rose-deep on it is just
                            3.27, so never pair those two.                    */
  --rose-deep: #8E4A56;  /* deep rose — text colour for CREAM/WHITE grounds   */

  /* --- Semantic text tokens (never use a series colour for text) --------- */
  --text:        var(--ink);
  --text-muted:  var(--grey);
  --text-invert: var(--pale);        /* text on dark ink surfaces           */

  /* --- Surfaces --------------------------------------------------------- */
  --bg:        var(--pale2);
  --surface:   var(--white);
  --surface-2: var(--pale);
  --header-bg: var(--green);   /* eucalyptus, not near-black — softer top edge */

  /* --- Typography ------------------------------------------------------- */
  /* Warm transitional serif: Lora (self-hosted), falling back to the bookish
     system serif stack. Used mixed-case only.                               */
  --font-display: "Lora", Georgia, "Iowan Old Style", "Palatino Linotype",
                  Palatino, "Book Antiqua", "Times New Roman", serif;
  /* Neo-grotesque body/UI: Inter (self-hosted), falling back to system.     */
  --font-body: "Inter", "Segoe UI", "Helvetica Neue", Helvetica, Arial,
               system-ui, sans-serif;

  /* Type scale (1.25 major-third-ish, mobile-first) ---------------------- */
  --fs-xs:   0.75rem;   /* 12px — chips, meta                               */
  --fs-sm:   0.875rem;  /* 14px — secondary                                 */
  --fs-base: 1rem;      /* 16px — body                                      */
  --fs-md:   1.125rem;  /* 18px                                             */
  --fs-lg:   1.5rem;    /* 24px                                             */
  --fs-xl:   2rem;      /* 32px — section titles                            */
  --fs-2xl:  2.25rem;   /* 36px — stat numbers                             */
  --fs-3xl:  2.5rem;    /* 40px — page hero (a serif needs less size than a
                           condensed sans to carry the same weight)         */

  --lh-tight: 1.2;      /* display leading — a serif suffocates at 1.05     */
  --lh-snug:  1.25;
  --lh-body:  1.55;

  /* --- Spacing scale (4px base) ----------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* --- Radii (softer than Off-Field's — corners do a lot of the calming) - */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --r-pill: 999px;

  /* --- Shadows (barely there, tinted with the ink not with black) -------- */
  --shadow-sm: 0 1px 2px rgba(44, 58, 51, 0.05);
  --shadow-md: 0 2px 12px rgba(44, 58, 51, 0.07);

  --maxw: 1100px;
}

/* ==========================================================================
   Base / reset niceties
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Both faces carry real 400–700 masters; never let the browser fake a cut. */
  font-synthesis: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  /* A serif needs no tracking help, and none of these are ever uppercased —
     the calm comes from mixed-case type at a modest weight. */
  letter-spacing: 0;
  margin: 0 0 var(--sp-3);
  color: var(--ink);
  font-weight: 600;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-4); }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--sp-4);
}

main.container { padding-block: var(--sp-6) var(--sp-8); }

.page-head { margin-bottom: var(--sp-6); }
.page-head .eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: var(--fs-sm);
  color: var(--grey);
  margin: 0 0 var(--sp-2);
}
.page-head h1 { font-size: var(--fs-2xl); margin: 0; }
.page-head .sub { color: var(--text-muted); margin: var(--sp-2) 0 0; max-width: 60ch; }

/* ==========================================================================
   Header / top nav — dark ink bar with pale wordmark + chartreuse accents
   (the deck idiom: ink field, chartreuse pop)
   ========================================================================== */
.site-header {
  background: var(--header-bg);
  color: var(--text-invert);
  border-bottom: 2px solid var(--chartreuse);   /* thin accent line, not a slab */
}
.site-header .bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  color: var(--pale);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.wordmark:hover { color: var(--white); }
.wordmark .dash { color: var(--chartreuse); }   /* chartreuse hyphen on ink */
.wordmark .suffix {
  color: var(--grey);
  font-size: 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-left: var(--sp-2);
  vertical-align: middle;
}

.site-nav {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-left: auto;
}
.site-nav a {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-sm);
  color: var(--pale);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--chartreuse); background: rgba(255,255,255,0.05); }
.site-nav a[aria-current="page"] {
  color: var(--chartreuse);
  border-bottom-color: var(--chartreuse);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-top: var(--sp-8);
}
.site-footer .bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4);
  display: flex;
  gap: var(--sp-3);
  justify-content: space-between;
  flex-wrap: wrap;
}
.site-footer .wordmark { font-size: var(--fs-md); color: var(--ink); }
.site-footer .wordmark .dash { color: var(--green); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--green); color: var(--pale); }
.btn-primary:hover { background: var(--ink); color: var(--white); }
.btn-secondary {
  background: transparent; color: var(--ink); border-color: var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--pale); }
.btn-ghost { background: transparent; color: var(--green); }
.btn-ghost:hover { background: var(--pale); color: var(--ink); }
.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--fs-md);
  color: var(--ink);
  margin: 0 0 var(--sp-4);
}

/* ==========================================================================
   Stat tiles (headline numbers)
   ========================================================================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.stat-tile .label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0 0 var(--sp-2);
}
.stat-tile .value {
  font-family: var(--font-display);
  /* Fluid so long values (e.g. £638,000) never clip in a narrow tile. */
  font-size: clamp(1.6rem, 7vw, 2.75rem);
  line-height: 1;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
@media (min-width: 560px) {
  .stat-tile .value { font-size: var(--fs-2xl); }
}
.stat-tile .value .unit { font-size: 0.5em; color: var(--grey); margin-left: 2px; }
.stat-tile .foot { font-size: var(--fs-sm); color: var(--text-muted); margin: var(--sp-2) 0 0; }
/* Feature tile — the pipeline £, given the chartreuse-accented treatment */
.stat-tile.feature { border-color: var(--green); border-left-width: 4px; }
.stat-tile.feature .value { color: var(--green); }

/* ==========================================================================
   Breakdown bars (simple, glanceable magnitude/identity charts)
   Single-hue magnitude by default; semantic hues where the category IS a
   status (relevance, rating band). Every bar is direct-labelled — no legend
   guesswork — and all text sits on accessible surfaces.
   ========================================================================== */
.breakdowns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}
@media (min-width: 760px) {
  .breakdowns { grid-template-columns: 1fr 1fr; }
  .breakdowns .span-2 { grid-column: 1 / -1; }
}

.bars { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; }
.bar-row { display: grid; grid-template-columns: 1fr; gap: var(--sp-1); }
.bar-row .bar-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--sp-3);
}
.bar-row .bar-label { font-size: var(--fs-sm); color: var(--ink); }
.bar-row .bar-value {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bar-track {
  background: var(--pale);
  border-radius: var(--r-pill);
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--green);      /* default single-hue magnitude */
  min-width: 4px;
}
/* Semantic fills */
.bar-fill.pursue        { background: var(--green); }
.bar-fill.collaboration { background: var(--sage); }     /* olive-chartreuse, ink-legible neighbour */
.bar-fill.parked        { background: var(--grey); }
.bar-fill.band-top      { background: var(--green); }
.bar-fill.band-strong   { background: #4E6B5A; }
.bar-fill.band-worth    { background: var(--sage); }
.bar-fill.band-outside  { background: #A8BCA9; }
.bar-fill.band-park     { background: var(--grey); }

/* ==========================================================================
   Data tables
   ========================================================================== */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: var(--surface);
}
table.data th, table.data td {
  text-align: left;
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data thead th {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--fs-xs);
  color: var(--grey);
  background: var(--pale);
  position: sticky; top: 0;
}
table.data tbody tr:nth-child(even) { background: var(--pale2); }
table.data tbody tr:hover { background: var(--pale); }

/* ==========================================================================
   Form controls
   ========================================================================== */
label.field { display: block; margin-bottom: var(--sp-4); }
label.field > .lbl {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-1);
}
.input, input:not([type]), input[type="text"], input[type="email"],
input[type="password"], input[type="search"], input[type="number"],
select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.input:focus, input:not([type]):focus, input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 58, 34, 0.12);
}
textarea { min-height: 7rem; resize: vertical; }

/* ==========================================================================
   Chips & tags
   --------------------------------------------------------------------------
   Status chips are coloured from leads_data.py STATUS_COLORS. Every fill is
   paired with the STATUS_COLORS font colour so contrast is exactly as the
   deck/tracker intends. "Idea" (no STATUS_COLORS entry — it's the default for
   the 50 ideas) gets a neutral pale chip with ink text.
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  border: 1px solid transparent;
}

/* --- Status chips (from STATUS_COLORS: fill, font) --- */
.chip.status-idea     { background: var(--pale2); color: var(--ink); border-color: var(--line); }
.chip.status-sourced  { background: #8A8F86; color: #FFFFFF; }
.chip.status-approved { background: #4A6E8A; color: #FFFFFF; }
.chip.status-pitched  { background: #D8B27A; color: var(--ink); }   /* dark ink for WCAG AA on amber */
.chip.status-nudged   { background: var(--rust); color: #FFFFFF; }
.chip.status-linkedin { background: #6E7BA0; color: #FFFFFF; }
.chip.status-replied  { background: var(--sage); color: #FFFFFF; }
.chip.status-won      { background: #3F7A55; color: #FFFFFF; }
.chip.status-passed   { background: #96998F; color: var(--ink); }   /* dark ink for WCAG AA on grey */

/* --- Relevance tags (Pursue / Collaboration / Parked) ---
   Not in STATUS_COLORS — mapped onto the palette by meaning:
   Pursue = cash target (forest green), Collaboration = no-cash editorial
   (olive-chartreuse w/ ink text), Parked = deprioritised (muted grey).      */
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-body);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: var(--r-sm);
  border: 1.5px solid transparent; white-space: nowrap;
}
.tag.rel-pursue        { background: var(--green); color: var(--pale); }
.tag.rel-collaboration { background: var(--sage-soft); color: var(--ink); border-color: var(--sage); }
.tag.rel-parked        { background: transparent; color: var(--grey); border-color: var(--grey); }

/* --- Rating-band tags (sequential: strongest -> weakest) --- */
.tag.band-top     { background: var(--green);  color: var(--pale); }
.tag.band-strong  { background: #4E6B5A;       color: var(--pale); }
.tag.band-worth   { background: var(--sage-soft);       color: var(--ink); border-color: var(--sage); }
.tag.band-outside { background: var(--pale);   color: var(--ink); border-color: var(--line); }
.tag.band-park    { background: transparent;   color: var(--grey); border-color: var(--grey); }

/* Warning / unverified flag */
.flag-warn { color: var(--rust); font-weight: 700; font-size: var(--fs-xs); }

/* ==========================================================================
   Header user menu (identity + sign out) — the ADMIN_PATTERN identity footer,
   rendered inline in the ink top-bar in Off-Field's brand.
   ========================================================================== */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: var(--sp-3);
  padding-left: var(--sp-3);
  border-left: 1px solid rgba(246, 248, 219, 0.18);
}
.user-menu .user-id { display: flex; flex-direction: column; line-height: 1.15; }
.user-menu .user-name {
  font-size: var(--fs-sm); font-weight: 600; color: var(--pale); white-space: nowrap;
}
.user-menu .user-role {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-size: var(--fs-xs); color: var(--chartreuse);
}
.user-menu .signout {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: var(--fs-xs);
  color: var(--pale); text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border: 1.5px solid rgba(246, 248, 219, 0.35);
  border-radius: var(--r-pill); white-space: nowrap;
}
.user-menu .signout:hover { color: var(--ink); background: var(--chartreuse); border-color: var(--chartreuse); }

/* ==========================================================================
   Auth card (login / MFA) — the second chrome: centred card, no nav.
   ========================================================================== */
.auth-body {
  min-height: 100vh;
  display: flex;
  background: var(--ink);
}
.auth-shell {
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--chartreuse);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-5);
  box-shadow: var(--shadow-md);
}
.auth-wordmark {
  display: inline-block;
  color: var(--ink);
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-5);
}
.auth-wordmark .dash { color: var(--green); }
.auth-wordmark .suffix { color: var(--grey); }
.auth-title { font-size: var(--fs-xl); margin: 0 0 var(--sp-2); }
.auth-sub { color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-5); }
.auth-form .field { margin-bottom: var(--sp-4); }
.auth-submit { width: 100%; justify-content: center; margin-top: var(--sp-2); }
.auth-alt { margin: var(--sp-4) 0 0; font-size: var(--fs-sm); }
.auth-foot {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.16em;
  font-size: var(--fs-xs); color: var(--grey); margin: 0;
}

/* ==========================================================================
   Notes / flash + one-time secret box
   ========================================================================== */
.note {
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.note-error { background: var(--clay-soft); border-color: var(--rust); color: #7C3B24; }
.note-ok { background: var(--sage-soft); border-color: var(--sage); color: #2E4A3B; }

.secret-box {
  border: 2px dashed var(--green);
  background: var(--pale);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.secret-box .secret-title { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.secret-box .secret-warn { color: #7C3B24; margin: 0 0 var(--sp-3); }
.secret-box .secret-label {
  font-weight: 700; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey);
}
.secret-box code {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px 7px;
  font-size: var(--fs-sm);
  margin: 2px 4px 2px 0;
  word-break: break-all;
}
.secret-box code.secret-uri { display: block; max-width: 100%; overflow-wrap: anywhere; }

/* ==========================================================================
   Admin — Users page
   ========================================================================== */
.add-user-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  align-items: end;
}
.add-user-form .field { margin-bottom: 0; }
.add-user-submit { align-self: end; }
@media (min-width: 680px) {
  .add-user-form { grid-template-columns: 1fr 1fr auto auto; }
}

.user-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.user-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--pale2);
}
.user-item-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-3); flex-wrap: wrap;
}
.user-item-id { display: flex; flex-direction: column; }
.user-item-name { font-weight: 700; color: var(--ink); }
.user-item-email { font-size: var(--fs-sm); color: var(--text-muted); }
.user-item-flags { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.user-item-meta { font-size: var(--fs-xs); margin: var(--sp-2) 0 var(--sp-3); }

.user-actions {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center;
}
.user-actions .inline, .sections-form { margin: 0; }
.user-actions .inline { display: inline-flex; gap: var(--sp-2); align-items: center; }
.user-actions select { width: auto; padding: var(--sp-2) var(--sp-3); }

.section-access { margin-top: var(--sp-3); }
.section-access summary {
  cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--green);
  padding: var(--sp-2) 0;
}
.section-checks {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  margin: var(--sp-2) 0 var(--sp-3);
}
.section-checks .check {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); margin: 0;
}
.section-checks .check input { width: auto; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.muted { color: var(--text-muted); }
.inline { display: inline; }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ==========================================================================
   P2 CMS — Work first · Tracker · Firms · Firm detail
   ========================================================================== */

/* --- Curated preset chips ------------------------------------------------- */
.presets { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.preset-chip {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--fs-xs);
  color: var(--ink); text-decoration: none;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-4);
  white-space: nowrap;
}
.preset-chip:hover { border-color: var(--green); color: var(--green); }
.preset-chip.is-active { background: var(--green); color: var(--pale); border-color: var(--green); }

.result-count { font-size: var(--fs-sm); margin: 0 0 var(--sp-4); }

/* --- Score pill (shared) -------------------------------------------------- */
.score-pill {
  display: inline-flex; align-items: baseline; gap: 1px;
  font-family: var(--font-display); font-weight: 700;
  background: var(--ink); color: var(--chartreuse);
  border-radius: var(--r-sm); padding: 2px 8px;
  font-size: var(--fs-md); line-height: 1;
}
.score-pill .of { font-size: 0.55em; color: var(--pale); opacity: 0.8; }
.score-pill.lg { font-size: var(--fs-xl); padding: 4px 12px; }

.chip.ne-chip { background: var(--green); color: var(--pale); border: none; }

/* --- Work first cockpit --------------------------------------------------- */
.work-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
@media (min-width: 900px) { .work-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.work-card {
  display: block; min-width: 0; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-sm); transition: box-shadow .12s ease, border-color .12s ease;
}
.work-card:hover { box-shadow: var(--shadow-md); border-left-color: var(--chartreuse); }
.work-card-top { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-start; }
.work-card-id { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.work-card-id .ref { font-family: var(--font-display); color: var(--grey); font-size: var(--fs-sm); }
.work-card-id .company { font-family: var(--font-display); font-size: var(--fs-lg); text-transform: uppercase; color: var(--ink); overflow-wrap: anywhere; }
.work-card-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.work-card-meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; color: var(--text-muted); font-size: var(--fs-sm); margin: var(--sp-3) 0; }
.work-card-meta .sep { color: var(--line); }
.work-card-meta .val { font-family: var(--font-display); font-weight: 700; color: var(--green); }
.work-card-play { margin: 0; display: grid; gap: var(--sp-2); }
.work-card-play > div { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: var(--sp-3); }
.work-card-play dt { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--fs-xs); color: var(--grey); }
.work-card-play dd { margin: 0; min-width: 0; font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }

/* --- Tracker toolbar + grid ---------------------------------------------- */
.tracker-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-5);
  align-items: flex-end; justify-content: space-between; margin-bottom: var(--sp-4);
}
.filter-form { display: flex; flex-wrap: wrap; gap: var(--sp-3); max-width: 100%; }
.filter { display: flex; flex-direction: column; gap: var(--sp-1); margin: 0; flex: 1 1 140px; min-width: 0; }
.filter .lbl { font-size: var(--fs-xs); font-weight: 600; color: var(--grey); text-transform: uppercase; letter-spacing: 0.05em; }
.filter select, .filter input { width: 100%; min-width: 0; max-width: 100%; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.export-links { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.tracker-grid td, .tracker-grid th { white-space: nowrap; }
.tracker-grid .cell-offering, .tracker-grid .cell-company { white-space: normal; min-width: 140px; }
.tracker-grid td.num, .tracker-grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tracker-grid .mono { font-family: var(--font-display); color: var(--grey); }
.tracker-grid .cell-company a { font-family: var(--font-display); text-transform: uppercase; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); }
.tracker-grid .cell-company a:hover { color: var(--green); text-decoration: underline; }
.th-sort a { color: var(--grey); text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
/* Hover/active sort stay on the ink/green ladder — chartreuse on the pale
   table header is illegible, so it is never used for text here. */
.th-sort a:hover { color: var(--green); text-decoration: underline; }
.th-sort.is-sorted a { color: var(--ink); }
.sort-caret { font-size: 0.7em; color: var(--green); }
.conf { font-size: var(--fs-xs); font-weight: 700; padding: 2px 6px; border-radius: var(--r-sm); white-space: nowrap; }
.conf-ok { background: var(--sage-soft); color: #2E4A3B; }
.conf-warn { background: var(--clay-soft); color: var(--rust); }

/* --- Firms list grid ----------------------------------------------------- */
.firm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-4); }
.firm-tile {
  display: flex; flex-direction: column; gap: var(--sp-2);
  text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-4);
  box-shadow: var(--shadow-sm); transition: box-shadow .12s ease;
}
.firm-tile:hover { box-shadow: var(--shadow-md); }
.firm-tile-head { display: flex; justify-content: space-between; align-items: center; }
.firm-tile-head .ref { font-family: var(--font-display); color: var(--grey); font-size: var(--fs-sm); }
.firm-tile-company { font-family: var(--font-display); text-transform: uppercase; font-size: var(--fs-md); color: var(--ink); margin: 0; line-height: 1.1; }
.firm-tile-meta { font-size: var(--fs-xs); margin: 0; }
.firm-tile-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: auto; }

/* --- Firm detail --------------------------------------------------------- */
.crumb { font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.firm-header { margin-bottom: var(--sp-5); }
.firm-header .eyebrow { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--fs-xs); color: var(--grey); margin: 0 0 var(--sp-2); }
.firm-header h1 { font-size: var(--fs-2xl); margin: 0 0 var(--sp-3); }
.firm-header-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-3); }
.firm-header-offer { font-size: var(--fs-md); color: var(--ink); margin: 0 0 var(--sp-2); }
.firm-relnote { font-size: var(--fs-sm); max-width: 70ch; margin: 0; }
.readonly-note { font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

/* --- Stage / "where we are" summary (OPEN_ISSUES #12) — the first thing you
   see on a firm: current stage + relevance + band, plus last contact + next
   action. Ink/olive-led, calm surface. ------------------------------------ */
.firm-stage {
  display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-6);
  align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm); margin-bottom: var(--sp-5);
}
.stage-eyebrow { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--fs-xs); color: var(--grey); margin: 0 0 var(--sp-2); }
.stage-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.chip-lg { font-size: var(--fs-sm); padding: 7px 14px; }
.stage-meta { display: flex; gap: var(--sp-4) var(--sp-6); flex-wrap: wrap; margin: 0; }
.stage-meta > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-meta dt { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--fs-xs); color: var(--grey); }
.stage-meta dd { margin: 0; font-size: var(--fs-base); color: var(--ink); overflow-wrap: anywhere; }

/* --- Readable-by-default / Edit-toggle (OPEN_ISSUES #5) ------------------
   The firm record renders as readable text; the Edit toggle swaps individual
   fields to full-size, auto-growing inputs. Edit-only controls stay hidden
   until editing; view-only affordances (copy buttons) hide while editing.   */
.firm-detail .edit,
.firm-detail .edit-only { display: none; }
.firm-detail.is-editing .view,
.firm-detail.is-editing .view-only { display: none; }
.firm-detail.is-editing textarea.edit,
.firm-detail.is-editing input.edit,
.firm-detail.is-editing select.edit { display: block; }
.firm-detail.is-editing .rd-input.edit { display: inline-block; }
.firm-detail.is-editing .btn.edit-only { display: inline-flex; }
.firm-detail.is-editing .edit-hint.edit-only { display: inline; }
.firm-detail.is-editing .firm-edit-actions.edit-only { display: flex; }

/* Readable view text — generous, full content visible (never a cramped box). */
.firm-detail .view { font-size: var(--fs-base); line-height: var(--lh-body); color: var(--ink); }
.bc-row dd .view { white-space: pre-line; }
.firm-detail .field { display: block; margin-bottom: var(--sp-4); }
.firm-detail .field > .lbl { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: var(--sp-1); }
/* Auto-growing edit textareas size to content — no tiny scroll boxes. */
.firm-detail textarea.ag { min-height: 2.8rem; overflow: hidden; resize: vertical; line-height: var(--lh-body); }
.edit-hint { font-size: var(--fs-sm); }

.firm-cols { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 860px) { .firm-cols { grid-template-columns: 2fr 1fr; align-items: start; } }
.firm-col-main, .firm-col-side { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }

.bc { margin: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.bc-row { display: grid; grid-template-columns: 1fr; gap: var(--sp-1); }
@media (min-width: 620px) { .bc-row { grid-template-columns: 160px 1fr; gap: var(--sp-3); } }
.bc-row dt { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--fs-xs); color: var(--grey); }
.bc-row dd { margin: 0; font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }
.bc-row textarea { min-height: 2.6rem; }
.sources { margin: 0; padding-left: 1.1em; font-size: var(--fs-sm); }
.sources li { overflow-wrap: anywhere; margin-bottom: var(--sp-1); }

.draft .draft-lbl { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--fs-xs); color: var(--grey); margin: var(--sp-3) 0 var(--sp-1); }
.draft-subject { font-weight: 600; margin: 0; }
.draft-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--pale2); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); margin: 0; font-family: var(--font-body); font-size: var(--fs-sm); line-height: var(--lh-body); }

.rating-dims { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.rating-dim { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); background: var(--pale2); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); }
.rd-label { font-size: var(--fs-sm); color: var(--ink); }
.rd-value { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.rd-of { font-size: 0.6em; color: var(--grey); }
.rd-input { width: 60px; padding: var(--sp-1) var(--sp-2); text-align: center; }
.rating-total { font-size: var(--fs-md); margin: var(--sp-2) 0 var(--sp-4); }
.rd-watch-label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--fs-xs); color: var(--grey); margin-bottom: var(--sp-1); }

.firm-edit-actions { display: flex; gap: var(--sp-3); align-items: center; margin: var(--sp-5) 0; flex-wrap: wrap; }

.copy-card { margin-top: var(--sp-5); }
.copy-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }
.copy-status { font-size: var(--fs-sm); color: var(--green); font-weight: 600; }
/* One-click copy confirmation — the button itself flips to "Copied ✓". */
.copy-btn.is-copied { background: var(--green); color: var(--pale); border-color: var(--green); }

.log-form { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; margin-bottom: var(--sp-4); }
.log-form .grow { flex: 1 1 180px; }
.log-form .filter input { min-width: 0; width: 100%; }
.log-submit { align-self: flex-end; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.timeline-item { display: flex; gap: var(--sp-3); align-items: baseline; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.tl-date { font-family: var(--font-display); color: var(--grey); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.tl-body { font-size: var(--fs-sm); color: var(--ink); }
.tl-learn { color: var(--text-muted); }

/* ==========================================================================
   ROUND 2 — clickable rows, firms sort, tooltips, band legend, reason capture,
   per-firm history, admin sub-nav + audit review
   ========================================================================== */

/* --- R2-1: clickable tracker rows (the whole row links to the firm) ------- */
.tracker-grid tr.row-link { cursor: pointer; }
.tracker-grid tr.row-link:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }

/* --- R2-2: Firms-page sort bar (same behaviour as the tracker headers) ---- */
.sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.sort-bar-label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-xs); color: var(--grey); margin-right: var(--sp-1); }
.sort-opt {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--fs-xs); color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-pill); padding: var(--sp-2) var(--sp-4); white-space: nowrap;
}
.sort-opt:hover { border-color: var(--green); color: var(--green); }
.sort-opt.is-sorted { background: var(--green); color: var(--pale); border-color: var(--green); }
.sort-opt.is-sorted .sort-caret { color: var(--pale); }

/* --- R2-4: accessible tooltips (hover + keyboard focus + tap) ------------- */
.rating-dims { position: relative; }   /* anchor the bubble to the card, not the narrow dim → never overflows at 390px */
.tip {
  display: inline-flex; align-items: center; vertical-align: middle;
  background: none; border: 0; padding: 0 0 0 3px; margin: 0; cursor: help; line-height: 1;
}
.tip-icon { font-size: 0.9em; color: var(--grey); line-height: 1; }
.tip:hover .tip-icon, .tip:focus-visible .tip-icon { color: var(--green); }
.tip-bubble {
  display: none;
  /* Opens ABOVE the rating grid (anchored to .rating-dims, full width) so it can
     never overflow horizontally at 390px and never covers the band legend below. */
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--ink); color: var(--text-invert);
  font-family: var(--font-body); font-weight: 400; font-size: var(--fs-sm);
  line-height: var(--lh-snug); text-transform: none; letter-spacing: normal;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.tip:hover .tip-bubble, .tip:focus .tip-bubble, .tip:focus-within .tip-bubble { display: block; }
.tip-inline { color: var(--grey); }

/* --- R2-4: band legend --------------------------------------------------- */
.band-legend {
  list-style: none; margin: 0 0 var(--sp-4); padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.band-legend li { white-space: nowrap; }
.bl-range { font-family: var(--font-display); color: var(--ink); font-weight: 700; }

/* --- R2-3 / R2-5: reason capture on the edit form ------------------------ */
.reason-block { margin: 0 0 var(--sp-5); }
.reason-block .lbl { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: var(--sp-2); }
.firm-detail.is-editing .reason-block.edit-only { display: block; }

/* --- R2-6: per-firm history timeline ------------------------------------- */
.tl-channel { flex-shrink: 0; }
.tl-changes { margin: 0; padding-left: 1.1em; font-size: var(--fs-sm); color: var(--ink); }
.tl-changes li { overflow-wrap: anywhere; margin-bottom: 2px; }
.tl-reason { display: block; color: var(--green); font-style: italic; margin-top: 2px; overflow-wrap: anywhere; }
.tl-actor { color: var(--text-muted); font-size: var(--fs-xs); margin-left: var(--sp-1); white-space: nowrap; }

/* --- R2-6: admin sub-nav + audit review ---------------------------------- */
.admin-tabs {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  margin-bottom: var(--sp-5); border-bottom: 1px solid var(--line);
}
.admin-tabs a {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--fs-sm); color: var(--grey); text-decoration: none;
  padding: var(--sp-2) var(--sp-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-tabs a:hover { color: var(--green); }
.admin-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); }

.audit-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); align-items: flex-end; margin-bottom: var(--sp-4); }
.audit-filters .filter { flex: 1 1 150px; min-width: 0; }
.audit-filter-actions { display: flex; gap: var(--sp-2); align-items: center; }
.audit-table td { font-size: var(--fs-sm); }
.audit-table .nowrap { white-space: nowrap; }
.audit-detail { min-width: 220px; white-space: normal; }
.audit-detail .tl-reason { margin-top: var(--sp-1); }

/* ==========================================================================
   AGENT SEARCH COMPONENTS
   --------------------------------------------------------------------------
   Everything below is this product's own. The rules above are the inherited
   Off-Field structure (layout, buttons, tables, chips, forms) recoloured to
   the calm palette.

   One rule runs through all of it: a claim we can't source, or can no longer
   vouch for, must LOOK that way. Terracotta and a dotted underline mean
   "don't act on this yet"; sage means "checked". Nothing is styled to look
   more certain than it is.
   ========================================================================== */

/* --- Utilities ---------------------------------------------------------- */
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: var(--sp-2); }
.block { display: block; }
.muted-xs { font-size: var(--fs-xs); color: var(--text-muted); }
.dot { color: var(--line); margin: 0 4px; }
.csv { color: var(--text-muted); }
.of { font-size: 0.55em; color: var(--grey); margin-left: 2px; }
.pc { font-size: 0.5em; margin-left: 1px; }

.section-title {
  font-size: var(--fs-lg); margin: var(--sp-7) 0 var(--sp-4);
  display: flex; align-items: baseline; gap: var(--sp-3);
}
.section-title .count {
  font-family: var(--font-body); font-size: var(--fs-sm);
  font-weight: 600; color: var(--grey);
  background: var(--pale); border-radius: var(--r-pill); padding: 2px 10px;
}
.mini-title {
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey);
  margin: var(--sp-5) 0 var(--sp-2);
}

/* --- Cards -------------------------------------------------------------- */
.card + .card, .card + section.card { margin-top: var(--sp-5); }
.card-head { margin-bottom: var(--sp-4); }
.card-head h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.card-head .sub { color: var(--text-muted); font-size: var(--fs-sm); max-width: 66ch; }
.card-quiet { background: var(--pale2); box-shadow: none; }
.card-calm { background: var(--sage-soft); border: 1px solid var(--sage); box-shadow: none; }

/* --- Stat row ----------------------------------------------------------- */
.stat-row { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat {
  flex: 1 1 150px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 2px;
}
.stat-n {
  font-family: var(--font-display); font-size: var(--fs-2xl);
  font-weight: 600; line-height: 1; color: var(--ink);
}
.stat-l { font-size: var(--fs-sm); color: var(--text-muted); }
.stat-l .raw { display: block; font-size: var(--fs-xs); }
.stat-accent { border-left: 3px solid var(--rose); }
.stat-accent .stat-n { color: var(--green); }

/* --- Openness chips: the perishable field ------------------------------- */
.chip.open-yes      { background: var(--sage-soft); color: var(--ink); border-color: var(--sage); }
.chip.open-qt       { background: var(--pale); color: var(--ink); border-color: var(--sage); }
.chip.open-no       { background: transparent; color: var(--grey); border-color: var(--grey); }
.chip.open-paused   { background: var(--clay-soft); color: #7C3B24; border-color: var(--clay); }
.chip.open-unknown  { background: transparent; color: var(--grey); border-color: var(--line); }
/* Stale wins over whatever the status says — we can't vouch for it. */
.chip.is-stale {
  background: var(--clay-soft) !important; color: #7C3B24 !important;
  border-color: var(--rust) !important; border-style: dashed !important;
}

/* --- Flags and provenance ---------------------------------------------- */
.flag {
  display: inline-block; font-size: var(--fs-xs); font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--pale); color: var(--grey); border: 1px solid var(--line);
}
.flag-warn { background: var(--clay-soft); color: #7C3B24; border-color: var(--rust); }
.flag-note { background: var(--rose); color: var(--ink); border-color: var(--rose-deep); }

.src { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.src-ok      { color: var(--green); }
.src-old     { color: var(--clay); }
.src-nodate  { color: var(--clay); }
.src-missing { color: var(--rust); border-bottom: 1px dotted var(--rust); }

.conf { font-size: var(--fs-xs); font-weight: 700; padding: 2px 6px; border-radius: var(--r-sm); }
.conf-verified { background: var(--sage-soft); color: #2E4A3B; }
.conf-generic  { background: var(--pale); color: var(--grey); }
.conf-inferred { background: var(--clay-soft); color: #7C3B24; border: 1px dashed var(--rust); }

.intent { font-size: var(--fs-xs); font-weight: 600; }
.intent-shortlist { color: var(--green); }
.intent-consider  { color: var(--grey); }
.intent-skip      { color: var(--line); }

/* --- Katie's theme chips ------------------------------------------------ */
.theme-chips { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0; margin: 0 0 var(--sp-3); }
.theme-chip {
  font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--rose); color: var(--ink); white-space: nowrap;
}
.theme-chip.sm { font-size: 0.7rem; padding: 2px 7px; display: inline-block; margin: 1px; }

/* --- Action lists (Today) ---------------------------------------------- */
.action-list { list-style: none; padding: 0; margin: 0; }
.action-list li {
  display: grid; grid-template-columns: 1fr auto auto; gap: var(--sp-3);
  align-items: center; padding: var(--sp-3) 0; border-top: 1px solid var(--line);
}
.action-list li:first-child { border-top: 0; }
.action-main { min-width: 0; }
.action-name { font-family: var(--font-display); font-size: var(--fs-md); color: var(--ink); text-decoration: none; display: block; }
a.action-name:hover { color: var(--green); text-decoration: underline; }
.action-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.action-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }

/* --- Agent cards (Shortlist) ------------------------------------------- */
.agent-cards { display: grid; gap: var(--sp-4); }
.agent-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm);
}
.ac-head { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.ac-name { margin: 0 0 2px; font-size: var(--fs-lg); }
.ac-name a { color: var(--ink); text-decoration: none; }
.ac-name a:hover { color: var(--green); text-decoration: underline; }
.ac-agency { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.ac-score { text-align: right; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end; }
.ac-total { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--ink); }
.ac-status { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0; flex-wrap: wrap; }
.ac-quote, .quote-block {
  font-family: var(--font-display); font-size: var(--fs-md); font-style: italic;
  background: var(--pale); border-left: 3px solid var(--sage);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 0 0 var(--sp-4); padding: var(--sp-4) var(--sp-5); color: var(--ink);
}
.ac-quote cite, .quote-block cite {
  display: block; margin-top: var(--sp-2); font-family: var(--font-body);
  font-style: normal; font-size: var(--fs-xs); color: var(--grey);
}
.our-read { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--clay); }
.our-read-block { background: var(--pale2); border: 1px dashed var(--line); border-radius: var(--r-md); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.our-read-block p:first-child { margin-bottom: var(--sp-1); }
.ac-summary { font-size: var(--fs-sm); }
.ac-hook { background: var(--sage-soft); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); }
.hook-label, .watch-label {
  display: block; font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--grey); margin-bottom: 2px;
}
.ac-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: var(--sp-3); margin-top: var(--sp-2); }
.ac-route { font-size: var(--fs-xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ac-route .route { font-weight: 600; color: var(--ink); }

/* --- Blocked rows ------------------------------------------------------ */
.blocked-list { border-top: 1px solid var(--line); }
.blocked-row {
  display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) auto minmax(0,1.2fr);
  gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line); font-size: var(--fs-sm);
}
.br-name { font-family: var(--font-display); color: var(--ink); text-decoration: none; }
.br-name:hover { color: var(--green); text-decoration: underline; }
.br-agency, .br-why { color: var(--text-muted); font-size: var(--fs-xs); }

/* --- Filter bar -------------------------------------------------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-5);
}
.filter-actions { display: flex; gap: var(--sp-2); }

/* --- Table cells ------------------------------------------------------- */
.cell-name a { font-family: var(--font-display); color: var(--ink); text-decoration: none; }
.cell-name a:hover { color: var(--green); text-decoration: underline; }
.cell-ref, .cell-terr { display: block; font-size: 0.7rem; color: var(--grey); }
.cell-themes { max-width: 220px; }
.cell-route, .cell-fit { font-size: var(--fs-xs); }
.cell-learn { font-size: var(--fs-xs); color: var(--text-muted); max-width: 280px; }

/* --- Agent detail: the status card ------------------------------------- */
.agent-head .head-links { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin: var(--sp-3) 0 0; font-size: var(--fs-sm); }
.status-card { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; border-left: 4px solid var(--sage); }
.status-card.status-stale { border-left-color: var(--rust); background: var(--clay-soft); }
.status-main { display: flex; gap: var(--sp-4); align-items: flex-start; }
.status-line { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.status-detail { margin: var(--sp-2) 0 0; }
.status-warn { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: #7C3B24; max-width: 60ch; }

.recheck summary { cursor: pointer; font-weight: 600; color: var(--green); }
.stack-form { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); max-width: 44rem; }
.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field .lbl { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--grey); }
.field .req { color: var(--rust); letter-spacing: 0; }
.field input, .field select, .field textarea { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.help { font-size: var(--fs-xs); color: var(--text-muted); }

/* --- Agent detail: two columns ---------------------------------------- */
.detail-cols { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 62rem) {
  .detail-cols { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
  .detail-side { position: sticky; top: var(--sp-4); }
}
.detail-side .card + .card { margin-top: var(--sp-4); }
.side-title { font-size: var(--fs-md); }
.side-band { margin: 0 0 var(--sp-2); }
.side-total { font-family: var(--font-display); font-size: var(--fs-2xl); margin: 0 0 var(--sp-4); }
.side-hook { background: var(--sage-soft); border: 1px solid var(--sage); }

.dims { margin: 0; }
.dim { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.dim dt { font-size: var(--fs-sm); color: var(--grey); cursor: help; }
.dim dd { margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.dim-bar { display: inline-flex; gap: 2px; }
.dim-bar i { width: 8px; height: 8px; border-radius: 2px; background: var(--line); }
.dim-bar i.on { background: var(--sage); }
.dim-n { font-size: var(--fs-xs); color: var(--grey); }
.watchout { background: var(--clay-soft); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-4); font-size: var(--fs-sm); }

.src-list { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); }
.src-list li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.src-list li:first-child { border-top: 0; }
.src-what { color: var(--grey); }

/* --- Submission spec: the checklist ----------------------------------- */
.spec { margin: 0; }
.spec-row { display: grid; grid-template-columns: 11rem 1fr; gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.spec-row:first-child { border-top: 0; }
@media (max-width: 44rem) { .spec-row { grid-template-columns: 1fr; gap: var(--sp-1); } }
.spec-row dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--grey); }
.spec-row dd { margin: 0; overflow-wrap: anywhere; }
.spec-row-warn { background: var(--clay-soft); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); border-top-color: var(--rust); }
.email-strong { font-weight: 600; }
.checklist { margin: 0; padding-left: 1.1rem; }
.checklist li { margin-bottom: var(--sp-1); }
.spec-row code { background: var(--pale); padding: 2px 6px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
.agency-policy { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--text-muted); }
.no-list { margin: 0; padding-left: 1.1rem; color: var(--text-muted); font-size: var(--fs-sm); }

/* --- Deals, comps, clients, log --------------------------------------- */
.deal-list, .comp-list, .client-list, .sub-log, .batch-list { list-style: none; padding: 0; margin: 0; }
.deal-list > li, .comp-list > li, .client-list > li, .sub-log > li, .batch-list > li {
  padding: var(--sp-4) 0; border-top: 1px solid var(--line);
}
.deal-list > li:first-child, .comp-list > li:first-child,
.client-list > li:first-child, .sub-log > li:first-child,
.batch-list > li:first-child { border-top: 0; padding-top: 0; }
.deal-title, .comp-title, .client-name, .batch-name { font-family: var(--font-display); font-size: var(--fs-md); color: var(--ink); }
.deal-author, .comp-author, .client-titles, .batch-dates, .batch-n { font-size: var(--fs-sm); color: var(--text-muted); margin-left: var(--sp-2); }
.deal-meta { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.deal-sum, .comp-why, .client-why, .deal-rel, .batch-pkg, .batch-learn, .sl-reply, .sl-learn {
  font-size: var(--fs-sm); margin-top: var(--sp-2);
}
.sl-dates { font-size: var(--fs-xs); color: var(--text-muted); margin-left: var(--sp-2); }

/* --- Funnel ----------------------------------------------------------- */
.funnel { list-style: none; padding: 0; margin: 0; }
.funnel-row { display: grid; grid-template-columns: 9rem 1fr 3rem; gap: var(--sp-3); align-items: center; padding: var(--sp-2) 0; }
.funnel-label { font-size: var(--fs-sm); color: var(--grey); }
.funnel-bar { background: var(--pale); border-radius: var(--r-pill); height: 10px; overflow: hidden; }
.funnel-fill { display: block; height: 100%; background: var(--sage); border-radius: var(--r-pill); }
.funnel-n { font-family: var(--font-display); text-align: right; color: var(--ink); }

/* --- Mobile ----------------------------------------------------------- */
@media (max-width: 40rem) {
  .action-list li { grid-template-columns: 1fr; }
  .action-meta { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; gap: var(--sp-2); }
  .blocked-row { grid-template-columns: 1fr; gap: var(--sp-1); }
  .stat { flex: 1 1 100%; }
  .funnel-row { grid-template-columns: 7rem 1fr 2.5rem; }
  .ac-head, .ac-score { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* --- "Read it yourself": the primary-material reading list --------------
   Given more visual weight than a normal card, because this app deliberately
   does not interpret for Katie — handing her the sources IS the feature, not a
   footnote to it. Rose left edge because it's the one thing on the page we
   actively want her to click. */
.reading-card { border-left: 4px solid var(--rose); }
.reading-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.reading-item { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.reading-item:first-child { border-top: 0; }
.reading-title {
  font-family: var(--font-display); font-size: var(--fs-md);
  color: var(--green); text-decoration: none; display: inline-block;
}
.reading-title:hover { color: var(--ink); text-decoration: underline; }
.reading-meta {
  display: block; font-size: var(--fs-xs); color: var(--text-muted);
  margin-top: 2px;
}
.reading-note { font-size: var(--fs-sm); margin-top: var(--sp-2); max-width: 70ch; }

/* --- Submission status chips (THIS app's vocabulary) --------------------
   app.models.SUBMISSION_STATUSES, via display.status_class(). These come LAST
   in the file so they win the cascade over the inherited Off-Field chip rules
   above, which use a different vocabulary entirely (Idea/Sourced/Pitched/
   LinkedIn/Won). The two that must never look alike are Offer and Passed --
   they are the outcomes Katie scans the log for. Green carries good news, rose
   marks the best outcome, and the two dead ends are outlined rather than filled
   so a finished row reads as quiet rather than as another thing to do. */
.chip.status-shortlisted    { background: var(--pale); color: var(--ink); border-color: var(--line); }
.chip.status-queued         { background: var(--pale); color: var(--ink); border-color: var(--sage); }
.chip.status-sent           { background: var(--sage); color: var(--white); border-color: var(--sage); }
.chip.status-nudged         { background: var(--clay-soft); color: #7C3B24; border-color: var(--clay); }
.chip.status-full-requested { background: var(--green); color: var(--pale); border-color: var(--green); }
.chip.status-offer          { background: var(--rose); color: var(--ink); border-color: var(--rose-deep); font-weight: 700; }
.chip.status-passed         { background: transparent; color: var(--grey); border-color: var(--grey); }
.chip.status-no-reply       { background: transparent; color: var(--grey); border-color: var(--line); border-style: dashed; }
.chip.status-unset          { background: transparent; color: var(--grey); border-color: var(--line); }

/* --- Header layout fix -------------------------------------------------
   The identity block was wrapping onto a second row below the nav even at
   1440px, which pushed the whole page down and read as a mistake. Pin it to
   the right on wide screens and let the nav take the slack; below that it is
   allowed to wrap, which is correct on a phone. */
@media (min-width: 62rem) {
  .site-header .bar { flex-wrap: nowrap; }
  .site-header .site-nav { flex: 1 1 auto; min-width: 0; }
  .site-header .user-menu { margin-left: auto; flex: 0 0 auto; }
}

/* --- INHERITED DEAD CSS: DO NOT REUSE THESE CLASSES --------------------
   Everything between the design tokens and the "AGENT SEARCH COMPONENTS"
   banner is the Off-Field CMS component library. It is kept because this app's
   own components build on parts of it (.card, .chip, .tag, .btn, table.data,
   .filter, .note, .secret-box, forms, layout). But a number of rules in there
   are for Off-Field screens that DO NOT EXIST here: .work-card*,
   .tracker-grid*, .firm-*, .stage-*, .bc-row, .draft-*, .rd-*, .timeline/.tl-*,
   .bar-*, .stat-tile, .presets, .copy-*, .rel-*, and the Off-Field status chips.

   Do NOT style new markup with those classes. Several of them uppercase a
   name-bearing element (.firm-tile-company, .work-card-id .company,
   .tracker-grid .cell-company a), which in THIS app would render a real
   person's name as JULIET MUSHENS -- the wrong register entirely in a tool
   whose whole purpose is writing to that person.

   A mechanical prune of these rules was attempted and REVERTED: it removed 123
   blocks but left the stylesheet with 3 unbalanced braces, which silently
   killed every rule after the error (the stat numbers and the calm card stopped
   rendering, caught only by looking at a screenshot). If it is attempted again:
   verify brace balance and re-shoot every screen before believing it. */

/* --- Inline source links ------------------------------------------------
   Wherever the app flags something -- a watch-out, a summary, a client, a comp,
   an agency's AI wording -- there is a link to the page it came from, so none of
   it has to be taken on trust. These are the rows of small links under those
   blocks. Kept quiet visually: they should be there when wanted, not shouting. */
.watch-links, .summary-links, .ac-links {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-3); font-size: var(--fs-xs);
}
.watch-links a, .summary-links a, .ac-links a { color: var(--green); }
.watch-links a:hover, .summary-links a:hover, .ac-links a:hover { color: var(--ink); }
.ac-links { margin-top: 0; }
.ac-foot { gap: var(--sp-4); }
.client-list .src, .comp-list .src { margin-left: var(--sp-2); }

/* --- To-do ---------------------------------------------------------------
   A list with a tick box, not a project manager. The tick is a real button in
   its own form so it works with no JavaScript at all. */
.todo-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); align-items: end; }
.todo-field-title { grid-column: span 2; }
.todo-field-detail { grid-column: span 3; }
.todo-submit { display: flex; align-items: flex-end; }
@media (max-width: 52rem) {
  .todo-form { grid-template-columns: 1fr; }
  .todo-field-title, .todo-field-detail { grid-column: span 1; }
}

.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-item {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) 0; border-top: 1px solid var(--line);
}
.todo-item:first-child { border-top: 0; }
.todo-tick { margin: 0; }
.tick {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 1.25rem; line-height: 1.2; color: var(--sage);
}
.tick:hover { color: var(--green); }
.tick.is-done { color: var(--sage); }
.todo-body { min-width: 0; flex: 1; }
.todo-title { font-size: var(--fs-md); color: var(--ink); }
.todo-meta { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.todo-overdue { color: var(--rust); font-weight: 600; }
.todo-item.is-overdue { border-left: 3px solid var(--rust); padding-left: var(--sp-3); }
.todo-detail { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }
.todo-done .todo-title { color: var(--grey); text-decoration: line-through; }
.todo-edit, .cc-edit, .note-edit { margin-top: var(--sp-2); }
.todo-edit summary, .cc-edit summary, .note-edit summary {
  cursor: pointer; font-size: var(--fs-xs); color: var(--green);
}
.todo-edit-actions { display: flex; gap: var(--sp-2); }

/* --- Comp titles -------------------------------------------------------- */
.comp-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); align-items: end; }
.comp-f-title { grid-column: span 2; }
.comp-f-why, .comp-f-themes { grid-column: span 4; }
.comp-f-src { grid-column: span 2; }
.comp-submit { grid-column: span 4; }
@media (max-width: 52rem) {
  .comp-form { grid-template-columns: 1fr; }
  .comp-f-title, .comp-f-why, .comp-f-themes, .comp-f-src, .comp-submit { grid-column: span 1; }
}
.theme-checks { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.theme-checks .check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
fieldset.field { border: 0; padding: 0; margin: 0; }

.comp-cards { display: grid; gap: var(--sp-4); }
.comp-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm);
}
.cc-head { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.cc-title { margin: 0 0 2px; font-size: var(--fs-md); }
.cc-meta { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.cc-flags { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-start; }
.cc-why { font-size: var(--fs-sm); margin: var(--sp-3) 0; }
.cc-agents { font-size: var(--fs-sm); margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; }
.cc-agents-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--grey); }

/* --- Her notes on an agent ---------------------------------------------
   Rose left edge: the one block on the page that is hers rather than ours. */
.notes-card { border-left: 4px solid var(--rose); }
.note-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.note-item { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.note-item:first-child { border-top: 0; padding-top: 0; }
.note-body { white-space: pre-wrap; }
.note-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.note-add { border-top: 1px solid var(--line); padding-top: var(--sp-4); }

/* --- Research console + review ----------------------------------------- */
.run-card { border-left: 3px solid var(--sage); }
.run-head { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.run-kind { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--grey); }
.run-subject { margin: 2px 0 var(--sp-3); font-size: var(--fs-md); }
.run-command {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs); background: var(--pale); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-3); resize: vertical;
}
.review-table td, .review-table th { vertical-align: top; font-size: var(--fs-sm); }
.review-table .rv-label { font-weight: 600; white-space: nowrap; }
.review-table .rv-current { color: var(--text-muted); max-width: 20rem; overflow-wrap: anywhere; }
.review-table .rv-proposed { max-width: 26rem; overflow-wrap: anywhere; }
.review-table tr.row-same { opacity: 0.55; }
.review-actions { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.check input { margin-right: var(--sp-2); }

/* --- Batch plan ---------------------------------------------------------
   The constraints that decide what can actually be sent. Open by default,
   because a closure she has not noticed is the most expensive thing on the
   page. Collapsible so it gets out of the way once she has read it. */
.plan-card { border-left: 4px solid var(--sage); }
.plan-summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: baseline; }
.plan-title { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--ink); }
.plan-hint { font-size: var(--fs-sm); color: var(--text-muted); }
.plan-block { margin-top: var(--sp-5); }
.plan-block:first-of-type { margin-top: var(--sp-4); }
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-list > li { padding: var(--sp-2) 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: baseline; }
.plan-list > li:first-child { border-top: 0; }
.plan-when { font-size: var(--fs-sm); color: var(--green); }
.plan-when-shut { color: var(--text-muted); }
.plan-agency { font-weight: 600; }
.plan-choice { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; }
.plan-rule { flex-basis: 100%; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.plan-conflict { flex-direction: column; align-items: flex-start; }
.plan-batch { margin: 0; padding-left: 1.4rem; }
.plan-batch li { padding: var(--sp-2) 0; display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: baseline; }
.plan-held > li { opacity: 0.75; }
