/* Email Monkeys outreach workspace.
   Brand system: packages/admin/DESIGN.md (tokens verbatim from the landing page globals.css).
   Light only. Cream page, white surfaces, warm-200 borders, navy ink, one gold accent,
   five statuses. Sections: fonts, tokens, base, shell, page header, components, views
   (compat classes the view files already use), responsive. */

/* ============================== Fonts (self-hosted, SIL OFL) ============================== */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/fonts/dm-sans-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: 'DM Sans'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/fonts/dm-sans-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: 400 700; font-display: swap; src: url(/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: 400 700; font-display: swap; src: url(/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; }

/* ============================== Tokens ============================== */
:root {
  color-scheme: light;
  /* Brand (verbatim from emailmonkeys.com globals.css) */
  --navy-900: #0F1B33; --navy-800: #22355E; --navy-700: #263E6B; --navy-600: #3A5A8C;
  --navy-400: #8FA3C8; --navy-200: #C9D6EA; --navy-100: #EDF2F9; --footer: #0B1428;
  --gold: #EFDA20; --gold-hover: #F6E44A; --gold-text: #A99512; /* gold-text: decorative only */
  --warm-white: #FAF9F6; --warm-50: #FCFBF7; --warm-100: #F5F3EE; --warm-200: #E8E5DE;
  --border-light: #F0EEE8; --pill-border: #D5DEED;
  --text-secondary: #4A5568; --muted: #718096; --on-navy-body: #B9C4D8; --on-navy-muted: #9DB0D2;

  --font-heading: 'DM Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius-sm: 8px; --radius-md: 10px; --radius-lg: 12px; --radius-xl: 14px; --radius-2xl: 16px; --radius-pill: 999px;

  --shadow-card-rest: 0 8px 22px rgba(15, 27, 51, 0.07);
  --shadow-card-hover: 0 16px 32px rgba(15, 27, 51, 0.12);
  --shadow-widget: 0 12px 30px rgba(15, 27, 51, 0.09);
  --shadow-button: 0 8px 20px rgba(15, 27, 51, 0.16);
  --shadow-overlay-dialog: 0 30px 90px rgba(0, 0, 0, 0.55);

  /* App semantic aliases */
  --bg: var(--warm-white);
  --surface: #FFFFFF;
  --surface-sunken: var(--warm-50);
  --surface-tint: var(--navy-100);
  --border: var(--warm-200);
  --border-hair: var(--border-light);
  --border-cool: var(--pill-border);
  --text: var(--navy-900);
  --text-2: var(--text-secondary);
  --text-3: var(--muted);          /* 13px+ non-numeric microcopy only (4.0:1); smaller text and numbers use --text-2 */
  --accent: var(--navy-600);
  --accent-strong: var(--navy-900);
  --accent-hover: var(--navy-700);
  --gold-mark: var(--gold);        /* bars, dots, selected edges; never text or fills */

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  /* Type scale: the only font sizes in the app (no half pixels). h2 is 20 everywhere; --fs-h2-lg is
     for the one detail or document title on a screen. */
  --fs-display: 34px; --fs-h1: 28px; --fs-h2-lg: 24px; --fs-h2: 20px; --fs-h3: 16px; --fs-lead: 15px;
  --fs-body: 14px; --fs-small: 13px; --fs-caption: 12px; --fs-micro: 11px; --fs-metric: 32px;
  --track-eyebrow: 0.10em; --track-kicker: 0.06em; --track-display: -0.015em;
  --page-pad: 32px;
  --content-max-app: 1800px;      /* deliberate: the landing is 1180px; a dense work app uses the width */
  --scrim: rgba(11, 20, 40, .72); /* modal backdrop (footer navy at 72%) */

  /* Status palette: exactly five states. text = label, dot = 8px marker, bg = banners/row highlights only */
  --status-ok-text: #2F6B4E;      --status-ok-bg: #E8F1EB;      --status-ok-dot: #3E8A63;
  --status-warn-text: #7A6A0B;    --status-warn-bg: #FBF5D6;    --status-warn-dot: #EFDA20;
  --status-danger-text: #9E3B2E;  --status-danger-bg: #F8E8E4;  --status-danger-dot: #C0503F;
  --status-paused-text: #5B6478;  --status-paused-bg: #F5F3EE;  --status-paused-dot: #8A93A6;
  --status-neutral-text: #3A5A8C; --status-neutral-bg: #EDF2F9; --status-neutral-dot: #6F87B3;
  --status-dot-ring: inset 0 0 0 1px rgba(15, 27, 51, 0.22);
}

/* ============================== Base ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-body)/1.55 var(--font-body); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, button[aria-disabled=true] { cursor: default; opacity: .6; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; color: var(--text); }
h1 { font-size: var(--fs-h1); line-height: 1.15; letter-spacing: var(--track-display); }
h2 { font-size: var(--fs-h2); line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); line-height: 1.3; }
h4 { font-size: var(--fs-micro); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
a { color: var(--accent); font-weight: 600; text-decoration: none; }
a:hover { opacity: .85; }
:focus-visible { outline: 2px solid var(--navy-600); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.hint { color: var(--text-2); font-size: var(--fs-small); line-height: 1.6; margin-top: 10px; }
.muted.hint, p.muted { font-size: var(--fs-small); line-height: 1.6; }
small { font-size: var(--fs-caption); }
::selection { background: var(--navy-100); color: var(--navy-900); }

/* ============================== Shell ============================== */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: stretch; gap: 28px; min-height: 64px; padding: 0 var(--page-pad); background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { opacity: 1; }
.brand-logo { height: 32px; width: auto; display: block; mix-blend-mode: multiply; }
.brand-product { font: 700 var(--fs-micro)/1 var(--font-heading); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); padding-left: 12px; border-left: 1px solid var(--border); }
.topbar nav { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.nav { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); font: 500 var(--fs-body)/1 var(--font-body); padding: 0 12px; white-space: nowrap; }
/* Tabs fill a scroll box (overflow clips), so the underline and the focus ring are drawn inside it. */
.nav:focus-visible, .more-menu summary:focus-visible, .detail-tab:focus-visible { outline-offset: -2px; }
.nav:hover { color: var(--text); }
.nav.active, .nav[aria-current=page] { color: var(--text); font-weight: 600; }
.topbar nav .nav.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--gold-mark); }
/* Counts are white chips with a hairline (never a filled background); a hot count adds the gold dot. */
.nav .count { display: inline-flex; align-items: center; gap: 4px; min-width: 20px; padding: 0 6px; border: 1px solid var(--border-cool); border-radius: var(--radius-pill); background: var(--surface); color: var(--text); font: 600 var(--fs-micro)/16px var(--font-body); justify-content: center; font-variant-numeric: tabular-nums; }
.nav .count.hot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-mark); box-shadow: var(--status-dot-ring); }
.more-menu { position: relative; display: flex; align-items: stretch; }
.more-menu summary { position: relative; display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; color: var(--text-2); font: 500 var(--fs-body)/1 var(--font-body); padding: 0 12px; white-space: nowrap; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.more-menu summary:hover, .more-menu[open] summary { color: var(--text); }
.more-menu summary.active { color: var(--text); font-weight: 600; }
.more-menu summary.active::before { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--gold-mark); }
.more-panel { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px; padding: 6px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-widget); }
.more-panel .nav { display: flex; width: 100%; padding: 11px 16px; text-align: left; border-left: 3px solid transparent; }
.more-panel .nav:hover { background: var(--surface-sunken); }
.more-panel .nav.active { border-left-color: var(--gold-mark); background: var(--surface-sunken); }
.header-tools { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.pause-all { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); padding: 7px 12px; font: 500 var(--fs-small)/1.2 var(--font-body); white-space: nowrap; transition: background .15s ease, border-color .15s ease; }
.pause-all:hover { background: var(--surface-sunken); border-color: var(--navy-200); }
.pause-all.paused { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--warm-white); }
.pause-all.paused:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--warm-white); }
.account { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: var(--fs-small); line-height: 1.3; color: var(--text-2); text-align: right; max-width: 280px; overflow-wrap: anywhere; }
.text-button { border: 0; background: none; padding: 0; color: var(--accent); font: 600 var(--fs-small)/1.3 var(--font-body); text-decoration: none; }
.text-button:hover { opacity: .85; }
.text-button.inline { display: inline; font-size: inherit; text-align: left; }
.paused-strip { display: flex; align-items: center; gap: 10px; padding: 10px var(--page-pad); background: var(--status-danger-bg); color: var(--status-danger-text); border-bottom: 1px solid var(--border); font-size: var(--fs-small); font-weight: 600; }
.paused-strip::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--status-danger-dot); box-shadow: var(--status-dot-ring); }
/* Info bar (the local private workspace notice) */
.info-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 9px var(--page-pad); background: var(--navy-100); border-bottom: 1px solid var(--border-cool); color: var(--text-2); font-size: var(--fs-small); }
.info-bar-item { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.info-bar .pill { align-self: center; }
.info-bar strong { font: 700 var(--fs-micro)/1.4 var(--font-heading); letter-spacing: 0.10em; text-transform: uppercase; color: var(--accent); }
main { max-width: var(--content-max-app); margin: 0 auto; padding: 28px var(--page-pad) 64px; }

/* ============================== Page header ============================== */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.page-header h1 { font-size: var(--fs-h1); }
.page-header p { margin-top: 8px; color: var(--text-2); font-size: var(--fs-lead); line-height: 1.55; max-width: 720px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font: 700 var(--fs-caption)/1.2 var(--font-heading); letter-spacing: var(--track-eyebrow); text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ''; flex: none; width: 24px; height: 3px; background: var(--gold-mark); }
.kicker { font: 600 var(--fs-micro)/1.3 var(--font-body); letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--accent); }

/* ============================== Components ============================== */

/* --- Card / panel --- */
/* Border only at rest, like the landing's cards. Shadows belong to raised things: the three-pane
   container, popovers, dialogs, the toast, and at most one standalone card per screen. */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; min-width: 0; }
.panel + .panel { margin-top: 16px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title h2 { font-size: var(--fs-h2); }
.panel-title h3 { font-size: var(--fs-h3); }
.section-tag { font: 700 var(--fs-micro)/1.3 var(--font-heading); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }

/* --- Metric tile (the landing's stat card) --- */
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric-tile { display: block; min-width: 0; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; color: var(--text); }
.metric-tile.attention { border-left: 4px solid var(--gold-mark); padding-left: 17px; }
.metric-value { display: block; font: 700 var(--fs-metric)/1.05 var(--font-heading); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.metric-label { display: block; font-size: var(--fs-small); color: var(--text-2); }
.metric-value + .metric-label { margin-top: 6px; }
.metric-sub { display: block; margin-top: 4px; font-size: var(--fs-small); color: var(--text-2); overflow-wrap: anywhere; }
button.metric-tile { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
@media (min-width: 901px) { button.metric-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); } }

/* --- Status pill: white pill + 8px dot + label. Five states only. --- */
.pill { --st-text: var(--status-neutral-text); --st-dot: var(--status-neutral-dot);
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 2px 10px 2px 8px; font: 600 var(--fs-caption)/18px var(--font-body); color: var(--st-text); }
.pill::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st-dot); box-shadow: var(--status-dot-ring); }
/* Canonical tone classes. UI.badge()/UI.status() in ui-kit.js emit "pill <raw value> <tone>". */
.pill.ok { --st-text: var(--status-ok-text); --st-dot: var(--status-ok-dot); }
.pill.warn { --st-text: var(--status-warn-text); --st-dot: var(--status-warn-dot); }
.pill.danger { --st-text: var(--status-danger-text); --st-dot: var(--status-danger-dot); }
.pill.paused { --st-text: var(--status-paused-text); --st-dot: var(--status-paused-dot); }
.pill.neutral { --st-text: var(--status-neutral-text); --st-dot: var(--status-neutral-dot); }
/* The pulsing gold dot means "running now", keyed by the raw server value UI.badge keeps as a class. */
.pill:is(.running, .sending, .validating, .researching, .live)::before { background: var(--gold-mark); animation: emPulse 2s ease-in-out infinite; }
@keyframes emPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.7); opacity: .4; } }

/* Small chips: lane code, merge-field token, keyboard hint */
.lane { display: inline-block; vertical-align: middle; padding: 1px 8px; border: 1px solid var(--border-cool); border-radius: var(--radius-pill); background: var(--surface); font: 700 var(--fs-micro)/16px var(--font-heading); letter-spacing: 0.08em; color: var(--accent); }
.token { display: inline-block; padding: 0 6px; border: 1px solid var(--border-cool); border-radius: var(--radius-pill); background: var(--surface); color: var(--accent); font-size: .92em; font-weight: 600; }
/* Keycap: full-strength label (AA on every button), a lighter outline, the 2px tiny-mark radius. */
.kbd { display: inline-block; min-width: 18px; margin-left: 8px; padding: 0 5px; border: 1px solid color-mix(in srgb, currentColor 45%, transparent); border-bottom-width: 2px; border-radius: 2px; font: 600 var(--fs-micro)/16px var(--font-body); text-align: center; }
/* Email address (UI.addr): breaks only at the "@"; each half ends in an ellipsis rather than wrapping. */
.addr { display: inline-flex; flex-wrap: wrap; max-width: 100%; min-width: 0; vertical-align: bottom; }
.addr-local, .addr-domain { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr.addr-stack { display: flex; flex-direction: column; }

/* --- Buttons: primary navy, secondary white outline, ghost, danger outline. Gold is never a button fill on the cream page. --- */
:is(button, a, input[type=submit]):is(.primary, .secondary, .ghost, .danger), a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; vertical-align: middle;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px;
  font: 500 var(--fs-body)/1.2 var(--font-body); text-decoration: none; white-space: nowrap; transition: background .15s ease, border-color .15s ease, color .15s ease; }
a.button:hover { opacity: 1; }
:is(button, a, input[type=submit]).primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--warm-white); }
:is(button, a, input[type=submit]).primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
:is(button, a).secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
:is(button, a).secondary:not(:disabled):hover { background: var(--surface-sunken); border-color: var(--navy-200); }
:is(button, a).ghost { background: transparent; color: var(--accent); font-weight: 600; }
:is(button, a).ghost:not(:disabled):hover { background: var(--navy-100); }
:is(button, a).danger { background: var(--surface); border-color: var(--border); color: var(--status-danger-text); }
:is(button, a).danger:not(:disabled):hover { background: var(--status-danger-bg); border-color: var(--status-danger-dot); }
:is(button, a).compact { padding: 5px 10px; font-size: var(--fs-small); }
:is(button, a):is(.primary, .secondary, .ghost, .danger):disabled { opacity: .6; }
.big-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.big-actions button { min-height: 42px; padding: 10px 18px; font-size: var(--fs-body); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
dialog .actions { justify-content: flex-end; margin-top: 20px; }

/* --- Inputs (BookForm) --- */
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text); font: 400 var(--fs-body)/1.4 var(--font-body); transition: border-color .15s ease; }
/* Text-like fields show focus as the navy border (BookForm). Checkboxes, radios and file pickers have no
   border to recolor, so they keep the global focus ring. */
:is(input:not([type=checkbox], [type=radio], [type=file]), select, textarea):focus { outline: none; border-color: var(--navy-600); }
:is(input:not([type=checkbox], [type=radio], [type=file]), select, textarea):focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] { background: var(--surface-sunken); color: var(--text-2); }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--navy-900) 50%), linear-gradient(135deg, var(--navy-900) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; line-height: 1.6; min-height: 90px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--navy-900); }
input[type=date], input[type=datetime-local] { font-variant-numeric: tabular-nums; }
label { display: block; font: 700 var(--fs-caption)/1.4 var(--font-heading); color: var(--text); }
label input, label select, label textarea { display: block; margin-top: 6px; }
label input[type=checkbox], label input[type=radio] { display: inline-block; margin-top: 0; }
.checkbox, label.checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; font: 500 var(--fs-small)/1.4 var(--font-body); color: var(--text); }
.checkbox input { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.search-label input { margin-top: 0; }
progress { accent-color: var(--navy-600); }

/* --- Toolbar / inline forms (dense controls) --- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.toolbar label, .inline-form label, .dispo-extra label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-caption); }
.toolbar input, .toolbar select, .inline-form input, .inline-form select, .dispo-extra input, .dispo-extra select { width: auto; max-width: 100%; margin: 0; padding: 6px 10px; font-size: var(--fs-small); }
.toolbar select, .inline-form select, .dispo-extra select, .pilot-select select, #send-batch { padding-right: 30px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.inline-form label.checkbox, .dispo-extra .checkbox { flex-direction: row; align-items: center; gap: 8px; }

/* --- Tables --- */
.table-wrap { position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.panel .table-wrap { margin-top: 4px; }
.data-table, :not(.prose) > .table-wrap table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.data-table th, .data-table td, :not(.prose) > .table-wrap th, :not(.prose) > .table-wrap td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-hair); }
.data-table th, :not(.prose) > .table-wrap th { background: var(--surface-sunken); border-bottom: 1px solid var(--border); font: 700 var(--fs-micro)/1.3 var(--font-heading); letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.data-table tr:last-child td, :not(.prose) > .table-wrap tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td, :not(.prose) > .table-wrap tr:hover td { background: var(--surface-sunken); }
.data-table tr.is-selected td { background: var(--surface-sunken); }
.data-table tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--gold-mark); }
td small { display: block; color: var(--text-2); font-size: var(--fs-caption); }
.data-table .num, .table-wrap .num { text-align: right; }

/* --- List row with gold-left-edge selection (WorkGallery row) --- */
.list-row, .pane-row { display: block; width: 100%; text-align: left; background: var(--surface); color: var(--text); border: 0; border-top: 1px solid var(--border-hair); border-left: 3px solid transparent; padding: 12px 20px 12px 17px; }
.list-row:first-child, .pane-row:first-child { border-top: 0; }
.list-row:focus-visible, .pane-row:focus-visible { outline-offset: -2px; } /* rows fill a scroll pane edge to edge */
.list-row:hover, .pane-row:hover { background: var(--surface-sunken); }
.list-row:is(.is-selected, .active, [aria-selected=true], [aria-current=true]), .pane-row:is(.is-selected, .active, [aria-selected=true], [aria-current=true]) { border-left-color: var(--gold-mark); background: var(--surface-sunken); }
.row-kicker { display: block; font: 600 var(--fs-micro)/1.3 var(--font-body); letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--accent); }
.row-title { display: block; font-size: var(--fs-body); font-weight: 500; color: var(--text); }
:is(.is-selected, .active, [aria-selected=true]) > .row-title { font-weight: 600; }
.row-meta { display: block; margin-top: 2px; font-size: var(--fs-caption); color: var(--text-2); }

/* --- Three-pane inbox layout (WorkGallery: rail | list | preview) --- */
.panes { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2xl); box-shadow: var(--shadow-widget); overflow: hidden; min-height: 480px; }
.panes.three { grid-template-columns: 196px minmax(260px, 340px) minmax(0, 1fr); }
.pane-rail { background: var(--surface-sunken); border-right: 1px solid var(--border); padding: 12px 0; min-width: 0; }
.pane-rail-title { padding: 8px 20px 6px; font: 700 var(--fs-micro)/1.3 var(--font-heading); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); }
.pane-list { border-right: 1px solid var(--border); min-width: 0; overflow: auto; }
.pane-detail { min-width: 0; overflow: auto; }
.pane-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface-sunken); border-bottom: 1px solid var(--border-hair); font: 700 var(--fs-micro)/1.3 var(--font-heading); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
.pane-body { padding: 20px 22px; }

/* --- Notices and banners (tinted fills are for these only, never for chips) --- */
.notice { margin-bottom: 16px; padding: 11px 14px; border-radius: var(--radius-md); border-left: 3px solid var(--navy-600); background: var(--navy-100); color: var(--text); font-size: var(--fs-small); line-height: 1.6; }
.notice.neutral { background: var(--surface-sunken); border: 1px solid var(--border-hair); border-left: 3px solid var(--navy-200); color: var(--text-2); }
.notice.warn { background: var(--status-warn-bg); border-left-color: var(--status-warn-dot); color: var(--status-warn-text); }
.notice.danger { background: var(--status-danger-bg); border-left-color: var(--status-danger-dot); color: var(--status-danger-text); }
.notice.ok { background: var(--status-ok-bg); border-left-color: var(--status-ok-dot); color: var(--status-ok-text); }
.blocker { color: var(--status-danger-text) !important; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 12px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--status-warn-bg); color: var(--text); font-size: var(--fs-body); }
.banner.red { background: var(--status-danger-bg); }
.banner p { flex: 1; min-width: 220px; }
.banner strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font: 700 var(--fs-micro)/1.3 var(--font-heading); letter-spacing: 0.10em; text-transform: uppercase; color: var(--status-warn-text); }
.banner strong::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--status-warn-dot); box-shadow: var(--status-dot-ring); }
.banner.red strong { color: var(--status-danger-text); }
.banner.red strong::before { background: var(--status-danger-dot); }
.release { margin-bottom: 24px; background: var(--navy-100); border: 1px solid var(--border-cool); border-radius: var(--radius-md); font-size: var(--fs-small); color: var(--text-2); }
.release summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; color: var(--text); font-weight: 600; }
.release summary::-webkit-details-marker { display: none; }
.summary-hint { margin-left: auto; font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.release ul { margin: 0 16px 14px 32px; padding: 0; line-height: 1.8; }

/* --- Empty state --- */
/* --- Empty states: exactly two forms. UI.empty(title, text) for an empty pane or list; a one-line
   .empty-row (13px, --text-2) for an empty list inside a card or table. Errors: errorPanel() in app.js. --- */
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-2); font-size: var(--fs-body); background: var(--surface-sunken); border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.empty-state h3 { margin-bottom: 6px; }
.empty-row { margin: 0; padding: 12px 0; font-size: var(--fs-small); line-height: 1.5; color: var(--text-2); list-style: none; }
:is(.pane-list, .pane-detail) > .empty-row { padding: 16px 20px; }

/* --- Toast --- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100% - 32px)); padding: 12px 18px 12px 16px; border-left: 4px solid var(--gold-mark); border-radius: var(--radius-md); background: var(--navy-900); color: var(--warm-white); box-shadow: var(--shadow-button); font-size: var(--fs-body); line-height: 1.5; }
.toast.error { border-left-color: var(--status-danger-dot); }

/* --- Modal --- */
dialog { width: min(480px, calc(100% - 32px)); max-width: 480px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-2xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-overlay-dialog); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font-size: var(--fs-h2); }
dialog p { margin-top: 10px; font-size: var(--fs-body); color: var(--text-2); line-height: 1.6; }
dialog label { margin-top: 16px; }
#reason-dialog textarea { min-height: 88px; }

/* ============================== Screen classes (shared by several views) ============================== */

/* Loading / error */
.loading, .error-panel { max-width: 900px; padding: 72px 0; }
.loading p, .error-panel p { margin: 16px 0; color: var(--text-2); }

/* Prospects: list + detail */
.prospect-layout { display: grid; align-items: start; } /* columns and gap: views/app.css */
.prospect-sidebar { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card-rest); overflow: hidden; }
.list-top { padding: 16px; background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
.list-top h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.list-top h2 span { font: 500 var(--fs-caption) var(--font-body); color: var(--text-2); font-variant-numeric: tabular-nums; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.filters label { font-size: var(--fs-caption); }
.filters select { font-size: var(--fs-small); padding: 6px 28px 6px 8px; margin-top: 4px; }
.wide { grid-column: 1 / -1; }
.prospect-list { max-height: 690px; overflow: auto; }
.prospect-row { display: block; width: 100%; text-align: left; background: var(--surface); border: 0; border-top: 1px solid var(--border-hair); border-left: 3px solid transparent; padding: 12px 14px 12px 13px; color: var(--text); }
.prospect-row:first-child { border-top: 0; }
.prospect-row:hover { background: var(--surface-sunken); }
.prospect-row.active { border-left-color: var(--gold-mark); background: var(--surface-sunken); }
.prospect-row strong { display: block; font-size: var(--fs-body); font-weight: 500; }
.prospect-row.active strong { font-weight: 600; }
.prospect-row small { display: block; margin: 2px 0 8px; font-size: var(--fs-caption); color: var(--text-2); }
.prospect-detail { min-width: 0; }
.detail-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 22px 24px 18px; }
.detail-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.detail-title h2 { font-size: var(--fs-h2-lg); letter-spacing: var(--track-display); }
.detail-domain { display: inline-block; margin: 4px 0 14px; font-size: var(--fs-small); }
.detail-tabs { display: flex; gap: 20px; padding: 0 24px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-top: 1px solid var(--border-hair); }
.detail-tab { position: relative; border: 0; background: transparent; padding: 13px 0; color: var(--text-2); font: 500 var(--fs-body)/1 var(--font-body); white-space: nowrap; }
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--text); font-weight: 600; }
.detail-tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--gold-mark); }
.detail-body { padding-top: 18px; }
.detail-body[aria-busy=true] { opacity: .7; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.fact { margin: 16px 0; padding-bottom: 16px; border-bottom: 1px solid var(--border-hair); }
.fact:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.fact p { margin-top: 6px; font-size: var(--fs-body); line-height: 1.65; }
.fact a { font-size: var(--fs-small); }
.editor-step { display: flex; gap: 6px; margin-bottom: 14px; }
.step-button { flex: 1; padding: 7px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font: 500 var(--fs-small)/1.3 var(--font-body); }
.step-button:hover { background: var(--surface-sunken); }
.step-button.active { border: 2px solid var(--navy-900); padding: 6px 3px; color: var(--text); font-weight: 600; }
.step-button small { display: block; font-size: var(--fs-micro); color: var(--text-2); font-weight: 500; }
.editor-form { display: grid; gap: 14px; }
.editor-form textarea { min-height: 330px; padding: 14px; font-size: var(--fs-body); }
.save-state { margin-left: auto; font-size: var(--fs-caption); color: var(--text-2); }
.history { margin-top: 16px; }
.history summary { cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.historical-copy { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-sunken); }
.historical-copy h4 { margin-bottom: 10px; }
.data-fields { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr; gap: 8px 16px; font-size: var(--fs-small); line-height: 1.65; }
.data-fields dt { color: var(--text-3); overflow-wrap: anywhere; }
.data-fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 16px 0; }
.timeline li { position: relative; margin-left: 14px; padding: 0 0 24px 28px; border-left: 1px solid var(--navy-200); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-number { position: absolute; left: -13px; top: -2px; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--border-cool); border-radius: 50%; background: var(--surface); font: 700 var(--fs-caption) var(--font-heading); color: var(--accent); }
.timeline li h3 { font-size: var(--fs-body); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline li p { margin-top: 4px; font-size: var(--fs-small); color: var(--text-2); }
.timeline li .pill { margin-left: 0; }

/* Prose (library documents, markdown research) */
.prose { font-size: var(--fs-body); line-height: 1.7; overflow-wrap: anywhere; color: var(--text); }
.prose p { margin: 10px 0; white-space: pre-wrap; }
.prose h2, .prose h3, .prose h4 { margin: 20px 0 8px; line-height: 1.35; }
.prose h2 { font-size: var(--fs-h2); }
.prose h3 { font-size: var(--fs-h3); }
.prose h4 { font-size: var(--fs-body); text-transform: none; letter-spacing: 0; color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; }
.prose code { background: var(--surface-sunken); border: 1px solid var(--border-hair); padding: 1px 5px; border-radius: 2px; font: var(--fs-small) var(--font-body); font-variant-numeric: tabular-nums; }
.prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--navy-200); background: var(--surface-sunken); color: var(--text-2); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--fs-small); line-height: 1.55; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-sunken); font-weight: 600; }

/* Research */
.research-toolbar { padding: 14px 20px; background: var(--surface-sunken); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.research-toolbar .actions { margin-top: 0; }
.research-toolbar .hint { margin-top: 6px; }
.source-details pre, .email-body { max-height: 350px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; padding: 12px 14px; font: var(--fs-small)/1.65 var(--font-body); background: var(--surface-sunken); border: 1px solid var(--border-hair); border-radius: var(--radius-sm); color: var(--text); }
.run-row { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-hair); }
.run-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; max-width: 480px; font-size: var(--fs-small); }
.run-metrics dt { color: var(--text-3); }
.run-metrics dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.current-run { padding: 10px 14px; background: var(--surface-sunken); border: 1px solid var(--border-hair); border-radius: var(--radius-sm); }

/* Pilot review, batch review */
.pilot-grid, .batch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.pilot-card.panel, .batch-card.panel { margin: 0; display: flex; flex-direction: column; }
.pilot-card > .actions, .batch-card > .actions { margin-top: auto; padding-top: 16px; }
.pilot-card > .history { margin-bottom: 12px; }
.pilot-intro p { font-size: var(--fs-body); }
.pilot-counts { display: flex; gap: 8px 16px; flex-wrap: wrap; padding: 14px 0 4px; font-size: var(--fs-small); color: var(--text-2); }
.pilot-select { margin: 0 0 14px; }
.pilot-select select, #send-batch { width: auto; margin-left: 8px; padding-top: 6px; padding-bottom: 6px; font-size: var(--fs-small); }

/* Activity, library */
.activity-row { display: grid; grid-template-columns: 150px minmax(120px, 1fr) 2fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border-hair); font-size: var(--fs-small); }
.activity-row:last-child { border-bottom: 0; }
.activity-row time, .activity-row small { color: var(--text-2); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.activity-row small { display: block; margin-top: 3px; }
.activity-row p { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--text-2); }
.library-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.library-layout > .panel { margin: 0; }
.library-layout aside h3 { margin: 16px 0 6px; font-size: var(--fs-small); }
.document-button { display: block; width: 100%; padding: 11px 12px 11px 11px; border: 0; border-top: 1px solid var(--border-hair); border-left: 3px solid transparent; background: var(--surface); color: var(--text); font: 400 var(--fs-small)/1.5 var(--font-body); text-align: left; }
.document-button:hover { background: var(--surface-sunken); }
.document-button.active { border-left-color: var(--gold-mark); background: var(--surface-sunken); font-weight: 600; }

/* Tabs (chip group). Active = 2px navy edge, like the landing's brand chips. */
.stack { display: grid; gap: 16px; }
.stack > .panel + .panel { margin-top: 0; }

/* Today */
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-hair); font-size: var(--fs-body); }
.queue-list li:last-child { border-bottom: 0; }
.queue-list small { display: block; margin-top: 2px; color: var(--text-2); font-size: var(--fs-caption); }

/* Approve */
.progress { display: flex; align-items: center; gap: 10px; font-size: var(--fs-small); color: var(--text-2); font-variant-numeric: tabular-nums; }
.progress progress { width: 160px; height: 8px; }
.evidence-block { margin-top: 16px; }
.evidence-block h4 { margin-bottom: 6px; }
.evidence-block p { font-size: var(--fs-body); line-height: 1.6; overflow-wrap: anywhere; }
.evidence-quote { padding: 8px 12px; border-left: 3px solid var(--navy-200); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.mail { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--fs-lead); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-subject { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-hair); font-weight: 600; white-space: normal; }
.fixed { color: var(--text-2); }
/* Variable parts in Email 1: a navy tint and underline (views/approve.css). */
.slot { padding: 1px 3px; border-radius: 2px; background: var(--navy-100); color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--navy-600); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-caption); color: var(--text-2); }
.legend .slot { font-size: var(--fs-caption); }
.signature { padding-top: 10px; border-top: 1px solid var(--border-hair); font-size: var(--fs-small); color: var(--text-3); white-space: pre-wrap; }
.slot-form { display: grid; gap: 12px; }
.slot-form textarea { min-height: 90px; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.reasons button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--radius-pill); padding: 6px 13px; font: 500 var(--fs-small)/1.3 var(--font-body); }
.reasons button:hover { background: var(--surface-sunken); color: var(--text); }
.reasons button[aria-pressed=true] { border: 2px solid var(--navy-900); padding: 5px 12px; color: var(--text); font-weight: 600; }
.card-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px solid var(--border-hair); font-size: var(--fs-small); color: var(--text-2); }

/* Cadence */
.step { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.chart { display: block; width: 100%; height: auto; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: middle; }
.grid-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.grid-table th, .grid-table td { padding: 5px 6px; border: 1px solid var(--border-hair); text-align: center; white-space: nowrap; }
.grid-table th { background: var(--surface-sunken); font: 700 var(--fs-micro) var(--font-heading); color: var(--text-2); letter-spacing: 0.04em; }
.grid-table th:first-child, .grid-table td:first-child { position: sticky; left: 0; text-align: left; background: var(--surface); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare > div { padding: 14px 16px; background: var(--surface-sunken); border: 1px solid var(--border-hair); border-radius: var(--radius-md); }
.compare b { display: block; font: 700 var(--fs-h2-lg) var(--font-heading); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.compare .label { display: block; font-size: var(--fs-small); color: var(--text-2); }

/* Send board, fleet */
.check-row { display: grid; grid-template-columns: 110px 110px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border-hair); font-size: var(--fs-small); }
.check-row:last-child { border-bottom: 0; }
.check-row small { color: var(--text-2); overflow-wrap: anywhere; }
.check-row .pill { justify-self: start; }

/* Replies */
.reply-body { max-height: 240px; overflow: auto; padding: 12px 14px; background: var(--surface-sunken); border: 1px solid var(--border-hair); border-radius: var(--radius-sm); font-size: var(--fs-body); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.dispo-extra { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; font-size: var(--fs-caption); }

/* Settings & help */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-grid .panel { margin: 0; }
.help-grid ol, .help-grid ul { margin: 6px 0 0; padding-left: 20px; font-size: var(--fs-body); line-height: 1.7; }

/* ============================== Responsive (single brand breakpoint 900px, plus wide/narrow) ============================== */
@media (min-width: 1600px) {
  .prospect-list { max-height: 850px; }
}
@media (max-width: 1150px) {
  :root { --page-pad: 22px; }
  .topbar { gap: 18px; }
  .nav, .more-menu summary { padding: 0 9px; }
  .account { max-width: 170px; }
  .split, .help-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .batch-grid, .pilot-grid { grid-template-columns: 1fr; }
  .panes.three { grid-template-columns: 160px minmax(220px, 280px) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --page-pad: 16px; }
  .topbar { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 10px; }
  .brand-logo { height: 26px; }
  .header-tools { gap: 10px; }
  /* Row 1: logo + tools. Row 2: the tabs (scrolling) and More, underlines on the bottom rule. */
  .topbar nav { order: 3; flex: 1 0 calc(100% - 96px); height: 44px; margin-top: 6px; margin-left: -9px; }
  .more-menu { order: 4; flex: none; height: 44px; margin-top: 6px; }
  .more-panel { left: auto; right: 0; }
  .page-header { display: block; }
  h1, .page-header h1 { font-size: var(--fs-h2-lg); }
  .prospect-layout, .library-layout { display: block; }
  .prospect-sidebar { position: static; margin-bottom: 16px; }
  .prospect-list { max-height: 240px; }
  .library-layout aside { margin-bottom: 16px; max-height: 260px; overflow: auto; }
  .panes, .panes.three { grid-template-columns: 1fr; }
  .pane-rail, .pane-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 280px; }
  .form-grid, .compare { grid-template-columns: 1fr; }
  .activity-row, .data-fields { grid-template-columns: 1fr; gap: 6px; }
  .data-fields dd { margin-bottom: 10px; }
  .loading, .error-panel { padding: 36px 0; }
  .panel { padding: 18px 16px; }
  .detail-header { padding: 18px 16px; }
  .detail-tabs { padding: 0 16px; gap: 16px; }
  .detail-title h2 { font-size: var(--fs-h2); }
  .big-actions button { flex: 1 1 40%; }
  .summary-hint { display: none; }
  .check-row { grid-template-columns: 90px 90px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-product { display: none; }
}
@media (max-width: 420px) {
  .account { display: none; }
  :root { --fs-metric: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Keep panel titles readable and long labels inside the phone viewport. */
@media (max-width: 720px) {
  .panel-title { flex-wrap: wrap; align-items: flex-start; }
  .panel-title > h2, .panel-title > h3 { flex-basis: 100%; }
  .panel-title .section-tag { white-space: normal; overflow-wrap: anywhere; }
}
