/* The admin pages' one stylesheet (design review 06 §3.3; docs/agents/admin-todo.md, R1).
 *
 * Tokens first, then the site header (moved out of each template), then the shared
 * components: buttons, form controls, status lozenges (icon + text + colour), the
 * segmented control, menus, the page header with its "About this page", inline alerts,
 * Blankslates, the toast, the dialog and the drawer. Page parts follow at the end.
 *
 * Rules the tests pin (tests/test_admin_css.py):
 *   - three radii only: var(--r-sm) 6 px, var(--r-md) 10 px, var(--r-pill) 999 px;
 *   - the lowest text colour is --text-muted #64748b (4.76:1 on white); on the grey page
 *     background muted text is --text-muted-bg #5f6b7f (5.0:1); the old faint grey is gone;
 *   - control borders are --border-control #8a93a6 (3.09:1, WCAG 1.4.11);
 *   - the system font stack: no web font is loaded.
 * Dark values are defined under .adm-dark, which nothing sets: dark mode is switched on
 * when the whole site has it, never for the admin pages alone.
 */

:root {
    /* Type: size / line height (weight is set where it is used). */
    --fs-h1: 24px; --lh-h1: 32px;
    --fs-h2: 16px; --lh-h2: 24px;
    --fs-body: 14px; --lh-body: 20px;
    --fs-meta: 13px; --lh-meta: 18px;
    --fs-micro: 12px; --lh-micro: 16px;
    --fs-mono: 12.5px; --lh-mono: 18px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Spacing: a 4 px base. */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;
    --gutter: 32px;
    --row-2: 52px; --row-1: 40px;
    --ctl-h: 32px; --ctl-h-primary: 36px;

    /* Radii: three values. */
    --r-sm: 6px; --r-md: 10px; --r-pill: 999px;

    /* Elevation: cards have a border and no shadow; pop-overs have this. */
    --shadow-pop: 0 8px 24px rgb(15 18 34 / .14);

    /* Colour (light). */
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-row: #eef0f4;
    --border-control: #8a93a6;
    --text: #1a1a2e;
    --text-2: #334155;
    --text-muted: #64748b;
    --text-muted-bg: #5f6b7f;  /* muted text on --bg (#64748b is 4.43:1 there) */
    --navy: #1a1a2e;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-subtle: #eef2ff;
    --accent-border: #c7d2fe;
    --accent-text: #3730a3;
    --danger: #b91c1c;
    --danger-subtle: #fef2f2;
    --danger-border: #fecaca;
    --warn: #92400e;
    --warn-subtle: #fffbeb;
    --warn-border: #fde68a;
    --warn-solid: #d97706;
    --ok: #166534;
    --ok-subtle: #dcfce7;
    --ok-border: #bbf7d0;
    --ok-solid: #16a34a;
    --violet: #5b21b6;
    --violet-subtle: #ede9fe;
    --violet-border: #ddd6fe;
    --violet-solid: #7c3aed;
    --sky: #075985;
    --sky-subtle: #e0f2fe;
    --sky-border: #bae6fd;
    --sky-solid: #0284c7;
    --indigo-solid: #6366f1;
    --neutral: #334155;
    --neutral-subtle: #f1f5f9;
    --track: #cbd5e1;  /* a bar's empty share: decoration, never text */
}

/* Dark values (06 §3.3), not switched on: nothing sets this class yet. */
.adm-dark {
    --bg: #0f1222;
    --surface: #161a2e;
    --surface-2: #1c2138;
    --border: #262c45;
    --border-row: #262c45;
    --border-control: #7a84a0;
    --text: #e2e8f0;
    --text-2: #cbd5e1;
    --text-muted: #94a3b8;
    --text-muted-bg: #94a3b8;
    --accent: #818cf8;
    --accent-subtle: #23264a;
    --accent-text: #a5b4fc;
    --danger: #fca5a5;
    --danger-subtle: #2a1215;
    --ok-subtle: #0f2a1c; --ok: #86efac;
    --warn-subtle: #2a1f0a; --warn: #fcd34d;
    --violet-subtle: #221a3a; --violet: #c4b5fd;
    --sky-subtle: #0b2233; --sky: #7dd3fc;
}

@media (pointer: coarse) {
    :root { --ctl-h: 44px; --ctl-h-primary: 44px; }
}

/* ── Base ─────────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }  /* a .btn's display must not show a hidden control */
body.adm {
    font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body);
    background: var(--bg); color: var(--text); padding-top: 64px;
}
.adm-wrap a, .drawer a, .dlg a { color: var(--accent-text); }  /* not the header: the brand keeps its own colours */
.adm .num, .adm time, .adm .tnum { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.adm .mono { font-family: var(--font-mono); font-size: var(--fs-mono); line-height: var(--lh-mono); }
.adm .muted { color: var(--text-muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.adm-wrap { max-width: 1240px; margin: 0 auto; padding: var(--sp-2) var(--gutter) 80px; }
@media (max-width: 640px) {
    :root { --gutter: 16px; }
    .adm-wrap { padding: var(--sp-1) var(--gutter) 60px; }
}
.adm h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; }
.adm h3 { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 600; }

/* ── Site header (moved from the templates; unchanged look) ────────────────────── */

.header { background: var(--navy); color: white; padding: 0 40px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0; z-index: 1000; }
.header nav a { color: #94a3b8; text-decoration: none; margin-left: 28px; font-size: 0.875rem; transition: color 0.15s; }
.header nav a:hover { color: #e2e8f0; }
.nav-toggle { display: none; background: none; border: none; color: #94a3b8; cursor: pointer; padding: 4px; flex-shrink: 0; line-height: 0; }
.nav-right { display: flex; align-items: center; margin-left: auto; }
.nav-login { background: transparent; color: rgba(255,255,255,0.8) !important; border: 1px solid rgba(255,255,255,0.35); padding: 5px 16px; border-radius: var(--r-sm); font-size: 0.85rem !important; font-weight: 500; margin-left: 16px !important; text-decoration: none; display: inline-flex; align-items: center; }
.nav-avatar-wrap { position: relative; margin-left: 20px; flex-shrink: 0; }
.nav-avatar { width: 34px; height: 34px; border-radius: var(--r-pill); background: var(--accent); color: white; font-size: 0.85rem; font-weight: 700; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.nav-dropdown { display: none; position: absolute; right: 0; top: 44px; width: 240px; background: white; border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 12px 0; z-index: 2000; }
.nav-dropdown.open { display: block; }
.nav-dropdown-info { padding: 10px 16px 12px; border-bottom: 1px solid #f1f5f9; }
.nav-dropdown-info .nd-name { font-weight: 700; font-size: 0.9rem; color: #1e293b; }
.nav-dropdown-info .nd-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.nav-dropdown-info .nd-inst { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.nav-dropdown-info .nd-orcid { font-size: 0.72rem; color: var(--accent); margin-top: 3px; font-family: monospace; }
.nav-dropdown-info .nd-badge { display: inline-block; background: var(--ok-subtle); color: var(--ok); font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); margin-top: 6px; }
.nav-dropdown a { display: block; padding: 9px 16px; font-size: 0.85rem; color: #374151; text-decoration: none; }
.nav-dropdown a:hover { background: var(--surface-2); }
.nav-dropdown a.nd-logout { color: #dc2626; border-top: 1px solid #f1f5f9; margin-top: 4px; }
.nd-preview { padding: 8px 16px 4px; border-top: 1px solid #f1f5f9; margin-top: 4px; }
.nd-preview-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; }
.nav-dropdown .nd-preview a { display: inline-block; padding: 2px 8px; margin: 0 3px 3px 0; font-size: 0.74rem; font-weight: 600; color: var(--warn); background: var(--warn-subtle); border: 1px solid var(--warn-border); border-radius: var(--r-pill); }
.nav-dropdown .nd-preview a:hover { background: #fef3c7; }
.nav-dropdown .nd-preview a.on { background: var(--warn); color: var(--warn-subtle); border-color: var(--warn); }
.nav-dropdown .nd-preview a.nd-preview-exit { color: var(--text-muted); background: white; border-color: var(--border); border-style: dashed; }
@media (max-width: 980px) {
    .header { height: auto; min-height: 64px; padding: 12px 20px; flex-wrap: wrap; align-items: flex-start; }
    .header-brand { order: 1; }
    .nav-toggle { order: 2; display: block; margin-top: 3px; margin-left: auto; }
    .nav-right { order: 3; display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; border-top: 1px solid rgba(255,255,255,0.08); padding: 10px 0 4px; margin-top: 8px; }
    .header nav { flex-direction: column; }
    .header nav a { display: block; margin-left: 0; padding: 9px 0; font-size: 0.92rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .nav-right.open { display: flex; }
}

/* ── Icons (static/icons.svg, the icon() macro in _icons.html) ─────────────────── */

.ico { flex: none; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor;
    stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-fill { fill: currentColor; stroke: none; }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--ctl-h); padding: 0 12px; border-radius: var(--r-sm);
    border: 1px solid var(--border-control); background: var(--surface); color: var(--text);
    font: inherit; font-size: var(--fs-body); font-weight: 500; line-height: 1; white-space: nowrap;
    text-decoration: none; cursor: pointer; }
.adm a.btn { color: var(--text); text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .adm a:focus-visible, .adm summary:focus-visible, .adm input:focus-visible,
.adm select:focus-visible, .adm textarea:focus-visible, .adm [tabindex]:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary, .adm a.btn-primary { height: var(--ctl-h-primary); padding: 0 14px; background: var(--accent);
    border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover, .adm a.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline, .adm a.btn-outline { border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn-outline:hover, .adm a.btn-outline:hover { background: var(--accent-subtle); }
.btn-warn, .adm a.btn-warn { border-color: var(--warn-solid); color: var(--warn); font-weight: 600; }
.btn-warn:hover, .adm a.btn-warn:hover { background: var(--warn-subtle); }
.btn-danger, .adm a.btn-danger { border-color: var(--danger); color: var(--danger); font-weight: 600; }
.btn-danger:hover, .adm a.btn-danger:hover { background: var(--danger-subtle); }
.btn-danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-quiet { border-color: var(--border); color: var(--text-2); }
.btn-ghost { }  /* the old name: the default look */
.btn-sm { }     /* the old name: every button is 32 px now */
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-link { border: 0; background: none; padding: 0; height: auto; color: var(--accent-text); font-weight: 500; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
/* A row action while its fetch runs (admin_rows.js sets it). */
.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
    margin: -7px 0 0 -7px; border-radius: var(--r-pill); border: 2px solid var(--border-control);
    border-top-color: var(--accent); animation: adm-spin .7s linear infinite; }
@keyframes adm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-busy::after { animation-duration: 2s; } }

/* ── Form controls ────────────────────────────────────────────────────────────── */

.adm input[type=text], .adm input[type=search], .adm input[type=email], .adm input[type=url],
.adm select, .adm textarea {
    font: inherit; font-size: var(--fs-body); color: var(--text); background: var(--surface);
    border: 1px solid var(--border-control); border-radius: var(--r-sm); min-width: 0; max-width: 100%; }
.adm input[type=text], .adm input[type=search], .adm input[type=email], .adm input[type=url],
.adm select { height: var(--ctl-h-primary); padding: 0 12px; }
.adm textarea { padding: 10px 12px; line-height: 21px; resize: vertical; width: 100%; }
.adm input::placeholder, .adm textarea::placeholder { color: var(--text-muted); opacity: 1; }
.adm label.fld { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.adm label.fld > input, .adm label.fld > textarea { width: 100%; font-weight: 400; }
.adm .hint { color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
/* iOS zooms into any input under 16 px. */
@media (max-width: 640px) {
    .adm input[type=text], .adm input[type=search], .adm input[type=email], .adm input[type=url],
    .adm select, .adm textarea { font-size: 16px; }
}
/* "Year: All": a compact select with its label inside the box. */
.sel { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h-primary); padding: 0 4px 0 10px;
    border: 1px solid var(--border-control); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
.adm .sel select { border: 0; height: auto; padding: 0 4px; font-weight: 600; background: transparent; }
/* A search field with its magnifier inside. */
.search-fld { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 0; }
.search-fld .ico { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.adm .search-fld input { width: 100%; padding-left: 36px; }

/* ── Status lozenges: icon + text + colour (06 §3.3), a marker, never a control ── */

.loz { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
    border-radius: var(--r-pill); border: 1px solid transparent; font-size: var(--fs-micro);
    line-height: var(--lh-micro); font-weight: 500; white-space: nowrap; max-width: 100%; }
.loz .ico { vertical-align: 0; }
.loz-needs   { background: transparent; border-color: var(--border); color: var(--text-muted); }
.loz-asked   { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent-text); }
.loz-due     { background: var(--warn-subtle); border-color: var(--warn-border); color: var(--warn); }
.loz-data    { background: var(--ok-subtle); border-color: var(--ok-border); color: var(--ok); }
.loz-private { background: var(--violet-subtle); border-color: var(--violet-border); color: var(--violet); }
.loz-elsewhere { background: var(--sky-subtle); border-color: var(--sky-border); color: var(--sky); }
.loz-na      { background: transparent; border: 1px dashed var(--border-control); color: var(--text-muted); }
.loz-live    { background: var(--ok-subtle); border-color: var(--ok-border); color: var(--ok); }
.loz-decide  { background: var(--warn-subtle); border-color: var(--warn-border); color: var(--warn); }
.loz-scheduled { background: var(--sky-subtle); border-color: var(--sky-border); color: var(--sky); }
.loz-draft   { background: var(--neutral-subtle); border-color: var(--border); color: var(--neutral); }
.loz-ended   { background: transparent; border-color: var(--border); color: var(--text-muted); }

/* A status dot before a status line. */
.dot { width: 8px; height: 8px; border-radius: var(--r-pill); display: inline-block; flex: none; background: var(--text-muted); }
.dot-ok { background: var(--ok-solid); }
.dot-warn { background: var(--warn-solid); }
.dot-bad { background: var(--danger); }
.dot-run { background: var(--accent); animation: adm-pulse 1.4s ease-in-out infinite; }
.dot-off { background: transparent; border: 1.5px solid var(--text-muted); }
@keyframes adm-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot-run { animation: none; } }

/* ── Segmented control: switches views of the same list (links, aria-current) ──── */

.seg { display: inline-flex; background: #eef0f4; border-radius: var(--r-sm); padding: 3px; gap: 2px; flex: none; }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px;
    border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--text); }
.seg a[aria-current] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(15 18 34 / .12); }

/* ── Menus: <details class="menu"> works without script ────────────────────────── */

.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 950; min-width: 220px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
    box-shadow: var(--shadow-pop); padding: 4px; display: flex; flex-direction: column; text-align: left; }
.menu-pop form { margin: 0; display: block; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px;
    border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit;
    font-size: var(--fs-body); text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.adm a.menu-item { color: var(--text); text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item .ico { color: var(--text-muted); }
.menu-item.danger, .adm a.menu-item.danger { color: var(--danger); }
.menu-item.danger .ico { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-note { padding: 4px 10px 6px; color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); white-space: normal; max-width: 300px; }

/* ── Page header: H1, one muted status line, the primary button and ⋯ ──────────── */

.ph { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-6); padding: 28px 0 20px; }
.ph-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ph-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 650; }
.ph-status { color: var(--text-muted-bg); }
.ph-status .dot { margin-right: 8px; vertical-align: 1px; }
.ph-actions { display: flex; gap: var(--sp-2); align-items: center; flex: none; }
@media (max-width: 640px) {
    .ph { padding: 16px 0 10px; gap: var(--sp-3); }
    .ph h1 { font-size: 22px; line-height: 28px; }
    .ph-status { font-size: var(--fs-meta); line-height: var(--lh-meta); }
    .ph-actions .ph-primary { display: none; }  /* phones: the primary action is in the ⋯ menu */
}
/* "About this page": the explanations, word for word, behind an info icon. */
.about > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center;
    color: var(--text-muted); border-radius: var(--r-pill); padding: 2px; }
.about > summary::-webkit-details-marker { display: none; }
.about > summary:hover { color: var(--text); }
.about[open] > summary { color: var(--accent-text); }
/* It opens over the content under the header, across the header's width (positioned
   against .ph, not the icon, so it never runs off a phone's right edge). */
.about-body { position: absolute; left: 0; right: 0; top: calc(100% - 8px); z-index: 900; max-width: 78ch;
    color: var(--text-2); font-size: var(--fs-meta); line-height: 1.6; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
    padding: var(--sp-3) var(--sp-4); }
.about-body p + p { margin-top: var(--sp-2); }

/* ── Cards, inline alerts and Blankslates ─────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-6); min-width: 0; }
.card + .card { margin-top: var(--sp-4); }
@media (max-width: 640px) { .card { padding: var(--sp-4); } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-md);
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2); margin: 0 0 var(--sp-4);
    overflow-wrap: anywhere; }
.alert .ico { margin-top: 2px; }
.alert-err { background: var(--danger-subtle); border-color: var(--danger-border); color: var(--danger); }
.alert-warn { background: var(--warn-subtle); border-color: var(--warn-border); color: var(--warn); }
.alert-info { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent-text); }
.blank { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--text-2); display: flex;
    flex-direction: column; align-items: center; gap: var(--sp-2); }
/* only the blankslate's own icon: an icon inside its button keeps the button's colour */
.blank > .ico { color: var(--text-muted); margin-bottom: var(--sp-2); }
.blank-title { font-weight: 600; color: var(--text); font-size: var(--fs-h2); line-height: var(--lh-h2); }
.blank p { max-width: 60ch; color: var(--text-muted); }

/* ── Toast: bottom left, polite; the row script (admin_rows.js) fills it ───────── */

.toast { position: fixed; left: 16px; bottom: 16px; z-index: 3000; max-width: min(520px, calc(100vw - 32px));
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--navy); color: #fff;
    border-radius: var(--r-md); padding: 10px 14px; box-shadow: var(--shadow-pop); overflow-wrap: anywhere; }
.toast[hidden] { display: none; }
.toast a, .toast .btn-link { color: #c7d2fe; font-weight: 600; }
.toast .btn { height: 28px; background: transparent; color: #fff; border-color: rgb(255 255 255 / .45); }
.toast .toast-x { background: none; border: 0; color: #c7cbe0; cursor: pointer; font: inherit; padding: 2px 4px; text-decoration: underline; }
.toast.err { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-border); }
.toast.err .toast-x { color: var(--danger); }
.toast form { display: inline; margin: 0; }

/* ── Dialog: <dialog> opened by script; ?add=1 renders the same box inline ───── */

.dlg { border: 1px solid var(--border); border-radius: var(--r-md); padding: 0; box-shadow: var(--shadow-pop);
    width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); color: var(--text);
    background: var(--surface); margin: auto; }
.dlg::backdrop { background: rgb(15 18 34 / .32); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6) 0; }
.dlg-body { padding: var(--sp-3) var(--sp-6) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3); }
.dlg-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }

/* ── Drawer: the side panel (a right column without script, an overlay with it) ── */

.drawer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0;
    display: flex; flex-direction: column; }
.drawer-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.drawer-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.drawer-nav { display: flex; gap: 4px; align-items: center; }
.drawer-nav .btn { border-color: transparent; color: var(--text-2); }
.drawer-sec { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--border); }
.drawer-sec:last-child { border-bottom: 0; }
.drawer-sec h3 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
.drawer-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
    padding: 12px 24px; display: none; gap: var(--sp-2); }
.drawer-backdrop { position: fixed; inset: 64px 0 0 0; background: rgb(15 18 34 / .18); z-index: 1500; }
.drawer.is-overlay { position: fixed; top: 64px; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 1600;
    border-radius: 0; border-width: 0 0 0 1px; box-shadow: var(--shadow-pop); overflow-y: auto; }
.drawer.is-overlay.is-wide { width: min(620px, 100vw); }
@media (max-width: 640px) {
    .drawer.is-overlay, .drawer.is-overlay.is-wide { top: 0; width: 100vw; z-index: 2500; border: 0; }
    .drawer-foot { display: flex; }
    .drawer-head, .drawer-sec { padding-left: 16px; padding-right: 16px; }
}

/* ── Menu extras: a confirm step inside a menu, a count, a phone-only item ──────── */

.menu-sub > summary { list-style: none; }
.menu-sub > summary::-webkit-details-marker { display: none; }
.menu-sub[open] > summary { background: var(--surface-2); }
.menu-confirm { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 10px; }
.menu-confirm .menu-note { padding: 0; }
.menu-confirm .btn { align-self: flex-start; }
.menu-n { margin-left: auto; padding-left: 12px; color: var(--text-muted); font-feature-settings: "tnum"; }
.menu-phone { display: none; }
.ph-menu .menu-pop { width: 280px; }
@media (max-width: 640px) { .adm .menu-phone { display: flex; } }

/* ── Lists: a card of two-line rows (R4: To do, Chat access, Approved robots) ──── */
/* <section class="sec"> holds an h2.sec-h with its count and a ul.lst of li.lrow. A row is
   the text (.l-main: .l-title one line, .l-meta one muted line) and its actions (.l-act:
   at most one button and the ⋯ menu). The actions sit on the text's line while both fit
   and drop to a line of their own, right-aligned, when they do not (a phone). The list
   has no overflow clip, so a row's menu is never cut off. */

.sec { display: flex; flex-direction: column; gap: var(--sp-2); scroll-margin-top: 80px; }
.sec + .sec { margin-top: 22px; }
.adm .sec-h { display: flex; align-items: center; gap: 8px; }
.sec-n { display: inline-block; min-width: 1.5em; padding: 0 8px; border-radius: var(--r-pill); background: var(--neutral-subtle);
    color: var(--text-2); font-size: var(--fs-micro); line-height: 20px; font-weight: 500; text-align: center; font-feature-settings: "tnum"; }
.sec-n:empty { display: none; }
.lst { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.lst-head { display: flex; gap: 16px; padding: 8px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
    color: var(--text-2); font-size: var(--fs-micro); line-height: var(--lh-micro); font-weight: 500;
    border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.lrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; min-height: var(--row-2); padding: 6px 18px;
    border-bottom: 1px solid var(--border-row); scroll-margin-top: 80px; }
.lrow:last-child { border-bottom: 0; }
.l-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.l-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-title .ico { margin-right: 6px; color: var(--warn); }
.l-title .loz { margin-left: 8px; vertical-align: top; height: 20px; }  /* the row stays 52 px */
.l-meta .mono { vertical-align: top; }
.l-meta { color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-meta .ico { margin-right: 4px; vertical-align: -3px; }
.l-meta.is-warn { color: var(--warn); }
.l-col { flex: none; color: var(--text-2); font-size: var(--fs-meta); line-height: var(--lh-meta); min-width: 0; overflow-wrap: anywhere; }
.l-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-left: auto; flex: none; }
.l-act form { margin: 0; display: inline-flex; }
.lrow.is-new { animation: ban-new 2s ease-out 1; }
/* A list whose rows have only the ⋯ menu keeps it on the text's line (Chat access). */
.lst-inline .l-main { flex-basis: 0; }
/* A section whose last row was acted on (admin_rows.js leaves a bare hidden stand-in). */
.sec:not(:has(.lrow)) { display: none; }
@media (prefers-reduced-motion: reduce) { .lrow.is-new { animation: none; outline: 2px solid var(--accent-border); outline-offset: -2px; } }
@media (max-width: 640px) {
    .lrow { padding: 8px 14px; }
    .l-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
/* A dialog's box drawn in the page (the no-script link: ?grant=1, ?add=1, ?resolve=<row>). */
.dlg.dlg-inline { display: block; position: static; width: auto; max-width: 560px; max-height: none; margin: var(--sp-2) 0 var(--sp-4); box-shadow: none;
    scroll-margin-top: 80px; }  /* its link lands below the fixed header */
.lrow > .dlg-inline { flex-basis: 100%; margin: 4px 0 8px; }
/* A page header that wraps on a phone: its primary button stays (no ⋯ to move it into). */
@media (max-width: 640px) {
    .ph.ph-wrap { flex-wrap: wrap; }
    .ph.ph-wrap .ph-main { flex: 1 1 200px; }
}

/* ══ Papers (/admin/papers, design review 06 §3.1, R2) ═════════════════════════ */

.p-summary { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.p-bar { display: flex; height: 8px; border-radius: var(--r-pill); overflow: hidden; gap: 2px; background: var(--track); }
.p-seg { min-width: 4px; }
.p-seg-data { background: var(--ok-solid); }
.p-seg-elsewhere { background: var(--sky-solid); }
.p-seg-not_applicable { background: var(--border-control); }
.p-seg-asked { background: var(--indigo-solid); }
.p-seg-followup { background: var(--warn-solid); }
.p-seg-nothing { background: var(--track); }
.ftabs { display: flex; flex-wrap: wrap; gap: 4px; }
.ftab { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap; }
.adm a.ftab { color: var(--text-2); text-decoration: none; }
.adm a.ftab:hover { background: var(--surface-2); color: var(--text); }
.adm a.ftab[aria-current="page"] { background: var(--accent-subtle); color: var(--accent-text); }
.adm a.ftab.is-zero { color: var(--text-muted); }
.ftab-n { font-weight: 600; font-feature-settings: "tnum"; }
.ftab-dot { width: 8px; height: 8px; border-radius: var(--r-pill); flex: none; }
.ftab-nothing .ftab-dot { border: 1.5px dashed var(--border-control); }
.ftab-followup .ftab-dot { background: var(--warn-solid); }
.ftab-asked .ftab-dot { background: var(--indigo-solid); }
.ftab-data .ftab-dot { background: var(--ok-solid); }
.ftab-elsewhere .ftab-dot { background: var(--sky-solid); }
.ftab-not_applicable .ftab-dot { border: 1.5px dashed var(--border-control); }
.adm a.ftab-followup:not(.is-zero) { color: var(--warn); }  /* the one that asks for action today */
@media (max-width: 640px) {
    /* Every filter in view, two to a line (owner, 14 Nov 2026: the sideways strip hid
       most of them on an iPhone). */
    .p-summary { padding: 12px; gap: 10px; }
    .ftabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .ftab { height: 36px; min-width: 0; white-space: nowrap; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); }
    .ftab-n { margin-left: auto; }
    .adm a.ftab[aria-current="page"] { border-color: var(--accent-border); }
}

.p-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 0 12px; }
.p-filters { display: flex; gap: 8px; align-items: center; flex: 1 1 480px; min-width: 0; flex-wrap: wrap; }
.p-count { color: var(--text-muted-bg); margin: -4px 0 12px; }
@media (max-width: 640px) {
    .ph-status .ph-more { display: none; }  /* the phone status line: when, and how many */
    .p-toolbar { padding: 12px 0 10px; }
    .p-filters { flex-basis: 100%; flex-wrap: nowrap; }
    .p-filters .search-fld { flex: 1 1 auto; }
    .p-filters .sel { flex: none; }
    .p-toolbar .seg { width: 100%; }
    .p-toolbar .seg a { flex: 1; justify-content: center; }
}

.p-list { padding: 0; overflow: hidden; }
.p-list > h2, .p-list > .sub { padding: 0 20px; }
.p-list > h2 { padding-top: 16px; }
.p-list > .sub { padding-bottom: 12px; }
.p-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 4px; color: var(--text-muted-bg); }
.p-foot a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.p-foot a:hover { text-decoration: underline; }
.p-card.confirm { border: 2px solid var(--danger-border); margin-bottom: 16px; scroll-margin-top: 84px; }
.p-confirm-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.p-card.add { margin-top: 16px; scroll-margin-top: 84px; }
.p-add { display: flex; flex-direction: column; gap: 12px; }
.p-add textarea { font-family: var(--font-mono); font-size: var(--fs-mono); min-height: 130px; }
.p-card.add .dlg-foot { justify-content: flex-start; }

/* Rows: two lines, 52 px (06 §3.1). The title link covers the row (::after), so a click
   anywhere outside the controls opens the panel, with or without script. */
.plist { width: 100%; border-collapse: collapse; table-layout: fixed; }
.plist thead th { text-align: left; font-size: var(--fs-micro); line-height: var(--lh-micro); font-weight: 500;
    color: var(--text-2); background: var(--surface-2); padding: 10px 8px; border-bottom: 1px solid var(--border); }
.plist thead th:first-child { border-top-left-radius: var(--r-md); }
.plist thead th:last-child { border-top-right-radius: var(--r-md); }
.plist th:first-child, .plist td:first-child { padding-left: 20px; }
.plist th:last-child, .plist td:last-child { padding-right: 20px; }
.plist .c-pub { width: 128px; text-align: right; }
.plist .c-status { width: 230px; padding-left: 16px; }
.plist .c-act { width: 176px; text-align: right; }
.plist .c-chev { display: none; width: 0; padding: 0; }
.prow { position: relative; }
.prow td { padding: 6px 8px; border-bottom: 1px solid var(--border-row); vertical-align: middle; height: var(--row-2); }
.prow:last-child td { border-bottom: 0; }
.prow:hover { background: var(--surface-2); }
.prow.is-open { background: var(--accent-subtle); box-shadow: inset 3px 0 0 var(--accent); }
.adm a.p-title { display: block; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }
.p-title::after { content: ""; position: absolute; inset: 0; }
.p-title:focus-visible { outline: none; }
.prow:has(.p-title:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.p-from { color: var(--text-muted); font-weight: 500; }
.p-meta { color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.p-meta .mono { color: var(--text-2); }
.c-pub > span { display: block; white-space: nowrap; }
.c-status > .loz { display: inline-flex; }
.p-sub { display: block; color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta);
    margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta-sm { display: none; }
.adm a.p-ds { position: relative; z-index: 1; text-decoration: none; }
.adm a.p-ds:hover { text-decoration: underline; }
.c-act { white-space: nowrap; }
.c-act > .btn, .c-act > .menu { position: relative; z-index: 1; vertical-align: middle; }
.c-act > .btn { margin-right: 6px; }
.c-act > .menu[open] { z-index: 5; }  /* above the next rows' buttons */
.row-menu > summary.btn { border-color: var(--border); color: var(--text-2); }
.row-menu .menu-pop { white-space: nowrap; }
.btn-page-more { display: none; }
@media (min-width: 900px) and (max-width: 1279px) {
    .plist .c-pub { width: 104px; }
    .plist .c-status { width: 200px; }
}
/* Below 900 px: phone-style rows, the title on up to two lines, then one meta line with
   the lozenge on the right; below 640 px no buttons in the list (the panel holds them). */
@media (max-width: 899px) {
    .plist thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .plist, .plist tbody { display: block; }
    .prow { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: "paper paper chev" "status act chev";
        align-items: center; column-gap: 10px; row-gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border-row); }
    .prow:last-child { border-bottom: 0; }
    .prow td, .plist td:first-child, .plist td:last-child { display: block; border: 0; padding: 0; height: auto; width: auto; }
    .plist .c-pub { display: none; }
    .c-paper { grid-area: paper; min-width: 0; }
    .plist .c-status { grid-area: status; width: auto; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
    .plist .c-act { grid-area: act; width: auto; }
    .plist .c-chev { grid-area: chev; display: block; width: auto; color: var(--text-muted); }
    .adm a.p-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 19px; }
    .p-meta, .c-status .p-sub { display: none; }
    .p-meta-sm { display: block; min-width: 0; color: var(--text-muted); font-size: var(--fs-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .c-status > .loz { flex: none; }
}
@media (max-width: 640px) {
    .prow { grid-template-columns: minmax(0, 1fr) 16px; grid-template-areas: "paper chev" "status chev"; min-height: 76px; }
    .plist .c-act { display: none; }
    /* D3: 25 rows, then "Show 25 more" (static/admin_cards.js sets .js-cards). */
    .js-cards table.paged tr.pg-hidden { display: none; }
    .js-cards .btn-page-more { display: flex; width: calc(100% - 32px); margin: 8px 16px 16px; }
    .js-cards .btn-page-more[hidden] { display: none; }
}

/* The side panel: a right column without script (its own page below 1100 px), a drawer
   over the list with it (.is-overlay), a full-screen sheet on a phone. */
.p-layout.has-panel { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 16px; align-items: start; }
.p-layout.has-panel.is-wide { grid-template-columns: minmax(0, 1fr) 600px; }
.p-layout.has-panel > .p-panel { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; }
/* Beside the panel the list keeps the title and the status; the panel has the rest. */
.p-layout.has-panel .plist .c-pub, .p-layout.has-panel .plist .c-act { display: none; }
@media (max-width: 1099px) {
    .p-layout.has-panel { display: block; }
    .p-layout.has-panel > .p-main { display: none; }
    .p-layout.has-panel > .p-panel { position: static; max-height: none; }
}
.p-panel:focus { outline: none; }
.p-panel-title { font-size: 18px; line-height: 26px; font-weight: 650; overflow-wrap: anywhere; }
.p-panel-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--text-muted); font-size: var(--fs-meta); }
.p-panel-meta .mono { color: var(--text); overflow-wrap: anywhere; }
.p-panel-meta a { display: inline-flex; gap: 4px; align-items: center; text-decoration: none; }
.p-copy { color: var(--text-muted); }
.p-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 4px; }
.p-facts div { min-width: 0; }
.p-facts dt { color: var(--text-muted); font-size: var(--fs-micro); line-height: var(--lh-micro); }
.p-facts dt abbr { text-decoration: none; }
.p-facts dd { margin: 0; overflow-wrap: anywhere; }
.p-facts-wide { grid-column: 1 / -1; }
.p-facts dd a.mono { display: inline-flex; align-items: center; gap: 3px; }
.rcards { border: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rcard { border: 1px solid var(--border-control); border-radius: var(--r-md); padding: 10px 12px; display: flex; gap: 8px;
    align-items: flex-start; cursor: pointer; background: var(--surface); }
.rcard:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-subtle); }
.rcard input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.rcard b { display: block; font-weight: 600; }
.rcard .hint { display: block; font-size: var(--fs-micro); line-height: var(--lh-micro); }
.p-mark:has(input[value="elsewhere"]:not(:checked)) .p-where { display: none; }
@media (max-width: 480px) { .rcards { grid-template-columns: 1fr; } }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.p-actions form { display: inline-flex; }
.p-draft textarea { min-height: 260px; }
.p-hist { list-style: none; display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--border); padding-left: 12px; }
.p-hist li { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.p-hist time { color: var(--text-muted); font-size: var(--fs-micro); line-height: var(--lh-micro); }
.p-danger h3 { color: var(--danger); }
.p-remove > summary { list-style: none; width: max-content; }
.p-remove > summary::-webkit-details-marker { display: none; }
.p-remove[open] > summary { margin-bottom: 10px; }
.p-remove p { margin-bottom: 10px; color: var(--text-2); }
@media (max-width: 640px) { body.has-drawer { overflow: hidden; } }

/* Plain explanatory lines in a card. */
.p-card .sub, .p-list > .sub { color: var(--text-muted); margin-top: 6px; line-height: 1.6; max-width: 78ch; }
.p-card h2 { margin-bottom: 4px; }
.p-list > .a-sub { padding-top: 14px; }

/* By author (D2, R2): one row per author; the chevron opens their papers. */
.alist { list-style: none; }
.arow { display: flex; align-items: flex-start; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border-row); scroll-margin-top: 84px; }
.arow.is-open { background: var(--accent-subtle); box-shadow: inset 3px 0 0 var(--accent); }
.arow > .btn { flex: none; margin-top: 2px; }
.arow-d { flex: 1 1 auto; min-width: 0; }
.arow-d > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; flex-wrap: wrap; }
.arow-d > summary::-webkit-details-marker { display: none; }
.arow-chev { color: var(--text-muted); display: inline-flex; transition: transform .15s; }
.arow-d[open] .arow-chev { transform: rotate(90deg); }
.arow-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.arow-name { font-weight: 600; }
.arow-pi { color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.arow-loz { display: flex; gap: 6px; flex-wrap: wrap; }
.arow-papers { list-style: none; margin: 6px 0 4px 26px; display: flex; flex-direction: column; }
.arow-papers li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 6px 0; border-top: 1px dashed var(--border-row); min-width: 0; }
.adm .arow-papers a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-decoration: none; color: var(--text); }
.adm .arow-papers a:hover { text-decoration: underline; }
.arow-papers .hint { flex: none; }
.p-panel .arow-papers { margin-left: 0; }
@media (max-width: 640px) {
    .arow { flex-direction: column; gap: 6px; padding: 12px 16px; }
    .arow-papers { margin-left: 0; }
}

/* ══ Announcements (/admin/announcements, design review 06 §3.2, R3) ═══════════ */

.about-body h3 { font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: 600; color: var(--text); margin-top: var(--sp-3); }
.about-body h3:first-child { margin-top: 0; }
.about-body h3 + p { margin-top: var(--sp-1); }

/* The tabs inside a page (Banners · Messages · Polls): the tab bar's underline look,
   one size down, with room on the right for the list's own controls. */
.subtabs { display: flex; align-items: stretch; gap: 0 24px; border-bottom: 1px solid var(--border); margin: 0 0 var(--sp-6); min-height: 40px; }
.subtabs > a { display: flex; align-items: center; gap: 6px; height: 40px; margin-bottom: -1px; padding: 0 1px;
    border-bottom: 2px solid transparent; font-weight: 500; text-decoration: none; white-space: nowrap; }
.adm .subtabs > a { color: var(--text-muted-bg); text-decoration: none; }
.adm .subtabs > a:hover { color: var(--text); border-bottom-color: var(--border-control); }
.adm .subtabs > a[aria-current="page"] { color: var(--navy); font-weight: 600; border-bottom-color: var(--accent); }
.subtabs .subtabs-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); padding: 4px 0; }
.subtab-n { display: inline-block; min-width: 1.5em; padding: 0 7px; border-radius: var(--r-pill); background: var(--warn-subtle);
    color: var(--warn); font-size: var(--fs-micro); line-height: 18px; font-weight: 600; text-align: center; font-feature-settings: "tnum"; }
.subtab-n:empty { display: none; }

/* The NERSC feed chip in the header: a status dot and a short line; its pop-over holds
   the feed's full status, word for word. */
.chip-pop > summary.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2);
    font-size: var(--fs-meta); line-height: var(--lh-meta); white-space: nowrap; }
.chip-pop > summary.chip-btn:hover { border-color: var(--border-control); }
.chip-pop .chip-body { width: min(360px, calc(100vw - 32px)); padding: var(--sp-3) var(--sp-4); gap: var(--sp-2); color: var(--text-2);
    font-size: var(--fs-meta); line-height: 1.55; white-space: normal; }
.chip-pop .chip-h { font-weight: 600; color: var(--text); }
@media (max-width: 640px) {
    .chip-pop .chip-more { display: none; }  /* phones: the dot and "NERSC feed"; the rest in the pop-over */
    .subtabs { gap: 0 18px; }
}

/* The Banners list: groups (Live now, Needs a decision, Scheduled, Drafts), one row a
   banner: lozenge · strip and meta line · one button and ⋯. */
#ban-list { display: flex; flex-direction: column; gap: 22px; }
.ban-sec { display: flex; flex-direction: column; gap: var(--sp-2); }
.adm .ban-h { font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: 600; color: var(--text-2); }
.ban-n { color: var(--text-muted-bg); font-weight: 500; margin-left: 2px; font-feature-settings: "tnum"; }
.ban-rows { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.ban-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 18px; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border-row); min-width: 0; position: relative; }
.ban-row:last-child { border-bottom: 0; }
.ban-row:first-child { border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.ban-row:last-child { border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
/* The live row affects people right now: a green rule on its left. */
.ban-live::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--ok-solid); }
.ban-row:first-child.ban-live::before { border-top-left-radius: var(--r-md); }
.ban-row:last-child.ban-live::before { border-bottom-left-radius: var(--r-md); }
.ban-loz { justify-self: start; }
.ban-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ban-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.ban-meta .bm + .bm::before { content: "·"; margin: 0 6px; color: var(--text-muted); }
.ban-src { display: inline-flex; color: var(--text-muted); margin-right: 8px; cursor: help; }
.ban-remain { color: var(--ok); font-weight: 500; font-feature-settings: "tnum"; }
.ban-win { display: inline-flex; align-items: center; gap: 6px; }
.ban-note { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--warn); }
.ban-note.ban-muted { color: var(--text-muted); }
.ban-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.ban-act form { margin: 0; display: inline-flex; }
.ban-src-text { white-space: pre-wrap; max-width: 340px; max-height: 240px; overflow-y: auto; }
.ban-none { display: flex; align-items: center; gap: 8px; color: var(--text-muted-bg); }
.ban-pager { display: flex; gap: 18px; margin-top: 4px; }
.ban-box { display: flex; flex-direction: column; gap: var(--sp-3); }
.ban-box, .ban-row, .ban-sec { scroll-margin-top: 80px; }  /* an anchor lands below the fixed header */
.ban-box + #ban-list { margin-top: var(--sp-4); }
.ban-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.adm .ban-form input[type=datetime-local] { height: var(--ctl-h-primary); padding: 0 12px; font: inherit; border: 1px solid var(--border-control); border-radius: var(--r-sm); background: var(--surface); color: var(--text); max-width: 100%; }
.dlg-strip:empty { display: none; }
.dlg-say { color: var(--text-2); }
/* The row a change just landed on: a short indigo highlight (2 s). */
.ban-row.is-new { animation: ban-new 2s ease-out 1; }
@keyframes ban-new { 0%, 40% { background: var(--accent-subtle); } 100% { background: var(--surface); } }
@media (prefers-reduced-motion: reduce) { .ban-row.is-new { animation: none; outline: 2px solid var(--accent-border); outline-offset: -2px; } }
/* A row's strip: the site's own .sb-strip, left-aligned on one line with an ellipsis; the
   window is on the meta line. */
.sb-strip.sb-row { justify-content: flex-start; text-align: left; flex-wrap: nowrap; padding: 7px 12px; font-size: 13px; line-height: 18px;
    border-style: solid; border-width: 1px; border-radius: var(--r-sm); min-width: 0; overflow: hidden; white-space: nowrap; }
.sb-strip.sb-info.sb-row { border-color: #c7d2fe; }
.sb-strip.sb-warning.sb-row { border-color: #fde68a; }
.sb-strip.sb-row .sb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-strip.sb-row .sb-when { display: none; }
@media (max-width: 760px) {
    /* Phones: lozenge and buttons on the first line when both fit (a live row: Edit + ⋯);
       otherwise the buttons take their own right-aligned line, so a long lozenge ("Needs a
       decision" beside Publish, Dismiss, ⋯) is never cut (owner's iPhone, 19 Nov 2026).
       The strip and meta under them, one fact per line (no line starting with "·"). */
    .ban-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; }
    .ban-loz { order: 0; }
    .ban-act { order: 1; margin-left: auto; }
    .ban-main { order: 2; flex: 1 1 100%; }
    .ban-meta .bm + .bm { flex-basis: 100%; }
    .ban-meta .bm + .bm::before { content: none; }
}
/* The composer (?compose=1, ?edit=<id>): the form on the left, a sticky preview on the
   right, a sticky footer. One column below 880 px, with the strip pinned under the
   header. */
.cmp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.adm a.cmp-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 500; text-decoration: none; }
.adm a.cmp-back:hover { text-decoration: underline; }
.adm .cmp-title { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 650; }
.cmp-now { margin-left: auto; color: var(--text-muted-bg); font-feature-settings: "tnum"; }
.cmp .alert { margin-bottom: var(--sp-4); }
.cmp-grid { display: grid; grid-template-columns: 460px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.cmp-form { display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.cmp-set { border: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.cmp-l, .adm legend.cmp-l { font-weight: 600; padding: 0; margin-bottom: 2px; }
.cmp-l .muted { font-weight: 400; }
.cmp-l2 { color: var(--text-2); }
.cmp-fld { display: flex; flex-direction: column; gap: 6px; }
.adm .cmp-fld input[type=text] { width: 100%; }
.cmp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.cmp-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.cmp-at { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.adm .cmp input[type=datetime-local] { height: var(--ctl-h-primary); padding: 0 10px; font: inherit; border: 1px solid var(--border-control);
    border-radius: var(--r-sm); background: var(--surface); color: var(--text); min-width: 0; max-width: 100%; }
.cmp .fld input[type=datetime-local] { width: 100%; }
/* Without script too: the date only for "Start on a date", the end only for "Custom". */
.cmp-when:has(input[name=start][value=now]:checked) #b-at { display: none; }
.cmp-when:not(:has(input[name=duration][value=custom]:checked)) #b-custom { display: none; }
.cmp-when:not(:has(#b-window[open])):not(:has(input[name=duration][value=window]:checked)) .for-window { display: none; }
.cmp-end { color: var(--text-2); font-feature-settings: "tnum"; }
.cmp-end:empty { display: none; }
.opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.opt input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
/* Start from: six radio tiles with icons. */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.tile { position: relative; min-height: 64px; padding: 6px; border: 1px solid var(--border-control); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text-2); display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 4px; text-align: center; font-size: var(--fs-meta); line-height: 16px; font-weight: 500; cursor: pointer; }
.tile:hover { background: var(--surface-2); }
.tile input, .seg-opts input, .pill-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.tile:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-subtle); color: var(--accent-text); }
.tile:has(input:focus-visible), .seg-opts label:has(input:focus-visible), .pill-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Text: the counter inside the box, amber from 180 characters; the [placeholders] left. */
.txt-wrap { position: relative; display: flex; }
.adm .txt-wrap textarea { min-height: 88px; padding-bottom: 24px; resize: vertical; }
.count { position: absolute; right: 10px; bottom: 6px; font-size: var(--fs-micro); line-height: var(--lh-micro); color: var(--text-muted); font-feature-settings: "tnum"; pointer-events: none; }
.count.is-near { color: var(--warn); font-weight: 600; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-chips:empty { display: none; }
.ph-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--warn-border);
    background: var(--warn-subtle); color: var(--warn); font: inherit; font-size: var(--fs-micro); font-weight: 500; cursor: pointer; }
/* Look and Who: two-option segmented controls (radios). */
.seg.seg-opts, .seg.seg-btn { display: flex; }
.seg.seg-opts { width: 100%; }
.seg-opts label, .seg-btn button { flex: 1; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px;
    padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg-opts label:has(input:checked), .seg-btn button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(15 18 34 / .12); }
.seg-btn button { height: 28px; font-size: var(--fs-meta); }
.seg-opts label { flex: 1 1 auto; min-width: 0; padding: 0 8px; }
.sw { width: 10px; height: 10px; border-radius: var(--r-pill); flex: none; }
.sw-info { background: var(--indigo-solid); }
.sw-warning { background: var(--warn-solid); }
/* Show for: duration pills. */
.pill-opt { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
    border: 1px solid var(--border-control); background: var(--surface); color: var(--text-2); font-weight: 500; cursor: pointer; white-space: nowrap; }
.pill-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-subtle); color: var(--accent-text); font-weight: 600; }
.cmp-win > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--accent-text); font-weight: 500; }
.cmp-win > summary::-webkit-details-marker { display: none; }
.cmp-win > summary .ico { transition: transform .15s; }
.cmp-win[open] > summary .ico { transform: rotate(90deg); }
.cmp-win[open] { display: flex; flex-direction: column; gap: var(--sp-3); }
/* The preview: a miniature site page around the real strip. */
.cmp-preview { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cmp-prev-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.cmp-toggles { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.mini { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); box-shadow: 0 8px 24px rgb(15 18 34 / .08); }
.mini-head { background: var(--navy); height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 12px; }
.mini-brand { color: #fff; font-weight: 600; font-size: var(--fs-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-nav { display: flex; gap: 14px; }
.mini-nav i { width: 52px; height: 8px; border-radius: var(--r-pill); background: #3b3f5c; }
.mini-l { padding: 8px 18px 4px; color: var(--text-muted); font-size: var(--fs-micro); line-height: var(--lh-micro); }
.mini-hidden { padding: 10px 18px; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-meta); }
.mini-page { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.mini-page i { display: block; height: 10px; border-radius: var(--r-pill); background: #eef0f4; }
.mini-page i:first-child { width: 38%; height: 14px; background: var(--border); }
.mini-page i:nth-child(2) { width: 86%; }
.mini-page i:nth-child(3) { width: 74%; }
.mini-page span { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.mini-page b { height: 72px; border-radius: var(--r-sm); background: var(--neutral-subtle); }
.sb-strip.sb-mini { border-radius: 0; }
.cmp-sum { padding: 14px 16px; background: var(--accent-subtle); border-radius: var(--r-md); color: var(--accent-text); line-height: 22px; }
.cmp-sum:empty { display: none; }
.cmp-foot { position: sticky; bottom: 0; z-index: 800; margin-top: var(--sp-6); padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--sp-2); }
.cmp-btns { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cmp-btns .btn { height: 40px; padding: 0 18px; }
.cmp-sum-foot { display: none; }
.dlg.dlg-wide { width: min(720px, calc(100vw - 32px)); }
.dlg .dlg-strip .sb-strip { border: 1px solid var(--border); border-radius: var(--r-sm); }
/* Messages and Polls: the same split; the preview is the bell notice and the message
   page, or the question card. */
.cmp-mp + .card { margin-top: var(--sp-6); }
.cmp-mp .cmp-form h2.cmp-l { font-size: var(--fs-h2); line-height: var(--lh-h2); }
.adm .cmp-mp .cmp-fld input[type=text], .adm .cmp-mp select, .adm .cmp-mp input[type=date] { width: 100%; }
.adm .cmp-mp input[type=date] { height: var(--ctl-h-primary); padding: 0 10px; font: inherit; border: 1px solid var(--border-control);
    border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
.scope-row { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.scope-pane { margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-subtle); color: var(--accent-text);
    border: 1px solid var(--accent-border); border-radius: var(--r-pill); padding: 3px 4px 3px 11px; font-size: var(--fs-meta); }
.chip button { border: 0; background: transparent; color: inherit; font-size: 17px; line-height: 1; width: 26px; height: 26px; border-radius: var(--r-pill); cursor: pointer; }
.chip button:hover { background: #e0e7ff; }
.qblock { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px 12px; display: grid; gap: 8px; min-width: 0; }
.qblock legend { font-weight: 600; color: var(--text-2); padding: 0 4px; }
.adm .qblock input[type=text] { width: 100%; }
#add-q { align-self: flex-start; }
.cmp-foot-hint { align-self: center; margin-right: auto; }
.bell-card { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-pop); max-width: 380px; overflow: hidden; }
.bell-head { padding: 10px 16px; font-weight: 600; border-bottom: 1px solid var(--border); }
.bell-item { display: grid; grid-template-columns: 8px 1fr; column-gap: 10px; padding: 11px 16px; background: var(--accent-subtle); color: var(--text); }
.bell-dot { width: 8px; height: 8px; border-radius: var(--r-pill); margin-top: 6px; background: var(--accent); }
.bell-text { min-width: 0; overflow-wrap: anywhere; }
.bell-when { display: block; margin-top: 2px; font-size: var(--fs-micro); color: var(--text-muted); }
.msg-page, .q-card { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msg-h { font-weight: 650; font-size: var(--fs-h2); line-height: var(--lh-h2); overflow-wrap: anywhere; }
.msg-body { white-space: pre-wrap; color: var(--text-2); overflow-wrap: anywhere; }
.msg-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); overflow-wrap: anywhere; }
.q-list { list-style: decimal; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.q-list:empty { display: none; }
.q-q { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.q-opt { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--text-2); overflow-wrap: anywhere; }
.q-radio { width: 14px; height: 14px; border-radius: var(--r-pill); border: 1.5px solid var(--border-control); flex: none; }
.q-comment { border: 1px dashed var(--border-control); border-radius: var(--r-sm); padding: 10px 12px; color: var(--text-muted); }
.mp-sent h2 { margin-bottom: var(--sp-3); }
.tbl-scroll { overflow-x: auto; }
.mp-tbl { width: 100%; min-width: min-content; border-collapse: collapse; }
.mp-tbl th { text-align: left; font-size: var(--fs-micro); line-height: var(--lh-micro); color: var(--text-muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mp-tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-row); vertical-align: top; }
.mp-tbl tr:last-child td { border-bottom: 0; }
.mp-tbl .by { display: block; font-size: var(--fs-micro); color: var(--text-muted); margin-top: 2px; }
.prog { font-feature-settings: "tnum"; white-space: nowrap; color: var(--text-2); }
.poll-res { display: flex; flex-direction: column; gap: 4px; }
.card.poll-res + .card.poll-res { margin-top: var(--sp-4); }
.cmp-mp + .poll-res { margin-top: var(--sp-6); }
.poll-q { font-weight: 650; font-size: var(--fs-h2); line-height: var(--lh-h2); }
.poll-sub { font-weight: 600; color: var(--text-2); margin: 10px 0 2px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 220px) 1fr 36px; gap: 10px; align-items: center; margin: 3px 0; }
.bar { height: 10px; background: var(--neutral-subtle); border-radius: var(--r-pill); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--indigo-solid); border-radius: var(--r-pill); }
.bar-n { text-align: right; font-feature-settings: "tnum"; color: var(--text-2); }
.poll-comments { margin: 8px 0 6px 18px; color: var(--text-2); }
.poll-comments small { color: var(--text-muted); }
@media (max-width: 879px) {
    .cmp-mp .cmp-preview { position: static; order: 0; margin: 0; padding: 0; border: 0; background: none; gap: 14px; }
    .cmp-mp .cmp-prev-bar { display: flex; }
    .cmp-mp #m-summary, .cmp-mp #p-summary { display: none; }
    .bar-row { grid-template-columns: minmax(70px, 1fr) 1.2fr 30px; }
}
@media (max-width: 879px) {
    .cmp-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
    /* The strip stays in view while typing: pinned under the site header. */
    .cmp-preview { order: -1; top: 64px; z-index: 850; margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); background: var(--bg); gap: 0;
        border-bottom: 1px solid var(--border); }
    .cmp-prev-bar, .mini-head, .mini-page, #b-summary { display: none; }
    .mini { border-radius: var(--r-sm); box-shadow: none; }
    .cmp-sum-foot { display: block; padding: 10px 12px; line-height: 20px; font-size: var(--fs-meta); }
    .cmp-sum-foot:empty { display: none; }
}
@media (max-width: 640px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile { min-height: 44px; flex-direction: row; gap: 8px; }
    .cmp-form { padding: 16px; }
    .cmp-two { grid-template-columns: minmax(0, 1fr); }
    .cmp-now { margin-left: 0; width: 100%; }
    .cmp-btns .btn { flex: 1 1 auto; }
    .cmp-btns a.btn { display: none; }  /* "‹ Banners" at the top does the same */
    .adm .cmp input[type=datetime-local] { font-size: 16px; }
}
@media (max-width: 640px) {
    /* Phones: Current | Archive moves under the tabs' line. */
    .subtabs { flex-wrap: wrap; border-bottom: 0; }
    .subtabs > a { position: relative; z-index: 1; }
    .subtabs .subtabs-end { flex-basis: 100%; margin-left: 0; border-top: 1px solid var(--border); padding: 12px 0 0; }
}

/* ══ Approved robots (/admin/api-clients, design review 07 §5, R4) ═════════════ */

.ac-list .l-main { flex-basis: 300px; }
.ac-h-main { flex: 1 1 300px; }
.ac-may { width: 260px; }
.ac-used { width: 130px; text-align: right; }
.ac-h-act, .ac-list .l-act { width: 160px; }
.ac-sm { display: none; }
.ac-foot { margin-top: var(--sp-3); }
.adm .ac-foot { color: var(--text-muted-bg); }
@media (max-width: 900px) {
    .ac-list .l-col, .ac-head { display: none; }
    .ac-sm { display: block; }
    .ac-list .l-act { width: auto; }
}
.ac-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.adm .ac-form select { width: 100%; font-weight: 400; }
.adm .ac-form input.mono { font-family: var(--font-mono); font-size: var(--fs-mono); }
.ac-scopes { border: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ac-scopes legend { font-weight: 500; margin-bottom: 6px; }
.ac-scope { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.ac-scope input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.ac-scope b { display: block; font-weight: 600; }
.ac-scope .hint { display: block; }

/* ══ To do (/admin, design review 07 §1, R4) ═══════════════════════════════════ */

.rcards.rcards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 480px) { .rcards.rcards-2 { grid-template-columns: 1fr; } }
.todo-off { margin-top: 22px; }
.todo-off ul { padding-left: 18px; }
.todo-off ul:has(> li:only-child) { list-style: none; padding-left: 0; }

/* ══ Reviews (/admin/reviews, design review 07 §2, R5) ════════════════════════ */
/* Requests: the Papers summary, rows and side panel (.p-bar, .ftabs, .plist, .p-panel),
   with the request buckets (review_core.REQUEST_BAR) as segment and tab colours. */
.p-seg-needs { background: var(--warn-solid); }
.p-seg-open { background: var(--indigo-solid); }
.p-seg-confirmed { background: var(--ok-solid); }
.p-seg-declined { background: var(--border-control); }
.p-seg-ended { background: var(--track); }
.p-seg-other { background: var(--sky-solid); }
.ftab-needs .ftab-dot, .ftab-changes .ftab-dot { background: var(--warn-solid); }
.ftab-open .ftab-dot { background: var(--indigo-solid); }
.ftab-confirmed .ftab-dot { background: var(--ok-solid); }
.ftab-declined .ftab-dot { border: 1.5px dashed var(--border-control); }
.ftab-ended .ftab-dot { background: var(--track); }
.adm a.ftab-needs:not(.is-zero) { color: var(--warn); }
.adm a.ftab-needs[aria-current="page"] { background: var(--warn-subtle); color: var(--warn); }
.rv-info { margin-bottom: var(--sp-3); }
.rv-info p { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.rv-info a { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; }
/* "Project: X ×": the project filter as a removable chip on the toolbar. */
.rv-chip { margin-top: 0; padding-right: 2px; }
.adm .rv-chip .chip-x { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--r-pill); color: inherit; }
.rv-chip .chip-x:hover { background: #e0e7ff; }
.plist th a.sort { color: inherit; text-decoration: none; }
.plist th a.sort:hover { text-decoration: underline; }
.plist th[aria-sort] a.sort::after { content: " ↑"; }
.plist th[aria-sort="descending"] a.sort::after { content: " ↓"; }
.rv-list .c-status { width: 300px; }
.rv-list .c-status > .loz { vertical-align: middle; }
.rv-list .c-act { width: 200px; }
.c-status .loz + .loz { margin-left: 4px; }
.p-sub.is-warn, .p-facts dd.is-warn { color: var(--warn); }
.by.ok { color: var(--ok); font-weight: 600; }
.by.dim { font-style: italic; }
.resp { background: var(--warn-subtle); border: 1px solid var(--warn-border); color: var(--text); border-radius: var(--r-sm);
    padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.res { color: var(--ok); font-weight: 600; }
.rv-ids { overflow-wrap: anywhere; }
.drawer .p-draft textarea { width: 100%; }
@media (min-width: 900px) and (max-width: 1279px) {
    .rv-list .c-status { width: 230px; }
}
/* Create a review link and its hand-off, in the side panel (wide). */
.rv-mk { display: flex; flex-direction: column; gap: 6px; }
.adm .rv-mk select, .adm .rv-mk input[type=text], .adm .rv-mk input[type=email], .adm .rv-mk textarea { width: 100%; }
.adm .rv-mk textarea { min-height: 74px; }
.rv-mk .fld-row { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.rv-mk .fld-l, .rv-mk label.fld { font-weight: 500; }
.rv-mk .p-actions { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.grid2 > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (max-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.ds-pick { border: 1px solid var(--border-control); border-radius: var(--r-sm); max-height: 260px; overflow-y: auto; background: var(--surface); }
.ds-pick label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border-row); cursor: pointer; }
.ds-pick label:last-child { border-bottom: 0; }
.ds-pick label:hover { background: var(--surface-2); }
.ds-pick input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
/* The ID never breaks (on a phone it wrapped over three lines); the description takes what is left. */
.ds-pick .m { font-family: var(--font-mono); font-size: var(--fs-mono); font-weight: 600; white-space: nowrap; flex: none; }
.ds-pick .t { color: var(--text-muted); font-size: var(--fs-meta); min-width: 0; overflow-wrap: anywhere; }
.ds-pick .empty { padding: 16px 12px; color: var(--text-muted); }
.pick-tools { display: flex; gap: 14px; font-size: var(--fs-meta); }
.pick-tools a, .rv-mk .hint a { cursor: pointer; }
.rv-handoff { gap: 10px; }
.rv-handoff .alert { margin: 0; }
.copyrow { display: flex; gap: 8px; }
.adm .copyrow input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--fs-mono); }
.adm .draft { width: 100%; min-height: 260px; }
/* Answers to accept: one section per review, two-line rows (R5, 07 §2.4). */
.rv-sec-h { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.rv-sec-h form { margin: 0; }
.rv-ans .l-title { overflow-wrap: anywhere; }
.rv-ans .l-title a.mono { margin-right: 6px; }
.rv-ans s.old { color: var(--text-muted); }
.rv-ans .new { font-weight: 600; }
.rv-ans .l-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; white-space: normal; }
.lrow.is-conflict { background: var(--warn-subtle); }
.rv-ans-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
@media (max-width: 640px) {
    .rv-ans .l-title { white-space: normal; }
}
/* By project and PI (R5, 07 §2.5): Projects | PIs, filter tabs, two-line rows. */
.rv-dtabs { margin: -4px 0 12px; }
.rv-dash .l-col.rv-dstat { width: 290px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.rv-dash .rv-dstat .p-sub { margin-top: 0; max-width: 100%; }
.rv-dash .l-act { width: 190px; }
.dimtxt { color: var(--text-muted); font-style: italic; }
#pi-sugg { margin-bottom: var(--sp-4); }
.rv-merged { margin-top: var(--sp-4); padding: 12px 16px; }
.rv-merged > summary { cursor: pointer; font-weight: 600; }
.rv-merged .lst { margin-top: 10px; }
@media (max-width: 900px) {
    .rv-dash .l-col.rv-dstat { width: auto; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
    .rv-dash .l-act { width: auto; }
}

/* ══ Missing inputs (/admin/reviews?view=inputs, design review 07 §3, R5) ══════ */
.rv-seg-ok, .rv-legend .rv-seg-ok { background: var(--ok-solid); }
.rv-seg-check, .rv-legend .rv-seg-check { background: var(--sky-solid); }
.rv-seg-one, .rv-legend .rv-seg-one { background: var(--warn-solid); }
.rv-seg-more, .rv-legend .rv-seg-more { background: var(--danger); }
.rv-seg-closed, .rv-legend .rv-seg-closed { background: var(--border-control); }
.rv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-muted-bg); font-size: var(--fs-meta); }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rv-legend i { width: 10px; height: 10px; border-radius: var(--r-pill); display: inline-block; }
.rv-sel-proj { min-width: 0; max-width: 100%; }
.adm .rv-sel-proj select { min-width: 0; max-width: 280px; text-overflow: ellipsis; }
@media (max-width: 640px) {
    .rv-sel-proj { flex: 1 1 100%; }
    .adm .rv-sel-proj select { flex: 1 1 auto; max-width: 100%; width: 100%; }
}
.rv-more { margin-top: 6px; }
.rv-more > summary { list-style: none; cursor: pointer; }
.rv-more > summary::-webkit-details-marker { display: none; }
.rv-more[open] > summary { margin-bottom: 8px; }
.rv-types { overflow: visible; }
.rv-type { border-bottom: 1px solid var(--border-row); padding: 10px 18px; scroll-margin-top: 80px; }
.rv-type:last-child { border-bottom: 0; }
.rv-type-head { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) auto; gap: 8px 20px; align-items: center; }
.rv-type-name { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.rv-type-name .l-title { max-width: 100%; }
.rv-type-bar, .rv-proj-bar { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rv-bar { display: flex; }
.rv-counts { color: var(--text-muted); font-size: var(--fs-meta); line-height: var(--lh-meta); font-feature-settings: "tnum"; }
.rv-type-body { margin-top: 6px; }
.rv-type-body > summary { list-style: none; cursor: pointer; }
.rv-type-body > summary::-webkit-details-marker { display: none; }
.rv-type-body > summary .ico { transition: transform .15s; }
.rv-type-body[open] > summary .ico { transform: rotate(90deg); }
.rv-type-body > .hint, .rv-type-body > h3 { margin: 8px 0 4px; }
.rv-projs { list-style: none; display: flex; flex-direction: column; }
.rv-projs > li { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 6px 20px; padding: 8px 0; border-top: 1px dashed var(--border-row); align-items: start; }
.rv-projs > li > .hint { grid-column: 2; }
.rv-projs summary { cursor: pointer; overflow-wrap: anywhere; }
.rv-proj-name { font-weight: 500; }
.ds { list-style: none; margin-top: 6px; font-size: var(--fs-meta); line-height: var(--lh-meta); }
.ds li { padding: 4px 0; border-top: 1px dashed var(--border-row); overflow-wrap: anywhere; }
.ds .m { font-family: var(--font-mono); font-size: var(--fs-mono); font-weight: 600; white-space: nowrap; margin-right: 6px; }
.ds .ok { color: var(--ok); }
.ds .miss { color: var(--danger); display: block; }
.ds .chk { color: var(--warn); display: block; }
.ds .cls { color: var(--text-2); display: block; }
.rv-inputs { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-meta); }
.rv-inputs li { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.rv-inputs .num { color: var(--text-muted); }
.rv-dn-status { color: var(--text-muted-bg); }
.rv-dn-status .dot { margin-right: 8px; vertical-align: 1px; }
.rv-why { margin-top: 4px; font-size: var(--fs-meta); }
.rv-why ul { list-style: none; margin: 2px 0 6px; }
.dn-total { color: var(--text); }
.cmd { display: block; margin-top: 6px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--neutral-subtle); border: 1px solid var(--border); overflow-wrap: anywhere; white-space: pre-wrap; }
.reruns { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.rv-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 22px; align-items: start; }
.rv-ref { padding: 12px 16px; }
.rv-ref > summary { cursor: pointer; font-weight: 600; }
.rv-ref .plain { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.rv-ref > .hint { margin-top: 8px; }
.ap-q { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ap-q > li { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.ap-q .lbl { font-weight: 600; }
.ap-q .tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.ap-effects { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ap-go { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ap-go form { margin: 0; }
.p-panel .drawer-foot.ap-go { position: sticky; }
@media (max-width: 900px) {
    .rv-type-head { grid-template-columns: minmax(0, 1fr) auto; }
    .rv-type-name { grid-column: 1; grid-row: 1; }
    .rv-type-head > .l-act { grid-column: 2; grid-row: 1; }
    .rv-type-bar { grid-column: 1 / -1; grid-row: 2; }
    .rv-projs > li { grid-template-columns: minmax(0, 1fr); }
    .rv-projs > li > .hint { grid-column: 1; }
    .rv-foot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .rv-type { padding: 10px 14px; }
}
/* Phones: the three view tabs stay on one line that scrolls; the search takes a line. */
@media (max-width: 640px) {
    .subtabs.rv-subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
    .subtabs.rv-subtabs::-webkit-scrollbar { display: none; }
    .rv-toolbar .p-filters { flex-wrap: wrap; }
    .rv-toolbar .p-filters .search-fld { flex: 1 1 100%; }
    .adm .rv-toolbar .p-filters .rv-sel-proj { flex: 1 1 100%; }
}

/* A section that holds more than list rows (a blank, bars) stays shown when it has no .lrow. */
.sec.sec-keep { display: flex; }
/* A By project row with only its ⋯ keeps it at the top right on a phone (no lone line). */
@media (max-width: 900px) {
    .rv-dash .lrow:has(> .l-act > .menu:only-child) { position: relative; padding-right: 58px; }
    .rv-dash .lrow > .l-act:has(> .menu:only-child) { position: absolute; top: 8px; right: 14px; }
}

/* ══ Phones: the review of 19 Nov 2026 (owner's iPhone, judged by Opus) ═════════════ */
@media (max-width: 640px) {
    /* A list row's grey line wraps (up to three lines) instead of hiding the end behind
       "…": on Missing inputs the cut part was "Unlocks: …", the reason the row exists. */
    .l-meta { white-space: normal; overflow-wrap: anywhere; display: -webkit-box;
        -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
    /* Reviews' filters: "Changes to resolve" takes a whole line (seven pills leave a free
       cell), so its count never sits on the pill's edge. */
    .ftabs .ftab-changes { grid-column: 1 / -1; }
    .ftab-n { flex: none; padding-left: 6px; }
    /* Missing inputs, By type: the name, its bar and the button stacked. */
    .rv-type-head { grid-template-columns: minmax(0, 1fr); }
    .rv-type-head > .l-act { grid-column: 1; grid-row: 3; justify-content: flex-start; margin-left: 0; }
    /* Page header (ph-stack): title and ⋯ on the first line, the status line across the
       whole width, other header controls (the NERSC chip) under it. */
    .ph.ph-stack { display: grid; grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "title menu" "status status"; column-gap: var(--sp-3); row-gap: 6px; align-items: center; }
    .ph-stack > .ph-main, .ph-stack > .ph-actions { display: contents; }
    .ph-stack .ph-title { grid-area: title; }
    .ph-stack .ph-status { grid-area: status; }
    .ph-stack .ph-menu { grid-area: menu; justify-self: end; }
    .ph-stack .ph-actions > :not(.ph-menu):not(.ph-primary) { grid-column: 1 / -1; justify-self: start; }
    .ph-stack .chip-pop .menu-pop { left: 0; right: auto; }
    /* Missing inputs, Whom to ask first: the project (titles run to four lines) on one line
       of its own, cut if long; the facts under it in full. */
    #rank .l-proj { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #rank .l-sep { display: none; }
    #rank .l-meta { -webkit-line-clamp: unset; line-clamp: none; }
}
/* The smallest phones (iPhone SE, display zoom): the filter pills one per line, so a
   long label and its count always fit (Papers, Reviews, Chat access). */
@media (max-width: 359px) {
    .ftabs { grid-template-columns: minmax(0, 1fr); }
    .p-toolbar .seg a { padding: 0 8px; gap: 4px; }  /* Tracker | List | By author fit */
}
/* A bare grey track with no segments looks like a loader (Reviews with no requests). */
.p-bar:empty { display: none; }
/* Touch screens: 44 px tap targets without changing the layout. */
@media (pointer: coarse) {
    .about > summary { padding: 11px; margin: -11px; }
    .chip-pop > summary.chip-btn { height: var(--ctl-h); }
    .seg a { height: 40px; }
    .rv-type-body > summary { min-height: var(--ctl-h); display: inline-flex; align-items: center; }
}
