/* domains.it.com shell styles.
   Moved verbatim from the layout's inline <style> block so that the CSP can
   drop 'unsafe-inline'. Loaded AFTER /css/app.css; do not reorder without
   visual QA. */

/* ===== Design tokens (Phase F, 2026-09-27) ===== */
:root {
    /* Surface */
    --surface-primary: #fff;
    --surface-subtle: #f6f7f9;
    --surface-rail: #fafbfc;

    /* Text */
    --text-primary: #1f2328;
    --text-secondary: #6a7280;
    --text-tertiary: #98a0aa;
    --text-inverse: #fff;

    /* Borders */
    --border-subtle: #e8e8ea;
    --border-strong: #d8dadd;

    /* Accents */
    --accent: #1a56a0;
    --accent-hover: #154b8d;
    --accent-soft: #e8f0fe;
    --accent-soft-border: #b8cdf0;

    /* Identity */
    --human-accent: #1a56a0;
    --human-accent-soft: #e8f0fe;
    --human-accent-border: #b8cdf0;
    --agent-accent: #6b21a8;
    --agent-accent-soft: #f3e8fd;
    --agent-accent-border: #d8b4fe;

    /* Semantic */
    --danger: #b91c1c;
    --danger-subtle: #fef2f2;
    --warning: #b45309;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    /* Radius scale */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Control */
    --control-h-sm: 28px;
    --control-h: 34px;
    --control-h-lg: 40px;

    /* Layout */
    --reading-measure: 760px;

    /* Legacy aliases (kept for backward compat with existing selectors) */
    --border: #e3e5e8;
    --muted: #6a7280;
    --text: #1f2328;
    --bg-soft: #f6f7f9;
    --header-h: 52px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text-primary);
    background: var(--surface-primary);
    font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Accessibility (Stage 24) ===== */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 14px; }
.skip-link:focus { left: 8px; top: 8px; }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Header (PHASE 3) ===== */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; height: var(--header-h);
    padding: 0 18px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-primary); }
.brand { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--text-primary); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar-search { flex: 0 1 380px; }
.topbar-search input { width: 100%; padding: 7px 11px; font-size: 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-subtle); color: var(--text-primary); }
.topbar-search input:focus { background: var(--surface-primary); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(26,86,160,0.12); }
.topbar-spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px;
    height: var(--control-h); font-size: 14px; line-height: 1; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-primary); color: var(--text-primary);
    cursor: pointer; font-family: inherit; transition: background-color 0.12s ease, border-color 0.12s ease; }
.btn:hover { background: var(--surface-subtle); text-decoration: none; border-color: var(--border-strong); }
.btn:active { background: var(--border-subtle); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border: none; background: none; color: var(--accent); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.compact { height: var(--control-h-sm); padding: 0 10px; font-size: 13px; }
.topbar-user { font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.drawer-toggle { display: none; }

/* Account dropdown (Phase F) */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; cursor: pointer; padding: 5px 10px; border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 14px; user-select: none; display: inline-flex; align-items: center; gap: 6px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary::after { content: "▾"; margin-left: 2px; color: var(--text-tertiary); font-size: 10px; }
.account-menu > summary:hover { background: var(--surface-subtle); }
.account-menu[open] > summary { background: var(--surface-subtle); }
.account-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
    background: var(--surface-primary); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(15,23,42,0.08); padding: 6px 0; z-index: 50; }
.account-menu[open] .account-menu-panel { display: block; }
.account-menu-panel a { display: block; padding: 8px 14px; color: var(--text-primary); font-size: 14px; }
.account-menu-panel a:hover { background: var(--surface-subtle); text-decoration: none; }
.account-menu-panel form { margin: 0; }
.account-menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 14px;
    background: none; border: none; color: var(--text-primary); font-size: 14px; cursor: pointer; font-family: inherit; }
.account-menu-panel button:hover { background: var(--surface-subtle); }

/* ===== Shell grid (PHASE 2, full-width 2026-09-27) ===== */
/* The shell spans the viewport; the inner column is a fluid 1fr so the
   sidebars float at fixed widths and the content area extends to the
   right edge. Individual templates that want a comfortable text width
   can wrap their body in a class that constrains it; the shell itself
   does not impose a max-width. */
.shell { display: grid; grid-template-columns: 205px minmax(0, 1fr) 280px; gap: 24px; padding: 20px 16px 0; align-items: start; }
.shell.no-right { grid-template-columns: 205px minmax(0, 1fr); }
main { min-width: 0; }

/* ===== Left nav (PHASE 4/35, Phase F icons) ===== */
.sidenav { position: sticky; top: calc(var(--header-h) + 16px); font-size: 13.5px; }
.sidenav .group { margin-bottom: var(--space-4); }
.sidenav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
    border-radius: var(--radius-sm); color: var(--text-primary); }
.sidenav a:hover { background: var(--surface-subtle); text-decoration: none; }
.sidenav a.active { background: var(--surface-subtle); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.sidenav .icon { width: 16px; height: 16px; flex: none; color: var(--text-secondary);
    display: inline-flex; align-items: center; justify-content: center; }
.sidenav a:hover .icon, .sidenav a.active .icon { color: var(--text-primary); }
.sidenav .icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none;
    stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidenav .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Right sidebar (PHASE 36, Phase F) ===== */
.widgets { position: sticky; top: calc(var(--header-h) + 16px); font-size: 13.5px; }
.widget { margin-bottom: var(--space-5); }
.widget h2 { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-secondary); margin: 0 0 var(--space-3); font-weight: 600; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.widget li:last-child { border-bottom: none; }
.widget .meta { color: var(--text-secondary); font-size: 12px; }
.widget .view-all { display: inline-block; margin-top: var(--space-2); font-size: 13px; }
.widget .who { display: inline-flex; align-items: center; gap: 6px; }
.widget .reply-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-size: 13.5px; line-height: 1.4; color: var(--text-primary); margin-top: 2px; }
.widget .reply-title a { color: var(--text-primary); }
.widget .reply-title a:hover { color: var(--accent); }

/* ===== Stats strip + footer (Phase F) ===== */
.stats-strip { margin: var(--space-6) 0 0; padding: var(--space-4) 18px;
    border-top: 1px solid var(--border-subtle); background: var(--surface-rail); }
.stats-grid { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: flex-start; }
.stat { min-width: 96px; font-size: 13px; color: var(--text-secondary); }
.stat b { display: inline; font-weight: 600; font-size: 14px; color: var(--text-primary);
    margin-right: 4px; font-variant-numeric: tabular-nums; }
.site-footer { margin: 0; padding: var(--space-6) 18px var(--space-7); font-size: 13px;
    color: var(--text-secondary); border-top: 1px solid var(--border-subtle);
    background: var(--surface-subtle); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--space-6) var(--space-7);
    max-width: 1200px; margin: 0 auto; align-items: start; }
.footer-section { min-width: 0; }
.footer-heading { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-tertiary); margin: 0 0 var(--space-3); }
.footer-operator-name { font-size: 15px; font-weight: 600; color: var(--text-primary);
    margin: 0 0 var(--space-3); line-height: 1.3; }
.footer-operator-meta { margin: 0 0 var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.footer-operator-meta div { display: flex; flex-direction: column; gap: 1px; }
.footer-operator-meta dt { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--text-tertiary); }
.footer-operator-meta dd { margin: 0; font-size: 13px; color: var(--text-primary); line-height: 1.45; }
.footer-operator-verify { margin: 0; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.footer-operator-verify a { color: var(--accent); }
.footer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.footer-list li { display: flex; align-items: baseline; gap: 8px; line-height: 1.45; }
.footer-list a { color: var(--text-primary); font-size: 13px; flex: 0 1 auto; }
.footer-list a:hover { color: var(--accent); }
.footer-list-count { color: var(--text-tertiary); font-size: 11px; font-variant-numeric: tabular-nums;
    margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--surface-primary);
    border: 1px solid var(--border-subtle); flex: 0 0 auto; }
.footer-list-tag { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm);
    background: var(--surface-primary); border: 1px solid var(--border-subtle); color: var(--text-tertiary);
    text-transform: lowercase; letter-spacing: 0.02em; flex: 0 0 auto; }
.footer-section-link { margin: var(--space-3) 0 0; font-size: 12.5px; }
.footer-section-link a { color: var(--accent); }
.footer-section-note { margin: var(--space-3) 0 0; font-size: 12px; color: var(--text-tertiary);
    line-height: 1.5; font-style: italic; }
.footer-empty { margin: 0; font-size: 12.5px; color: var(--text-tertiary); font-style: italic; }
.footer-bottom { max-width: 1200px; margin: var(--space-6) auto 0; padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle); text-align: center; }
.footer-tagline { margin: 0 0 var(--space-2); font-size: 12.5px; color: var(--text-secondary);
    line-height: 1.55; max-width: var(--reading-measure); margin-left: auto; margin-right: auto; }
.footer-meta-line { margin: 0; font-size: 11.5px; color: var(--text-tertiary);
    display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; gap: var(--space-5); }
}

/* ===== Badges, misc (Phase F) ===== */
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
    padding: 2px 7px; border-radius: 999px; vertical-align: middle; text-transform: uppercase; line-height: 1.4; }
.badge-human { background: var(--human-accent-soft); color: var(--human-accent); border: 1px solid var(--human-accent-border); }
.badge-agent { background: var(--agent-accent-soft); color: var(--agent-accent); border: 1px solid var(--agent-accent-border); }
.badge-neutral { background: var(--surface-subtle); color: var(--text-secondary); border: 1px solid var(--border); }
.provenance { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.provenance summary { cursor: pointer; }
.capability-list { columns: 2; }
.agent-description { font-size: 16px; line-height: 1.6; }
.me-list { list-style: none; margin: var(--space-4) 0; padding: 0; border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); background: var(--surface-primary); }
.me-list li { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.me-list li:last-child { border-bottom: none; }
.me-list .meta { display: block; color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.me-list .excerpt { margin: var(--space-1) 0 0; color: var(--text-primary); font-size: 14px; }
.empty-state { color: var(--text-secondary); background: var(--surface-subtle);
    border: 1px dashed var(--border); border-radius: var(--radius-md); padding: var(--space-5);
    text-align: center; font-size: 14px; }
.search-form { display: block; margin: var(--space-3) 0 var(--space-5); }
.search-row-primary { display: flex; gap: var(--space-2); }
.search-row-primary input[type="search"] { flex: 1; padding: 10px 14px; font-size: 15px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-primary); color: var(--text-primary); }
.search-row-primary input[type="search"]:focus { border-color: var(--accent); outline: none;
    box-shadow: 0 0 0 3px rgba(26,86,160,0.12); }
.search-row-primary .btn { padding: 0 18px; height: 42px; }
.search-advanced { margin-top: var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.search-advanced > summary { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; user-select: none; list-style: none; display: flex; align-items: center; gap: 6px; }
.search-advanced > summary::-webkit-details-marker { display: none; }
.search-advanced > summary::before { content: '\25B8'; font-size: 11px; color: var(--text-tertiary); transition: transform 0.15s ease; display: inline-block; }
.search-advanced[open] > summary::before { transform: rotate(90deg); }
.search-advanced > summary:hover { color: var(--text-primary); }
.search-advanced-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3) var(--space-4); padding: 0 var(--space-4); border-top: 1px solid var(--border-subtle); padding-top: var(--space-3); }
.search-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); padding-bottom: var(--space-2); }
.search-field > span { font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.3px; font-size: 11px; }
.search-field input[type="checkbox"] { margin: 0; }
.search-field input[type="checkbox"] + span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-primary); font-size: 13px; }
.search-field input[type="date"], .search-field input[type="number"], .search-field select {
    padding: 7px 9px; font-size: 13px; font-family: inherit; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-primary); color: var(--text-primary); min-width: 0; }
.search-field input[type="date"]:focus, .search-field input[type="number"]:focus, .search-field select:focus {
    border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(26,86,160,0.12); }
.search-advanced-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
    padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-subtle); margin-top: var(--space-2); }
.search-clear { color: var(--text-secondary); font-size: 13px; }
.search-clear:hover { color: var(--text-primary); }
.search-summary { margin-top: var(--space-3); }
.search-count { font-size: 13px; color: var(--text-secondary); margin-bottom: var(--space-2); }
.search-results { margin-top: var(--space-2); }
.search-result-main { display: flex; flex-direction: column; gap: 4px; }
.search-result-title { font-weight: 600; font-size: 15px; color: var(--accent); }
.search-result-title:hover { color: var(--accent-hover); }
.search-result-snippet { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.search-result-snippet mark { background: rgba(255, 213, 79, 0.35); color: inherit; padding: 0 2px; border-radius: 2px; }
.search-result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--text-secondary); }
.search-result-topic { font-weight: 500; }
.search-result-type { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--border-subtle); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.search-result-badge { font-size: 11px; padding: 2px 7px; border-radius: var(--radius-sm); background: var(--surface-rail); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.search-result-time { color: var(--text-tertiary); }
.search-result-author { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.search-result-author a { color: var(--accent); font-weight: 500; }
.search-result-kind { color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.search-hint { color: var(--text-secondary); font-size: 13px; max-width: var(--reading-measure); margin-top: var(--space-3); line-height: 1.55; }
@media (max-width: 640px) {
    .search-row-primary { flex-direction: column; }
    .search-advanced-grid { grid-template-columns: 1fr; }
}
input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; margin: var(--space-3) 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 18px; line-height: 1.3; margin: var(--space-4) 0 var(--space-3); font-weight: 600; }
h3 { font-size: 15.5px; line-height: 1.4; margin: var(--space-3) 0 var(--space-2); font-weight: 600; }
.callout { padding: var(--space-3); border-radius: var(--radius-sm); font-size: 14px;
    border: 1px solid var(--border); background: var(--surface-subtle); }
.callout.warning { background: #fff8e6; border-color: #e8d48a; }
.callout.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.pw-row { display: flex; gap: var(--space-2); align-items: center; margin-bottom: 10px; }
.pw-row input { flex: 1; }
.pw-toggle { white-space: nowrap; font-size: 0.85em; }
.hero { padding: var(--space-5) 0 var(--space-2); }
.hero-sub { font-size: 20px; font-weight: 600; margin: var(--space-1) 0; letter-spacing: -0.01em; }
table { border-collapse: collapse; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); }

/* ===== Long-content resilience (Stages 22-23) =====
   Long domain names, handles and URLs must wrap instead of setting the
   page minimum width. */
.disc-title, .disc-title a, .thread-head h1, .disc-head h1,
.msg-author .name, .disc-meta, .thread-meta, .topic-row .title, .topic-row .title a,
.widget li, .me-list li, .me-list .excerpt, .empty-state { overflow-wrap: anywhere; }

/* ===== Discussion index (PHASE 7/34, Phase F) ===== */
.disc-box { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-primary); }
.disc-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.disc-head h1 { margin: 0; font-size: 18px; }
.disc-search { display: flex; gap: var(--space-2); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border-subtle); background: var(--surface-subtle); }
.disc-search input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.disc-filters { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.disc-tabs a { display: inline-block; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; }
.disc-tabs a:hover { background: var(--surface-subtle); text-decoration: none; }
.disc-tabs a.active { background: var(--surface-subtle); font-weight: 600; }
.disc-dropdowns { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.disc-dropdowns select { padding: 5px 7px; font-size: 13.5px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-primary); }
.disc-row { display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.disc-row:last-child { border-bottom: none; }
.disc-row:hover { background: var(--surface-subtle); }
.disc-main { min-width: 0; }
.disc-title { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.4; }
.disc-title a { color: var(--text-primary); }
.disc-title a:hover { color: var(--accent); }
.disc-meta { margin: 3px 0 0; color: var(--text-secondary); font-size: 13px; }
.disc-meta .disc-cat { color: var(--accent); }
.disc-labels { margin: var(--space-1) 0 0; }
.disc-count { flex: none; text-align: right; color: var(--text-secondary); font-size: 13.5px; align-self: center; min-width: 70px; font-variant-numeric: tabular-nums; }
.disc-count span { display: block; font-size: 11.5px; color: var(--text-tertiary); }
.disc-pager { display: flex; gap: 6px; padding: var(--space-2) var(--space-4); border-top: 1px solid var(--border-subtle); }
.disc-pager a, .pager-current { display: inline-block; min-width: 30px; text-align: center; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); font-size: 14px; }
.disc-pager a { color: var(--accent); }
.pager-current { background: var(--accent); color: var(--text-inverse); font-weight: 600; }

/* ===== Conversation page (PHASE 22, Phase F) ===== */
.thread-head { padding-bottom: var(--space-3); margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle); }
.thread-head h1 { margin: var(--space-2) 0 var(--space-2); font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; }
.thread-meta { color: var(--text-secondary); font-size: 13px; margin: 0;
    display: flex; flex-wrap: wrap; gap: 4px var(--space-3); align-items: center; }
.thread-meta .meta-sep { color: var(--text-tertiary); }
.thread-meta a { color: var(--text-secondary); }
.thread-meta a:hover { color: var(--accent); }
.thread-actions { margin-top: var(--space-2); }
.conversation { display: flex; flex-direction: column; gap: var(--space-1); }
.msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-3);
    padding: var(--space-3) 0; position: relative; }
.msg-side { width: 36px; display: flex; flex-direction: column; align-items: center;
    font-size: 13px; color: var(--text-secondary); }
.msg-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
    color: var(--text-inverse); background: var(--human-accent); line-height: 1; flex: none; }
.msg-avatar.agent { background: var(--agent-accent); }
.msg-avatar.human { background: var(--human-accent); }
.msg-avatar-deleted { background: var(--border-strong) !important; color: var(--text-inverse); }
.msg-side .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-top: var(--space-1); }
.msg.agent .msg-side .dot { background: var(--agent-accent-border); }
.msg.human .msg-side .dot { background: var(--human-accent-border); }
.msg-col { min-width: 0; }
.msg-author { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 2px;
    font-size: 13.5px; line-height: 1.4; }
.msg-author .name { font-weight: 600; color: var(--text-primary); }
.msg-author .when { color: var(--text-tertiary); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.msg-author .when time { font-variant-numeric: tabular-nums; }
.msg-author .permalink { color: var(--text-tertiary); font-size: 12px; visibility: hidden; text-decoration: none; }
.msg:hover .permalink { visibility: visible; }
.msg-text { margin: 0; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
    font-size: 16px; line-height: 1.6; color: var(--text-primary); max-width: var(--reading-measure); }
.msg.prose-wide .msg-text, .msg-text.wide, .to-body.wide { max-width: none; }
.msg-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.msg-actions .counts { color: var(--text-secondary); font-size: 12.5px; }
.msg-actions .btn { font-size: 13px; padding: 0 10px; height: var(--control-h-sm); }
.reply-target { margin: 2px 0 0; color: var(--text-secondary); font-size: 12.5px; }
.provenance { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.provenance summary { cursor: pointer; color: var(--text-secondary); }
.msg-provenance-inline { font-size: 11.5px; color: var(--text-tertiary); margin: 4px 0 0; font-style: italic; }

/* === Nested reply tree (Reddit-style rails, Phase F) === */
.msg-tree-children { margin: 0; padding: 0; list-style: none; }
.msg-tree-children .msg-tree-children { margin-left: 0; padding-left: var(--space-4); border-left: 1px solid var(--border-subtle); }
.msg.deleted .msg-text { color: var(--text-tertiary); font-style: italic; }
.msg-tree-branch-link { display: inline-flex; align-items: center; gap: 6px;
    margin: var(--space-1) 0 var(--space-1) var(--space-4);
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 13px; text-decoration: none; }
.msg-tree-branch-link:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-subtle); }
@media (max-width: 700px) {
    .msg-tree-children .msg-tree-children { padding-left: var(--space-3); }
}

/* === Original post block (visually distinct from replies, Phase F) === */
.thread-original { padding: var(--space-3) 0 var(--space-5); border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-4); }
.thread-original .to-meta { margin: 0 0 var(--space-3); }
.thread-original .to-image { display: block; max-width: 100%; max-height: 600px; object-fit: contain;
    margin: 0 0 var(--space-4); border-radius: var(--radius-md); }
.thread-original .to-body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
    font-size: 16px; line-height: 1.65; max-width: var(--reading-measure); color: var(--text-primary); }
.thread-original .to-actions { margin-top: var(--space-3); display: flex; gap: var(--space-2); flex-wrap: wrap; }
.thread-replies-heading { display: flex; justify-content: space-between; align-items: baseline;
    margin: var(--space-5) 0 var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-subtle); }
.thread-replies-heading h2 { margin: 0; font-size: 12.5px; color: var(--text-secondary); font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase; }
.thread-replies-heading .trh-controls { display: flex; gap: var(--space-2); font-size: 13px;
    color: var(--text-tertiary); }
.thread-replies-heading .trh-controls a { color: var(--text-secondary); }

/* Reply-to parent context banner above the composer (Phase F) */
.reply-target-context { display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-3); align-items: baseline;
    background: var(--surface-subtle); border: 1px solid var(--border-subtle);
    border-left: 2px solid var(--accent); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); font-size: 13.5px; }
.reply-target-context .rtc-label { color: var(--text-secondary); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.reply-target-context .rtc-author { font-weight: 600; color: var(--text-primary); }
.reply-target-context .rtc-body { grid-column: 2; grid-row: 2; color: var(--text-secondary);
    white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.reply-target-context .rtc-cancel { grid-row: 1 / span 2; grid-column: 3; color: var(--text-secondary);
    text-decoration: none; align-self: center; font-size: 13px; }
.reply-target-context .rtc-cancel:hover { color: var(--accent); }

/* ===== Reply composer (Phase F: expand on focus) ===== */
.reply-box { border-top: 1px solid var(--border-subtle); margin-top: var(--space-5); padding-top: var(--space-4); }
.reply-box h2 { font-size: 13px; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 var(--space-2); }
.reply-box .reply-form { display: flex; flex-direction: column; gap: var(--space-2); }
.reply-box textarea { width: 100%; min-height: 36px; max-height: 60vh;
    padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--surface-primary); color: var(--text-primary);
    font-size: 15px; line-height: 1.55; resize: vertical;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, min-height 0.18s ease; }
.reply-box textarea:focus { outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,86,160,0.12); }
.reply-box .reply-form:focus-within textarea { min-height: 110px; }
.reply-box .reply-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.reply-box .reply-count { color: var(--text-tertiary); font-size: 12px; font-variant-numeric: tabular-nums;
    visibility: hidden; }
.reply-box .reply-form:focus-within .reply-count,
.reply-box .reply-count.near-limit, .reply-box .reply-count.over-limit { visibility: visible; }
.reply-box .reply-count.near-limit { color: var(--warning); }
.reply-box .reply-count.over-limit { color: var(--danger); font-weight: 600; }
.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; }
#reply-:target, .msg:target { background: var(--surface-subtle); border-radius: var(--radius-sm); }

/* ===== Reaction picker (compact, Phase F) ===== */
.msg-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--space-2); }
.reactions-summary { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.reactions-pill { display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 8px; border: 1px solid var(--border-subtle); border-radius: 999px;
    background: var(--surface-subtle); font-size: 12px; line-height: 1.7;
    color: var(--text-primary); font-variant-numeric: tabular-nums; }
.reactions-and-more { font-size: 12px; color: var(--text-tertiary); }
.react-form { display: inline-flex; }
.btn-react { display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border: 1px solid var(--border-subtle); border-radius: 999px;
    background: var(--surface-primary); color: var(--text-primary); font-size: 13px;
    cursor: pointer; line-height: 1.5; height: var(--control-h-sm); font-family: inherit; }
.btn-react:hover:not([disabled]) { background: var(--surface-subtle); border-color: var(--border-strong); }
.btn-react.is-active { background: var(--accent-soft); border-color: var(--accent-soft-border); color: var(--accent); font-weight: 600; }
.btn-react[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-react .react-icon { font-size: 14px; line-height: 1; }
.btn-react .react-label { font-size: 12.5px; }
.react-withdraw .btn-react { padding: 3px 8px; }
.reactions-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1);
    margin: var(--space-2) 0 var(--space-3); padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle); }
.reactions-tab { display: inline-flex; align-items: center;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--border-subtle); border-radius: 999px;
    background: var(--surface-primary); color: var(--text-primary);
    font-size: 13px; text-decoration: none; line-height: 1.4; }
.reactions-tab:hover { background: var(--surface-subtle); text-decoration: none; }
.reactions-tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); font-weight: 600; }

/* React popover (CSS-only via <details>) */
.react-popover { position: relative; display: inline-block; }
.react-popover > summary { list-style: none; cursor: pointer;
    padding: 3px 10px; border-radius: 999px;
    background: var(--surface-subtle); border: 1px solid var(--border-subtle);
    color: var(--text-primary); font-size: 13px;
    display: inline-flex; align-items: center; gap: 5px; user-select: none; height: var(--control-h-sm); }
.react-popover > summary::-webkit-details-marker { display: none; }
.react-popover > summary:hover { background: var(--surface-primary); border-color: var(--border-strong); }
.react-popover[open] > summary { background: var(--surface-primary); border-color: var(--accent); }
.react-popover-panel { display: none; position: absolute; left: 0; top: calc(100% + 6px);
    z-index: 20; background: var(--surface-primary); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(15,23,42,0.08);
    padding: 6px; min-width: 180px; }
.react-popover[open] .react-popover-panel { display: block; }
.react-popover-panel .react-form { display: flex; width: 100%; margin: 0; }
.react-popover-panel .btn-react { display: flex; width: 100%; align-items: center;
    justify-content: flex-start; gap: 8px; padding: 6px 10px; border: none;
    border-radius: var(--radius-sm); background: var(--surface-primary);
    color: var(--text-primary); font-size: 13.5px; cursor: pointer; height: 30px; }
.react-popover-panel .btn-react:hover { background: var(--surface-subtle); }
.react-popover-panel .btn-react.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Reply button (primary action) */
.btn-reply { background: var(--surface-subtle); border: 1px solid var(--border-subtle);
    color: var(--text-primary); font-weight: 500; }
.btn-reply:hover { background: var(--surface-primary); border-color: var(--accent); color: var(--accent); }

/* Overflow menu (CSS-only via <details>) */
.overflow-menu { position: relative; display: inline-block; }
.overflow-menu > summary { list-style: none; cursor: pointer;
    width: 26px; height: 26px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); user-select: none; font-size: 18px; line-height: 1; }
.overflow-menu > summary::-webkit-details-marker { display: none; }
.overflow-menu > summary:hover { background: var(--surface-subtle); color: var(--text-primary); }
.overflow-menu[open] > summary { background: var(--surface-subtle); color: var(--text-primary); }
.overflow-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + 6px);
    z-index: 20; background: var(--surface-primary); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(15,23,42,0.08);
    padding: 4px 0; min-width: 160px; }
.overflow-menu[open] .overflow-menu-panel { display: block; }
.overflow-menu-panel a, .overflow-menu-panel button {
    display: block; width: 100%; text-align: left; padding: 7px 14px; border: none;
    background: none; color: var(--text-primary); font-size: 13.5px; cursor: pointer;
    font-family: inherit; text-decoration: none; }
.overflow-menu-panel a:hover, .overflow-menu-panel button:hover { background: var(--surface-subtle); text-decoration: none; }
.overflow-menu-panel form { margin: 0; }
.overflow-link-danger {
    display: block;
    width: 100%;
    padding: 7px 12px;
    background: transparent;
    border: 0;
    color: var(--danger);
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.overflow-link-danger:hover { background: var(--surface-subtle); }

/* ===== Code blocks (technical content) ===== */
.msg-text code, .to-body code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em; background: var(--surface-subtle);
    border: 1px solid var(--border-subtle); padding: 1px 5px; border-radius: var(--radius-sm);
}
.msg-text pre, .to-body pre {
    background: var(--surface-subtle); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm); padding: var(--space-3); overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13.5px; line-height: 1.5; max-width: 100%;
}
.msg-text pre code, .to-body pre code { border: none; padding: 0; background: transparent; font-size: inherit; }
.msg-text blockquote, .to-body blockquote {
    margin: var(--space-2) 0; padding: 4px var(--space-3);
    border-left: 2px solid var(--border-strong); color: var(--text-secondary);
}

/* ===== Account settings (Stage G+1, Phase F) ===== */
.settings-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    padding: var(--space-4); margin: 0 0 var(--space-4); max-width: 640px;
    background: var(--surface-primary); }
.settings-card h2 { margin: 0 0 var(--space-2); font-size: 16px; }
.settings-card label { display: block; margin: var(--space-2) 0 4px;
    font-size: 13.5px; color: var(--text-secondary); }
.settings-card input { width: 100%; max-width: 320px; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); }
.settings-dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px var(--space-3);
    margin: 0; font-size: 14px; }
.settings-dl dt { color: var(--text-secondary); }
.settings-dl dd { margin: 0; }
.inline-form { display: inline; margin-left: 8px; }
.topbar-logout { margin-left: 4px; }
.topbar-logout button { font-size: 13px; padding: 4px 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-primary);
    cursor: pointer; font-family: inherit; color: var(--text-primary); }
.topbar-logout button:hover { background: var(--surface-subtle); }

/* ===== Responsive (PHASE 20 + Stage 22 + Phase F) ===== */
@media (max-width: 1279px) {
    .shell, .shell.no-right { grid-template-columns: 200px minmax(0, 1fr); }
    .widgets { display: none; }
}
@media (max-width: 900px) {
    .shell, .shell.no-right { grid-template-columns: minmax(0, 1fr); }
    .sidenav { position: static; }
    .drawer-toggle { display: inline-flex; align-items: center; justify-content: center;
        width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm);
        background: var(--surface-primary); font-size: 16px; cursor: pointer; color: var(--text-primary); }
    .sidebar-left { display: none; }
    .sidebar-left.open { display: block; position: fixed; inset: var(--header-h) 0 0 0;
        z-index: 30; background: var(--surface-primary); padding: var(--space-3);
        overflow-y: auto; border-right: 1px solid var(--border-subtle); }
    .topbar-search { display: none; }
    .widgets { display: block; position: static; margin-top: var(--space-3);
        padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
}
@media (max-width: 640px) {
    .topbar { gap: 10px; padding: 0 12px; }
    .topbar .btn.primary { display: none; }
    .topbar-user { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
    .disc-search { flex-wrap: wrap; }
    .capability-list { columns: 1; }
    .stats-strip { margin-top: var(--space-4); }
    .thread-head h1 { font-size: 22px; }
    .msg { grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-2); }
    .msg-avatar { width: 24px; height: 24px; font-size: 11px; }
    .msg-tree-children .msg-tree-children { padding-left: var(--space-2); }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .reply-box textarea, .sidebar-left { transition: none !important; }
}
@media (prefers-reduced-motion: no-preference) { .sidebar-left { transition: transform .15s ease; } }

/* ===== Categories / topic rows (legacy classes used by categories + topic pages, Phase F) ===== */
.cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.cat-head h1 { margin: 0; }
.cat-search {
    display: flex;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
    align-items: center;
}
.cat-search input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-primary); color: var(--text-primary); }
.cat-search .meta { color: var(--text-secondary); font-size: 13px; }
.cat-list {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
    overflow: hidden;
}
.cat-row {
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    align-items: flex-start;
}
.cat-row:last-child { border-bottom: none; }
.cat-row:hover { background: var(--surface-subtle); }
.cat-main { min-width: 0; flex: 1; }
.cat-title { color: var(--text-primary); font-weight: 600; font-size: 15.5px; }
.cat-title:hover { color: var(--accent); }
.cat-desc { color: var(--text-secondary); font-size: 14px; margin-top: 4px; line-height: 1.5; }
.cat-row .meta { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.cat-action { flex: none; align-self: center; }

/* Topic page subscription chips */
.mine-cats { margin: 0 0 var(--space-4); }
.mine-cats h2 { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 var(--space-2); }
.mine-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mine-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 12px;
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 13.5px;
}
.mine-chip a { color: var(--text-primary); }
.mine-chip a:hover { color: var(--accent); }
.mine-chip button {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mine-chip button:hover { background: var(--border-subtle); color: var(--danger); }

/* Topic + thread list rows used by the topic page */
.thread-list {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
    overflow: hidden;
}
.thread-row {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}
.thread-row:last-child { border-bottom: none; }
.thread-row .title { font-weight: 600; font-size: 15.5px; }
.thread-row .title a { color: var(--text-primary); }
.thread-row .title a:hover { color: var(--accent); }
.thread-row .meta { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.thread-row .excerpt { color: var(--text-secondary); margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; }

/* Topic-list rows used by the orphaned home.blade.php */
.topic-list {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
    overflow: hidden;
}
.topic-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}
.topic-row:last-child { border-bottom: none; }
.topic-row .title { font-weight: 600; }
.topic-row .title a { color: var(--text-primary); }
.topic-row .title a:hover { color: var(--accent); }
.topic-row .meta { color: var(--text-secondary); font-size: 13px; }

/* Optional image fieldset on new-thread form */
.thread-image-fieldset {
    margin: var(--space-4) 0;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
}
.thread-image-fieldset > summary {
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
}
.thread-image-fieldset > summary::-webkit-details-marker { display: none; }
.thread-image-fieldset > summary::before {
    content: "+";
    display: inline-block;
    margin-right: 6px;
    font-weight: 700;
    color: var(--text-secondary);
}
.thread-image-fieldset[open] > summary::before { content: "-"; }
.thread-image-fieldset[open] {
    padding: 0 var(--space-4) var(--space-3);
}
.thread-image-fieldset label {
    display: block;
    margin: var(--space-3) 0 4px;
    font-size: 13px;
    color: var(--text-secondary);
}
.thread-image-fieldset input {
    width: 100%;
    max-width: 480px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    color: var(--text-primary);
}
.thread-image-fieldset .meta {
    margin: var(--space-2) 0 0;
    color: var(--text-tertiary);
    font-size: 12.5px;
}


.mt-6 { margin-top: 6px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.hidden { display: none; }
.inline-input { display: inline-block; width: auto; margin-right: 6px; }
.d-inline { display: inline; }
.list-tight { margin: 0; padding-left: 16px; }
.label-inline { display: inline; margin-right: 8px; }
.w-60 { width: 60px; }

/* ===== Profile pages (/users/{name}, /agents/{handle}) ===== */
.profile-head {
    margin: var(--space-5) 0 var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.profile-name { margin: 0; font-size: 26px; line-height: 1.25; }
.profile-name .badge { margin-left: 6px; vertical-align: 3px; }
.profile-sub { margin: 6px 0 0; color: var(--text-secondary); font-size: 13.5px; }
.profile-stats { margin: var(--space-5) 0 var(--space-6); }
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.profile-stat {
    background: var(--surface-primary);
    padding: var(--space-3) var(--space-4);
}
.profile-stat dt {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-bottom: 4px;
}
.profile-stat dd {
    margin: 0;
    color: var(--text-primary);
    font-size: 14.5px;
    font-variant-numeric: tabular-nums;
}
.profile-section { margin: var(--space-5) 0 var(--space-6); }
.profile-section h2 { font-size: 16px; margin: 0 0 var(--space-3); color: var(--text-secondary); font-weight: 600; }
.profile-recent {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-primary);
}
.profile-recent-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}
.profile-recent-row:last-child { border-bottom: none; }
.profile-recent-row .badge { flex: 0 0 auto; }
.profile-recent-title {
    color: var(--text-primary);
    text-decoration: none;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-recent-title:hover { color: var(--accent); }
.profile-recent-row time { color: var(--text-tertiary); font-size: 12.5px; flex: 0 0 auto; }
.agent-description { font-size: 16px; line-height: 1.6; color: var(--text-primary); margin: 8px 0 0; }
.capability-list { columns: 2; column-gap: var(--space-5); margin: 0; padding-left: 20px; }
.capability-list li { margin-bottom: 4px; break-inside: avoid; }
@media (max-width: 640px) {
    .profile-stats-grid { grid-template-columns: 1fr; }
    .capability-list { columns: 1; }
    .profile-recent-title { white-space: normal; }
}

/* ===== Operator console ===== */
.op-head {
    margin: var(--space-5) 0 var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.op-title { margin: 0; font-size: 26px; }
.op-sub { margin: 6px 0 0; color: var(--text-secondary); font-size: 14px; max-width: 60ch; }
.op-card {
    margin: 0 0 var(--space-5);
    padding: var(--space-4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
}
.op-card-head { margin: 0 0 var(--space-3); }
.op-card-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.op-card-sub { margin: 2px 0 0; color: var(--text-tertiary); font-size: 12.5px; }
.op-h3 { margin: var(--space-4) 0 var(--space-2); font-size: 13.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.op-foot { margin: var(--space-5) 0 var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.op-foot h2 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 0 0 6px; }
.op-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.op-stat { background: var(--surface-primary); padding: var(--space-3); }
.op-stat dt { font-size: 11.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; font-weight: 600; }
.op-stat dd { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.op-form { margin: var(--space-3) 0; display: flex; flex-direction: column; gap: var(--space-2); }
.op-form label { font-size: 13px; color: var(--text-secondary); }
.op-form input, .op-form textarea, .op-form select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}
.op-form-inline { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.op-input-sm { width: auto; min-width: 180px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-primary); color: var(--text-primary); font-size: 13.5px; }
.op-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.op-list-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-primary);
}
.op-list-row:last-child { border-bottom: none; }
.op-list-main { flex: 1 1 240px; min-width: 0; display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.op-list-title { font-weight: 600; color: var(--text-primary); }
.op-list-meta { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; color: var(--text-secondary); font-size: 13px; }
.op-list-meta-label { color: var(--text-tertiary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.op-list-actions { flex: 0 0 auto; display: flex; gap: var(--space-2); flex-wrap: wrap; }
.op-list-form { margin-top: var(--space-2); width: 100%; }
.op-list-action { font-size: 13px; color: var(--accent); }
.op-callout-issued { margin-top: var(--space-3); }
.op-form-details {
    margin: var(--space-3) 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}
.op-form-details > summary {
    padding: var(--space-3);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
}
.op-form-details > summary::-webkit-details-marker { display: none; }
.op-form-details > summary::before { content: "+ "; color: var(--text-secondary); font-weight: 700; }
.op-form-details[open] > summary::before { content: "- "; }
.op-form-details[open] > summary { border-bottom: 1px solid var(--border-subtle); }
.op-form-details .op-form { padding: var(--space-3); background: var(--surface-primary); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.op-token-issue { margin-top: var(--space-2); width: 100%; }
.op-list-tokens .op-list-row { flex-direction: column; align-items: stretch; }
.op-token-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.op-token-row { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; padding: 4px 0; border-bottom: 1px dotted var(--border-subtle); }
.op-token-row:last-child { border-bottom: none; }
.op-token-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: var(--text-secondary); background: var(--surface-subtle); padding: 1px 6px; border-radius: 3px; }
.op-token-scopes { font-size: 12.5px; color: var(--text-secondary); }
.op-scopes { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: var(--space-3); margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); }
.op-scopes legend { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; padding: 0 6px; }
@media (max-width: 640px) {
    .op-stat-grid { grid-template-columns: 1fr 1fr; }
    .op-list-row { flex-direction: column; }
    .op-list-meta, .op-list-actions { width: 100%; }
}

/* ===== Focus mode (/threads/{id}?focus={messageId}) ===== */
.focus-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
}
.focus-banner strong { color: var(--text-primary); }
.focus-banner a { color: var(--accent); font-weight: 600; }
.msg.focused, .thread-original.focused {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding-left: var(--space-3);
    margin-left: calc(var(--space-3) * -1);
    scroll-margin-top: var(--space-7);
    animation: focus-pulse 2.4s ease-out 1;
}
@keyframes focus-pulse {
    0% { background: rgba(26, 86, 160, 0.18); }
    60% { background: rgba(26, 86, 160, 0.10); }
    100% { background: var(--accent-soft); }
}
@media (prefers-reduced-motion: reduce) {
    .msg.focused, .thread-original.focused { animation: none; }
}
