/* eAgent — "Ink & Signal". Light and dark themes via data-theme on <html>. */
:root, [data-theme="light"] {
  --bg: #F5F6FB; --surface: #FFFFFF; --surface2: #F5F6FB; --line: #E3E6F2; --line2: #D5D9EC;
  --text: #0B1026; --muted: #5A6080; --track: #EEF0F8; --track2: #DDE1FA; --track3: #A9B2F8;
  --indigo: #4C5BF5; --indigo-text: #3B48D6; --indigo-line: #C9CEF6; --indigo-soft: #EEF0FF; --on-indigo: #FFFFFF;
  --primary-bg: #0B1026; --primary-text: #FFFFFF;
  --amber: #F5B04C; --amber-strong: #E08A00; --amber-bg: #FFF3E0; --amber-text: #8A4B00; --amber-line: #F0D6A8; --amber-surface: #FFFBF3;
  --green-bg: #E7F6EF; --green-text: #146C47; --red-bg: #FDECEA; --red-text: #B42318; --blue-bg: #E8EEFF; --blue-text: #2B4FCF;
  --chip: #EEF0F8; --chip-text: #3B4270; --link: #3B48D6; --shadow: rgba(11,16,38,.18);
  --sb-bg: #FFFFFF; --sb-card: #F5F6FB; --sb-line: #E3E6F2; --sb-text: #0B1026; --sb-muted: #4A5175; --sb-dim: #5A6080;
  --sb-active: #EEF0FF; --sb-active-text: #2C38B8; --sb-accent: #4C5BF5; --sb-on-accent: #FFFFFF;
  --inv-bg: #0B1026; --inv-text: #EEF0FF; --inv-muted: #B9BEDF; --inv-track: #2A3366;
  --sc-bg: #EEF1FB; --sc-card: #FFFFFF; --sc-card2: #E8EBFC; --sc-line: #DCE0F2; --sc-line2: #C9CFEA;
  --sc-text: #0B1026; --sc-muted: #4A5175; --sc-dim: #5A6080; --sc-soft: #3B4270; --sc-faint: #A9B0D2;
  --sc-accent: #4C5BF5; --sc-on-accent: #FFFFFF; --sc-link: #3B48D6; --sc-paper: #FFFFFF; --sc-paper2: #DCE1FF; --sc-paper-line: #C9CFEA;
  --sc-dot: rgba(11,16,38,.08); --sc-border: rgba(11,16,38,.16); --sc-glow: .2;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E1328; --surface: #151B36; --surface2: #11172F; --line: #262E55; --line2: #333D6E;
  --text: #EEF0FF; --muted: #A3A9C9; --track: #232B52; --track2: #2E3870; --track3: #5866C9;
  --indigo: #7F8BFF; --indigo-text: #AEB6FF; --indigo-line: #3A4590; --indigo-soft: #1F2752; --on-indigo: #0B1026;
  --primary-bg: #EEF0FF; --primary-text: #0B1026;
  --amber-bg: #3A2E14; --amber-text: #F5C46F; --amber-line: #6B5220; --amber-surface: #221C10;
  --green-bg: #173226; --green-text: #6FD3A0; --red-bg: #3D1F1D; --red-text: #F28B82; --blue-bg: #1E2A55; --blue-text: #9DB4FF;
  --chip: #1F2752; --chip-text: #C5CAEB; --link: #AEB6FF; --shadow: rgba(0,0,0,.5);
  --sb-bg: #0B1026; --sb-card: #141B3D; --sb-line: #222A55; --sb-text: #EEF0FF; --sb-muted: #B9BEDF; --sb-dim: #9AA1C8;
  --sb-active: #1A2250; --sb-active-text: #FFFFFF; --sb-accent: #6E7BFF; --sb-on-accent: #0B1026;
  --inv-bg: #EEF0FF; --inv-text: #0B1026; --inv-muted: #4A507A; --inv-track: #DDE0F5;
  --sc-bg: #0B1026; --sc-card: #141B3D; --sc-card2: #1A2250; --sc-line: #222A55; --sc-line2: #2A3366;
  --sc-text: #EEF0FF; --sc-muted: #B9BEDF; --sc-dim: #9AA1C8; --sc-soft: #C5CAEB; --sc-faint: #5B6496;
  --sc-accent: #6E7BFF; --sc-on-accent: #0B1026; --sc-link: #AEB6FF; --sc-paper: #EEF0FF; --sc-paper2: #AEB6FF; --sc-paper-line: #EEF0FF;
  --sc-dot: rgba(238,240,255,.07); --sc-border: rgba(238,240,255,.2); --sc-glow: .45;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
body, .sidebar, .card, .scene, .notice, input, select, textarea, button { transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
a { color: var(--link); }
a:hover { color: var(--text); }
.serif, h1, h2, .brand span { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-weight: 400; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { flex-shrink: 0; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 256px; flex-shrink: 0; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px; background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--sb-text); text-decoration: none; }
.brand svg { width: 32px; height: 32px; }
.brand span { font-size: 25px; font-weight: 600; }
.brand-ring { fill: none; stroke: var(--sb-accent); stroke-width: 1.5; }
.brand-core { fill: var(--sb-accent); }
.brand-dot { fill: var(--amber); }
#tabs { display: flex; flex-direction: column; gap: 3px; }
#tabs button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px; border: none; border-radius: 10px;
  background: none; color: var(--sb-muted); font: inherit; text-align: left; cursor: pointer; }
#tabs button:hover { background: var(--sb-card); color: var(--sb-text); }
#tabs button.active { background: var(--sb-active); color: var(--sb-active-text); font-weight: 600; }
#tabs button span:first-of-type { flex: 1; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { min-width: 22px; padding: 1px 7px; border-radius: 99px; font-size: 12px; font-weight: 700; text-align: center;
  background: var(--sb-accent); color: var(--sb-on-accent); }
.nav-badge.amber { background: var(--amber); color: #0B1026; }
main { flex: 1; min-width: 0; padding: 32px clamp(16px, 3vw, 44px) 96px; }
.tab { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

/* ---------- activity dock ---------- */
.dock { margin-top: auto; background: var(--sb-card); border: 1px solid var(--sb-line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.dock-head .live { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sb-accent); display: inline-block; flex-shrink: 0; }
.dot.ok { background: #2FB383; }
.dot.bad { background: var(--red-text); }
.dock-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.dock-row button { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1; border-radius: 8px; padding: 2px; }
.dock-row button:focus-visible { outline: 2px solid var(--sb-accent); }
.dock-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dock-text b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sb-text); }
.dock-text span { color: var(--sb-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; border-radius: 2px; background: var(--sb-line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; background: var(--sb-accent); animation: pulse 1.8s ease-in-out infinite; }
.dock-recent { border-top: 1px solid var(--sb-line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.dock-recent button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--sb-muted); font-size: 12px; }
.dock-recent button:hover { color: var(--sb-text); }
/* dock: hidden when idle; keeps the help links pinned to the bottom */
.dock { animation: rise .25s ease-out; }
.dock.hidden + .sidebar-foot { margin-top: auto; }
.dock-row button { padding: 6px; margin: -4px; transition: background .15s; }
.dock-row button:hover { background: var(--sb-line); }
.dock-review button { background: var(--amber-bg); border: 1px solid var(--amber-line); margin: 0; }
.dock-review button:hover { background: var(--amber-bg); border-color: var(--amber-strong); }
.dock-review .dock-text b { color: var(--amber-text); }
.dock-go { color: var(--amber-text); font-size: 18px; line-height: 1; }
.dock-more { all: unset; cursor: pointer; font-size: 12px; color: var(--sb-dim); }
.dock-more:hover { color: var(--sb-text); }
.dock-more:focus-visible, .dock-recent button:focus-visible { outline: 2px solid var(--sb-accent); border-radius: 4px; }
.dock-recent-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--sb-dim); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.dock-recent .dock-recent-head button { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11px; color: var(--sb-dim); }
.dock-recent-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-recent time { flex-shrink: 0; font-size: 11px; color: var(--sb-dim); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.engine { font-size: 12px; color: var(--sb-dim); display: inline-flex; align-items: center; gap: 8px; }
.theme-switch { display: inline-flex; padding: 3px; gap: 3px; border-radius: 99px; background: var(--sb-card); border: 1px solid var(--sb-line); }
.theme-switch button { width: 44px; height: 36px; border-radius: 99px; border: none; background: transparent; color: var(--sb-dim); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.theme-switch button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch button[aria-pressed="true"] { background: var(--sb-accent); color: var(--sb-on-accent); }

/* ---------- spinners & motion ---------- */
.spin { animation: spin 1.3s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@keyframes scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes rise { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes flow { to { stroke-dashoffset: -40; } }
@keyframes fall { 0% { transform: translateY(-14px); opacity: 0; } 30% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.pulse { animation: pulse 2s ease-in-out infinite; }
.float { animation: float 5s ease-in-out infinite; }
.float2 { animation: float 6.5s ease-in-out infinite .8s; }
.flow { animation: flow 1.6s linear infinite; }
.fall { animation: fall 2.8s ease-out infinite; }
.orbit { animation: spin 40s linear infinite; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- generic UI ---------- */
h1 { margin: 0; font-size: 40px; line-height: 1.1; }
h2 { margin: 0; font-size: 26px; line-height: 1.2; }
h3 { margin: 0; font-size: 16px; font-weight: 600; }
p { margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--indigo-text); }
.eyebrow.amber { color: var(--amber-text); }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head-text { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: flex; flex-wrap: wrap; gap: 16px; }
.grid > * { flex: 1 1 280px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.card.focus { border: 2px solid var(--indigo); }
.scene { background: var(--sc-bg); color: var(--sc-text); border: 1px solid var(--sc-line); border-radius: 24px; padding: 28px; }
.inverse { background: var(--inv-bg); color: var(--inv-text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--primary-bg); color: var(--primary-text); }
.btn:hover { color: var(--primary-text); filter: brightness(1.08); }
.btn.indigo { background: var(--indigo); color: var(--on-indigo); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line2); }
.btn.secondary:hover { color: var(--text); background: var(--surface2); }
.btn.ghost { background: none; color: var(--muted); }
.btn.danger { background: var(--red-bg); color: var(--red-text); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=url], input[type=date], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 96px; resize: vertical; }
textarea.tall { min-height: 200px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--chip-text); white-space: nowrap; }
.chip.ok { background: var(--green-bg); color: var(--green-text); }
.chip.warn { background: var(--amber-bg); color: var(--amber-text); }
.chip.bad { background: var(--red-bg); color: var(--red-text); }
.chip.indigo { background: var(--indigo-soft); color: var(--indigo-text); }
.chip svg { width: 12px; height: 12px; }
.banner { padding: 12px 14px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner.ok { background: var(--green-bg); color: var(--green-text); }
.banner.warn { background: var(--amber-bg); color: var(--amber-text); }
.banner.bad { background: var(--red-bg); color: var(--red-text); }
.banner.info { background: var(--surface2); color: var(--chip-text); border: 1px solid var(--line); }
ul.tight { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.scroll-x { overflow-x: auto; }
.scanline { position: absolute; top: 0; left: 0; width: 40%; height: 3px; background: var(--indigo); animation: scan 1.8s ease-in-out infinite; }
.skeleton { height: 10px; border-radius: 5px; background: var(--track); }

/* ---------- home ---------- */
.stat { display: flex; gap: 18px; align-items: center; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 8px; }
.sq { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- add information ---------- */
.queue { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.filetag { width: 38px; height: 46px; border-radius: 7px; display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10px; font-weight: 800; flex-shrink: 0; background: var(--chip); color: var(--chip-text); }
.filetag.pdf { background: var(--red-bg); color: var(--red-text); }
.filetag.doc { background: var(--blue-bg); color: var(--blue-text); }
.filetag.img { background: var(--green-bg); color: var(--green-text); }
.filetag.web { background: var(--amber-bg); color: var(--amber-text); }

/* ---------- profile ---------- */
.pf-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pf-search { flex: 1 1 280px; max-width: 460px; margin: 0; position: relative; display: block; }
.pf-search svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.pf-search input { width: 100%; min-height: 44px; padding: 10px 12px 10px 40px; border: 1px solid var(--line2); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.seg-ctl { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.seg-ctl button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: none; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg-ctl button:hover { color: var(--text); background: var(--surface2); }
.seg-ctl button[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-text); }
.seg-n { font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--chip); color: var(--chip-text); }
.seg-ctl button[aria-pressed="true"] .seg-n { background: color-mix(in srgb, var(--primary-text) 20%, transparent); color: inherit; }
.seg-ctl button.attn .seg-n { background: var(--amber); color: #0B1026; }

.pf-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 24px; align-items: start; }
.pf-rail { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 48px); overflow-y: auto; padding: 2px; }
.pf-rail button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px; border: none; border-radius: 10px;
  background: none; color: var(--muted); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pf-rail button:hover { background: var(--surface); color: var(--text); }
.pf-rail button[aria-current="true"] { background: var(--indigo-soft); color: var(--indigo-text); font-weight: 600; }
.pf-rail .rl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-rail .rn { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; }
.pf-rail .rn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.pf-rail button.zero .rl { opacity: .55; }
.pf-rail button.has-attn .rl::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.pf-rail button.missing { color: var(--muted); font-style: italic; }
.pf-rail button.missing:hover .rn { color: var(--indigo-text); }
.rail-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.rail-head { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--muted); padding: 14px 12px 4px; }
.pf-pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pf-section { gap: 6px; padding: 18px 22px 10px; }
.pf-empty { gap: 12px; padding: 8px 0 12px; }
.pf-empty.card { padding: 22px; }

.fact-list { display: flex; flex-direction: column; }
.fact { border-top: 1px solid var(--line); }
.fact:first-child { border-top: none; }
.fact > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 6px; margin: 0 -6px; border-radius: 10px; cursor: pointer; min-height: 52px; }
.fact > summary::-webkit-details-marker, .gaps-card > summary::-webkit-details-marker { display: none; }
.fact > summary:hover { background: var(--surface2); }
.fact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fact-main b { font-weight: 600; }
.fact-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact[open] .fact-sub { display: none; }
.chev { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
details[open] > summary .chev { transform: rotate(90deg); }
.fact-detail { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; }
.fact-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; color: var(--muted); }
.fact-meta b { font-weight: 600; color: var(--text); }
.fact-form h3 { margin-bottom: -4px; }
.fact-detail .fact-form { padding: 18px; }
.btn.ghost.text-bad { color: var(--red-text); }
.btn.ghost.text-bad:hover { background: var(--red-bg); color: var(--red-text); }
dl.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; }
.sources { font-size: 12px; color: var(--muted); }

.gaps-card { gap: 0; padding: 0; }
.gaps-sum { list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; }
.gaps-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--amber-bg); color: var(--amber-text); flex-shrink: 0; }
.gaps-card[open] .fact-sub { display: block; }
.gaps-card > ul, .gaps-card > h3, .gaps-card > ul.tight { margin-left: 20px; margin-right: 20px; }
.gaps-card > :last-child { margin-bottom: 18px; }
.gap-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.gap-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.gap-list .chip { min-width: 64px; justify-content: center; text-transform: capitalize; }
.gaps-more-row { margin: 12px 20px 0; }
.gaps-conf { margin: 14px 20px 0; }
.gaps-conf ul.tight { margin-top: 8px; font-size: 14px; }

/* ---------- opportunity ---------- */
.gauge-wrap { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.gauge-wrap svg.gauge { flex: 0 1 300px; min-width: 220px; height: auto; }
.pillar { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr) 64px; gap: 14px; align-items: center; }
.pillar-track { height: 22px; border-radius: 6px; background: var(--track); width: var(--w, 100%); }
.pillar-track > i { display: block; height: 100%; border-radius: 6px; background: var(--indigo); width: var(--fill, 0%); }
.pillar-track > i.low { background: var(--amber); }
.docs { display: flex; flex-wrap: wrap; gap: 16px; }
.doc { flex: 1 1 300px; min-width: 0; display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 16px; border: 1px solid var(--line); }
.doc.busy { border-color: var(--amber-line); background: var(--amber-surface); }
.doc.failed { border-color: var(--red-bg); }
.doc-thumb { width: 80px; height: 104px; flex-shrink: 0; }
.journey { list-style: none; margin: 0; padding: 0; min-width: 720px; display: grid; grid-template-columns: repeat(var(--steps, 6), minmax(0, 1fr)); gap: 6px; }
.journey li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; }
.journey li::before { content: ""; position: absolute; top: 18px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.journey li:first-child::before { display: none; }
.journey li.done::before, .journey li.now::before { background: var(--indigo); }
.journey button { position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line2); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.journey li.done button { background: var(--indigo); border-color: var(--indigo); color: var(--on-indigo); }
.journey li.now button { border: 3px solid var(--indigo); color: var(--indigo-text); }
.journey li.end button { background: var(--amber); border-color: var(--amber); color: #0B1026; }
.journey span { font-size: 12px; color: var(--muted); }
.journey li.now span { color: var(--indigo-text); font-weight: 700; }
.doc-preview { background: #fff; color: #111; border-radius: 12px; padding: 36px 44px; font-family: Georgia, "Times New Roman", serif; font-size: 14px; border: 1px solid var(--line); }
.doc-preview h1 { font-size: 24px; color: #111; font-family: Georgia, serif; }
.doc-preview h4 { border-bottom: 1px solid #333; text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 6px; font-size: 13px; }
.doc-preview .meta { font-style: italic; color: #444; }
.doc-preview ul { margin: 2px 0 6px; }
.doc-preview p { margin: 0 0 10px; }

/* ---------- notices ---------- */
.notices { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; width: min(calc(100vw - 40px), 400px); }
.notice { background: var(--inv-bg); color: var(--inv-text); border-radius: 18px; padding: 14px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 22px 56px var(--shadow); animation: rise .4s ease-out both; }
.notice .nic { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--amber); color: #0B1026; }
.notice.bad .nic { background: #F28B82; }
.notice.info .nic { background: var(--indigo); color: var(--on-indigo); }
.notice .nic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notice .ntext { flex: 1; min-width: 0; }
.notice .ntext b { display: block; font-weight: 600; }
.notice .ntext span { font-size: 13px; color: var(--inv-muted); display: block; overflow: hidden; text-overflow: ellipsis; }
.notice .nact { min-height: 40px; padding: 0 14px; border-radius: 10px; border: none; background: var(--indigo); color: var(--on-indigo); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
[data-theme="dark"] .notice .nact { background: #4C5BF5; color: #fff; }
.notice .nx { width: 40px; height: 40px; border: none; background: none; color: var(--inv-muted); cursor: pointer; font-size: 20px; border-radius: 10px; }
.drop-veil { position: fixed; inset: 12px; z-index: 60; border: 3px dashed var(--indigo); border-radius: 24px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-veil div { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 22px; font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--text); }
.drop-veil svg { width: 54px; height: 54px; fill: none; stroke: var(--indigo); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }


.about-link { all: unset; cursor: pointer; font-size: 13px; color: var(--sb-dim); padding: 0 8px; }
.about-link:hover, .about-link:focus-visible { color: var(--sb-text); text-decoration: underline; }
.dock-all { all: unset; cursor: pointer; font-size: 12px; color: var(--sb-accent); font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.dock-all:focus-visible { outline: 2px solid var(--sb-accent); }

/* ---------- step indicators (getting started + add guide) ---------- */
.ck { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  border: 2px solid var(--line2); background: var(--surface); color: var(--muted); }
.ck svg { width: 15px; height: 15px; }
.done > .ck { background: var(--indigo); border-color: var(--indigo); color: var(--on-indigo); }
.now > .ck { border-color: var(--indigo); color: var(--indigo-text); border-width: 3px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.checklist li.now { border: 2px solid var(--indigo); }
.checklist li.done b { color: var(--muted); text-decoration: line-through; }
.btn.amber { background: var(--amber); color: #0B1026; }
.btn.amber:hover { color: #0B1026; }
.stack.tight { gap: 4px; }
.text-bad { color: var(--red-text); }

/* ---------- activity page: inbox-style tabs, filters, pinned sections and a day-grouped timeline ---------- */
.act-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dot.pulse { background: var(--indigo); box-shadow: 0 0 0 0 color-mix(in srgb, var(--indigo) 50%, transparent); animation: act-pulse 1.8s ease-out infinite; }
@keyframes act-pulse { to { box-shadow: 0 0 0 7px transparent; } }
.act-toolbar { align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.act-views { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.act-views button { flex-shrink: 0; }
.act-filters { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; justify-content: flex-end; min-width: 0; }
.act-kind select { min-height: 44px; padding: 0 34px 0 12px; border: 1px solid var(--line2); border-radius: 7px; background-color: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.act-search { flex: 0 1 280px; min-width: 0; }
.act-feed { display: flex; flex-direction: column; gap: 28px; padding-bottom: 24px; }
.act-section { display: flex; flex-direction: column; gap: 10px; }
.act-section-head { display: flex; align-items: center; gap: 10px; }
.act-section-head h2 { font-size: 15px; }
.act-section-head > .small { margin-left: auto; }
/* Pinned work (needs you, in progress) sits in cards; history reads as a timeline. */
.act-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.act-section.needs .act-list { border-color: var(--amber-line); }
.act-item { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 12px 16px; transition: background-color .12s; }
.act-list > .act-item + .act-item { border-top: 1px solid var(--line); }
.act-item[data-act-row] { cursor: pointer; }
.act-item[data-act-row]:hover { background: var(--surface2); }
.act-icon { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--muted); box-shadow: 0 0 0 4px var(--surface); }
.act-icon svg:not(.spin) { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.st-working .act-icon, .st-queued .act-icon { background: var(--indigo-soft); color: var(--indigo-text); }
.st-needs .act-icon { background: var(--amber-surface); color: var(--amber-text); }
.st-failed .act-icon { background: color-mix(in srgb, var(--red-text) 12%, var(--surface)); color: var(--red-text); }
.st-done .act-icon { background: var(--green-bg); color: var(--green-text); }
.act-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.act-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-event { color: var(--muted); }
.act-title b { font-weight: 600; }
.act-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.st-failed .act-meta { color: var(--red-text); }
.act-side { display: flex; align-items: center; gap: 10px; }
.act-time { min-width: 72px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-new { width: 8px; height: 8px; border-radius: 50%; background: var(--indigo); }
.act-item.is-new .act-title b { color: var(--text); }
.act-item .btn { white-space: nowrap; }
.act-bar { display: block; height: 3px; margin-top: 5px; border-radius: 3px; background: var(--track); overflow: hidden; max-width: 320px; }
.act-bar > i { display: block; height: 100%; width: 35%; border-radius: 3px; background: var(--indigo); animation: act-slide 1.6s ease-in-out infinite; }
.act-bar.queued > i { width: 100%; background: repeating-linear-gradient(90deg, var(--line2) 0 6px, transparent 6px 12px); animation: none; }
@keyframes act-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .act-bar > i, .dot.pulse { animation: none; width: 100%; opacity: .5; } .dot.pulse { width: 8px; opacity: 1; } }
/* History timeline: a rail joins the event icons; the open action shows on hover or focus. */
.act-history { display: flex; flex-direction: column; }
.act-day { position: sticky; top: 0; z-index: 2; margin: 0; padding: 10px 2px 6px; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); }
.act-timeline { position: relative; list-style: none; margin: 0 0 6px; padding: 0; }
.act-timeline:has(> .act-item + .act-item)::before { content: ""; position: absolute; left: 31px; top: 18px; bottom: 18px; width: 2px; border-radius: 2px; background: var(--line); }
.act-timeline .act-item { padding: 10px 16px; border-radius: 10px; }
.act-timeline .act-icon { box-shadow: 0 0 0 4px var(--bg); }
.act-timeline .act-item:hover .act-icon { box-shadow: 0 0 0 4px var(--surface2); }
.act-timeline .act-item { grid-template-columns: 32px minmax(0, 1fr) auto; }
.act-side { justify-self: end; }
/* The open action takes the place of the time on hover or keyboard focus, so rows keep their full width. */
@media (hover: hover) {
  .act-timeline .act-side, .act-timeline .act-go { grid-area: 1 / 3; justify-self: end; }
  .act-timeline .act-go { visibility: hidden; }
  .act-timeline .act-item:hover .act-go, .act-timeline .act-item:focus-within .act-go { visibility: visible; }
  .act-timeline .act-item:hover .act-side, .act-timeline .act-item:focus-within .act-side { visibility: hidden; }
}
.act-quiet { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line2); border-radius: 12px; }
.act-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 16px; text-align: center; }
.act-empty-ico { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface2); color: var(--muted); margin-bottom: 4px; }
.act-empty-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act-empty b { font-size: 15px; }
.act-empty .btn { margin-top: 6px; }
.chip.score-high { background: var(--amber-surface); color: var(--amber-text); }
.chip.score-mid { background: var(--indigo-soft); color: var(--indigo-text); }
@media (max-width: 640px) {
  .act-toolbar { gap: 10px; }
  .act-filters { flex-basis: 100%; }
  .act-search { flex: 1 1 auto; }
  .act-item { grid-template-columns: 32px minmax(0, 1fr); gap: 6px 12px; padding: 12px; }
  .act-title { white-space: normal; }
  .act-side { grid-column: 2; flex-wrap: wrap; gap: 8px; }
  .act-time { min-width: 0; text-align: left; }
  .act-item .btn { grid-column: 2; justify-self: start; }
  .act-engine { display: none; }
  .act-timeline:has(> .act-item + .act-item)::before { left: 27px; }
  .act-timeline .act-item { grid-template-columns: 32px minmax(0, 1fr); }
  .act-side { justify-self: start; }
  .act-timeline .act-side, .act-timeline .act-go { grid-area: auto; grid-column: 2; justify-self: start; }
  .act-timeline .act-go { display: none; } /* the whole row opens the result on a phone */
  .act-timeline .act-item:focus-within .act-go { display: inline-flex; }
  .act-timeline .act-item { padding: 10px 12px; }
}

/* ---------- helpers (used by markup that app.js renders) ---------- */
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; } .gap-18 { gap: 18px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.items-start { align-items: flex-start; } .items-center { align-items: center; } .self-start { align-self: flex-start; } .justify-end { justify-content: flex-end; }
.min-0 { min-width: 0; } .w-auto { width: auto; } .w-40 { width: 40%; } .w-60 { width: 60%; } .w-75 { width: 75%; }
.pad-y-14 { padding: 14px 0; } .no-border { border: none; } .pointer { cursor: pointer; } .text-right { text-align: right; }
.h-22 { font-size: 22px; } .h-32 { font-size: 32px; } .h-34 { font-size: 34px; } .h-36 { font-size: 36px; } .h-40 { font-size: 40px; } .fw-400 { font-weight: 400; }
.text-amber { color: var(--amber-text); } .text-indigo { color: var(--indigo-text); } .sb-dim { color: var(--sb-dim); } .inv-muted, .btn.ghost.inv-muted { color: var(--inv-muted); }
.sc-muted { color: var(--sc-muted); } .sc-dim { color: var(--sc-dim); } .sc-link { color: var(--sc-link); }
.card-amber { background: var(--amber-surface); border-color: var(--amber-line); }
.sq-indigo { background: var(--indigo); } .sq-track3 { background: var(--track3); } .sq-amber { background: var(--amber); }
.legend.legend-row { flex-direction: row; gap: 16px; }
.summary-link { cursor: pointer; color: var(--link); }
.scan-host { position: relative; overflow: hidden; }
.pillar-label { font-size: 14px; font-weight: 600; }
.pillar-basis { display: block; font-weight: 400; }
.gauge-side { flex: 1 1 360px; min-width: 0; }
.writing-note { gap: 8px; color: var(--amber-text); font-weight: 600; }
.library-card { padding: 8px 20px; }
.pre-plain { white-space: pre-wrap; font: inherit; margin: 0; }
.theme-preview { width: 100%; height: auto; border-radius: 10px; }
.theme-card { cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.theme-card[aria-pressed="true"] { border: 2px solid var(--indigo); }

/* ---------- illustration colours (SVG fill / stroke from theme tokens) ---------- */
.f-inv-bg { fill:var(--inv-bg); }
.f-inv-muted { fill:var(--inv-muted); }
.f-inv-text { fill:var(--inv-text); }
.f-inv-track { fill:var(--inv-track); }
.f-sc-accent { fill:var(--sc-accent); }
.f-sc-bg { fill:var(--sc-bg); }
.f-sc-card { fill:var(--sc-card); }
.f-sc-card2 { fill:var(--sc-card2); }
.f-sc-dim { fill:var(--sc-dim); }
.f-sc-dot { fill:var(--sc-dot); }
.f-sc-line { fill:var(--sc-line); }
.f-sc-link { fill:var(--sc-link); }
.f-sc-paper { fill:var(--sc-paper); }
.f-sc-paper2 { fill:var(--sc-paper2); }
.f-sc-soft { fill:var(--sc-soft); }
.f-sc-text { fill:var(--sc-text); }
.f-xF5B04C { fill:#F5B04C; }
.s-inv-track { stroke:var(--inv-track); }
.s-sc-accent { stroke:var(--sc-accent); }
.s-sc-faint { stroke:var(--sc-faint); }
.s-sc-line { stroke:var(--sc-line); }
.s-sc-line2 { stroke:var(--sc-line2); }
.s-sc-on-accent { stroke:var(--sc-on-accent); }
.s-sc-paper-line { stroke:var(--sc-paper-line); }
.s-sc-soft { stroke:var(--sc-soft); }
.s-sc-text { stroke:var(--sc-text); }
.s-xE5961F { stroke:#E5961F; }
.sc-sc-accent { stop-color:var(--sc-accent); }
.so-sc-glow { stop-opacity:var(--sc-glow); }
.f-sc-card { fill: var(--sc-card); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { position: sticky; z-index: 20; top: 0; height: auto; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-right: none; border-bottom: 1px solid var(--sb-line); }
  #tabs { flex-direction: row; flex-wrap: wrap; }
  #tabs button { width: auto; min-height: 40px; padding: 8px 10px; }
  #tabs button span:first-of-type { flex: none; }
  .dock { display: none; }
  .sidebar-foot { margin-left: auto; }
  .engine { display: none; }
  main { padding: 20px 16px 96px; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  .pillar { grid-template-columns: 1fr 64px; }
  .pillar > span:first-child { grid-column: 1 / -1; }
  .doc-preview { padding: 20px; }
  .about-link { display: none; }
  /* profile: the section rail becomes a horizontal, scrollable chip row */
  .pf-layout { grid-template-columns: 1fr; gap: 14px; }
  .pf-rail { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding: 6px 0; background: var(--bg); gap: 6px; scrollbar-width: none; }
  .pf-rail button { width: auto; flex-shrink: 0; min-height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; }
  .pf-rail .rl { overflow: visible; }
  .rail-sep { display: none; }
  .rail-head { display: none; }
  .pf-search { max-width: none; }
  .pf-section { padding: 14px 16px 6px; }
  .gap-list li { flex-direction: column; gap: 6px; }
}

/* ---------- settings: API key field (the rest of Settings is in settings.css) ---------- */
.key-field { display: flex; gap: 6px; align-items: center; }
.key-field input { flex: 1; min-width: 0; }
.key-field .btn { min-height: 44px; }
.key-field [aria-pressed="true"] { color: var(--indigo-text); }
.field-hint { margin-top: 6px; }
.banner > svg { width: 18px; height: 18px; margin-top: 1px; }
.banner-text { flex: 1; min-width: 0; }
.banner .btn { flex-shrink: 0; align-self: center; }
.grid > .theme-card { flex: 0 1 240px; padding: 14px; gap: 8px; }

/* sidebar engine pill */
button.engine { border: none; background: none; padding: 8px; border-radius: 10px; font: inherit; font-size: 12px; cursor: pointer; min-width: 0; text-align: left; }
button.engine:hover { background: var(--sb-card); color: var(--sb-text); }
.engine-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot.warn { background: var(--amber-strong); }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-grid > .theme-card { padding: 12px; gap: 6px; }
.theme-card[aria-checked="true"] { border: 2px solid var(--indigo); padding: 11px; }
.st-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.st-stats > div { padding: 12px 14px; border-radius: 12px; background: var(--surface2); }
.st-stats dt { font-size: 12px; color: var(--muted); }
.st-stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-path { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 14px 0; }
.st-path code { overflow-wrap: anywhere; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface2); }
#st-data-body .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#st-data-body > .small { margin-top: 12px; }
@media (max-width: 640px) {
  .theme-grid { grid-template-columns: minmax(0, 1fr); }
  .theme-grid .theme-preview { max-height: 72px; }
  .st-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- home dashboard ---------- */
h2.card-title { font: 600 16px/1.3 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
.home-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.next-card { justify-content: flex-start; }
.step-title { font-size: 18px; font-weight: 600; line-height: 1.3; }
.stat-big { font-size: 20px; font-weight: 600; line-height: 1.2; }
.ring-num { font: 400 27px "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; fill: var(--text); }
.mixbar { width: 100%; height: 8px; display: block; }
.legend.legend-wrap { flex-wrap: wrap; gap: 4px 16px; }
.legend-btn { border: none; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 6px; margin: 0 -6px; border-radius: 8px; }
.legend-btn:hover { background: var(--surface2); color: var(--text); }
.legend-btn b { color: var(--text); font-weight: 600; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stages li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 2px; border-radius: 12px; background: var(--surface2);
  font-size: 11px; color: var(--muted); text-align: center; }
.stages b { font: 400 24px/1.1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.stages li.on { background: var(--indigo-soft); color: var(--indigo-text); }
.stages li.on b { color: var(--text); }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--indigo); }
.todo-dot.warn { background: var(--amber-strong); }
.todo-dot.bad { background: var(--red-text); }
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 1180px) { .home-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-top .next-card { grid-column: 1 / -1; } }
@media (max-width: 860px) { .home-top { grid-template-columns: 1fr; } .home-top .next-card { grid-column: auto; } }

/* ---------- profile: evidence, history, editing ---------- */
mark { background: var(--amber-bg); color: var(--amber-text); border-radius: 3px; padding: 0 1px; }
.mini-head { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.fact-ev { display: flex; flex-direction: column; gap: 8px; }
.ev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev-list li { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ev-src { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-weight: 600; overflow-wrap: anywhere; }
.ev-open { font-size: 13px; font-weight: 400; }
.ev-quote { display: block; padding-left: 12px; border-left: 3px solid var(--indigo-line); color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.hist-list { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.hist-list li > span { display: block; overflow-wrap: anywhere; }
.fact-detail .banner { align-items: center; flex-wrap: wrap; }
.fact-detail .banner .banner-text { flex: 1 1 260px; }
.fact-actions { min-height: 36px; }
.pf-nomatch { padding-bottom: 10px; }
.fact-form label { margin-top: 0; }
.fact-form .grid2 { gap: 14px; }
.ff-details { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ff-details legend { padding: 0; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.ff-rows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ff-row { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) auto; gap: 8px; align-items: start; }
textarea.ff-v { min-height: 44px; field-sizing: content; resize: vertical; }
.ff-row .ff-rm { min-height: 44px; }
.gap-text { flex: 1; min-width: 0; }
.gap-list .gap-add { flex-shrink: 0; }
.gaps-note { margin: 0 20px 14px; }
@media (max-width: 860px) { .ff-row { grid-template-columns: minmax(0, 1fr) auto; } .ff-row .ff-k { grid-column: 1 / -1; } }

/* ---------- add information ---------- */
.ad-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ad-stat { text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 76px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.ad-stat:hover { border-color: var(--indigo-line); }
.ad-stat-l { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ad-stat b { font-size: 20px; font-weight: 600; }
.ad-stat .dot { background: var(--sc-faint); }
.ad-stat.live .dot { background: var(--indigo); animation: pulse 1.6s ease-in-out infinite; }
.ad-stat.ok .dot { background: #2FB383; }
.ad-stat.warn { border-color: var(--amber-strong); background: var(--amber-surface); }
.ad-stat.warn .dot { background: var(--amber-strong); }
.ad-stat.warn .ad-stat-l { color: var(--amber-text); font-weight: 600; }
.ad-stat.bad { border-color: var(--red-text); background: var(--red-bg); }
.ad-stat.bad .dot { background: var(--red-text); }
.ad-stat.bad .ad-stat-l { color: var(--red-text); font-weight: 600; }

.ad-composer { flex-direction: row; flex-wrap: wrap; gap: 28px; }
.ad-compose { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ad-compose .seg-ctl { background: var(--surface2); }
.ad-compose .seg-ctl button { min-height: 44px; padding: 0 18px; }
.ad-panel { display: flex; flex-direction: column; gap: 14px; }
.ad-panel label { margin-top: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 30px 20px; border: 2px dashed var(--indigo-line); border-radius: 18px; background: var(--surface2); }
.dropzone > svg { width: 40px; height: 40px; fill: none; stroke: var(--indigo); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ad-tips { flex: 1 1 260px; min-width: 0; align-self: flex-start; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 16px; background: var(--surface2); }
.ad-tips ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.ad-tips li { display: flex; gap: 10px; align-items: flex-start; }
.ad-tips li > span:last-child { display: flex; flex-direction: column; }
.tip-mark { width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--sc-faint); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ad-tips li.done .tip-mark { border-color: var(--green-text); background: var(--green-text); color: var(--surface); }
.tip-mark svg { width: 11px; height: 11px; }
#ad-rejected .banner ul { margin-top: 4px; }

.chip-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filters button { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line2); background: var(--surface); color: var(--chip-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip-filters button:hover { border-color: var(--indigo-line); }
.chip-filters button[aria-pressed="true"] { background: var(--indigo-soft); color: var(--indigo-text); border-color: var(--indigo-line); }
.ev-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; padding: 14px 0 6px; }
.ev-group.needs .mini-head { color: var(--red-text); }
.ev-group.reading .mini-head { color: var(--indigo-text); }
.ev-group.done .mini-head { color: var(--green-text); }
.ev-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.ev-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-main b { font-weight: 600; overflow-wrap: anywhere; }
.ev-line { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ev-line.bad { color: var(--red-text); }
.ev-line.warn { color: var(--amber-text); }
.ev-tech p { margin-top: 4px; overflow-wrap: anywhere; }
.ev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ev-bar { display: block; height: 6px; margin: 4px 0; border-radius: 3px; background: var(--track); overflow: hidden; }
.ev-bar > i { display: block; width: 40%; height: 100%; border-radius: 3px; background: var(--indigo); animation: scan 1.8s ease-in-out infinite; }

.rv-panel { padding: 0; gap: 0; border: 2px solid var(--amber-strong); }
.rv-head { display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 18px; }
.rv-summary { color: var(--chip-text); }
.wrap-any { overflow-wrap: anywhere; }
.btn.ghost.link { color: var(--link); padding: 0 8px; }
.rv-list { display: flex; flex-direction: column; padding: 0 22px; }
.rv-cat-head { padding: 14px 0 8px; border-top: 1px solid var(--line); }
.rv-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; }
.rv-row + .rv-row { border-top: 1px solid var(--line); }
.rv-row.conflict { margin: 0 -14px 8px; padding: 14px; border-radius: 14px; border: 1px dashed var(--amber-strong); background: var(--amber-surface); }
.rv-row.off .rv-title-l, .rv-row.off .rv-sum { color: var(--muted); }
.rv-on { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--indigo); flex-shrink: 0; }
.rv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rv-title-l { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.rv-sum { font-size: 14px; color: var(--chip-text); overflow-wrap: anywhere; }
.rv-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.rv-compare > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.rv-compare > .new { border-color: var(--amber-strong); }
.rv-compare > .new .small { color: var(--amber-text); }
.rv-edit { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }
.rv-edit label { margin-top: 0; }
.rv-edit .grid2 { gap: 12px; }
.btn.ghost.rv-edit-btn { color: var(--link); flex-shrink: 0; min-height: 44px; }
.rv-box { margin: 6px 22px 0; padding: 14px 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.rv-q { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; font-size: 14px; }
.rv-q > span { flex: 1 1 320px; min-width: 0; }
.rv-skipped { margin: 14px 22px 0; }
.rv-bar { position: sticky; bottom: 0; z-index: 2; margin-top: 18px; padding: 14px 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; background: var(--surface); }

/* ---------- opportunities workspace ---------- */
.op-compose-icon, .op-empty-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--indigo-soft); color: var(--indigo-text); }
.op-compose-icon svg, .op-empty-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.op-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.op-sort { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 13px; }
.op-sort select { width: auto; }
#op-filters button { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; }
#op-filters .seg-n { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
.op-empty { align-items: center; text-align: center; padding: 40px 24px; }
.op-empty > p { max-width: 480px; }
.op-empty h3 { font-size: 22px; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 400; }
.op-loading { flex-direction: row; align-items: center; color: var(--muted); }
.op-detail-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; align-self: flex-start; }
#tab-opps [id^="od-"] { scroll-margin-top: 24px; }
.op-next { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.op-next > div { flex: 1 1 300px; }
.op-next p { margin-top: 4px; }
.op-track-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.op-track-dirty { font-size: 12px; color: var(--amber-text); }
.op-track-form { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); padding-top: 18px; }
.op-track-form label { margin-top: 0; }
.op-track-form .grid2 { gap: 14px; }
.op-track-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.op-danger { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; }
.op-requirements { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.op-requirement { border-bottom: 1px solid var(--line); }
.op-requirement > summary { list-style: none; cursor: pointer; padding: 15px 0; display: flex; align-items: flex-start; gap: 12px; }
.op-requirement > summary::-webkit-details-marker { display: none; }
.op-requirement > summary::after { content: "+"; font-size: 20px; line-height: 1.2; color: var(--muted); margin-left: auto; }
.op-requirement[open] > summary::after { content: "−"; }
.op-req-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; font-size: 14px; overflow-wrap: anywhere; }
.op-req-copy .row { font-size: 11px; gap: 6px; color: var(--muted); }
.op-req-evidence { padding: 0 0 18px 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); max-width: 85ch; }
.op-req-evidence b { font-size: 12px; color: var(--text); }
.op-recommendation { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px; background: var(--surface2); }
.op-score-details { border-top: 1px solid var(--line); padding-top: 12px; }
.op-score-details summary { cursor: pointer; font-size: 13px; color: var(--indigo-text); }
.op-score-details p { font-size: 13px; color: var(--muted); margin-top: 10px; }
.op-doc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.op-doc-controls label { margin: 0; }
.op-doc-controls select { margin-top: 6px; }
#od-analysis h1 { overflow-wrap: anywhere; }
#od-analysis .banner span { min-width: 0; overflow-wrap: anywhere; }
.h-28 { font-size: 28px; }

/* list: focus strip, tools, rows */
#op-filters button.tone-warn .seg-n { background: var(--amber-surface); color: var(--amber-text); }
#op-filters button.tone-warn[aria-pressed="true"] .seg-n { background: var(--amber); color: #0B1026; }
  padding: 14px 18px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
/* Deadline passed: still listed, but quieter than the roles you can still apply to. */
.od-missed { flex-wrap: wrap; }
.od-missed .banner-text { flex: 1 1 260px; }
.od-missed .row { flex-shrink: 0; margin-left: auto; }
.op-row-noscore { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--red-bg); color: var(--red-text); }
.op-steps { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; text-align: left; max-width: 760px; counter-reset: step; }
.op-steps li { counter-increment: step; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); padding: 14px; border-radius: 12px; background: var(--surface2); }
.op-steps li::before { content: counter(step); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--indigo-line); color: var(--indigo-text); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.op-steps b { color: var(--text); font-weight: 600; }

/* new-opportunity dialog */
.op-dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 48px); }
.op-dialog[open] { display: flex; }
.op-dialog-form { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.op-dialog-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.op-dialog-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.op-dialog-titles h2 { font-size: 18px; }
.op-dialog-body { display: flex; flex-direction: column; gap: 16px; padding: 18px 22px; overflow: auto; min-height: 0; }
.op-dialog-body label { margin-top: 0; }
.op-dialog-body textarea { min-height: 220px; }
.op-dialog-body #op-prerequisites:empty { display: none; }
.op-hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.op-hint > span:last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.op-date { max-width: 240px; }
.op-dialog-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface2); }

/* detail: header + tabs */
.od-header { display: flex; align-items: center; gap: 16px; min-width: 0; }
.od-header-score { flex-shrink: 0; display: inline-flex; }
.od-header-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.od-header-action { flex-shrink: 0; align-self: flex-start; }
.od-header-copy h1 { font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.od-source { color: var(--link); text-decoration: none; margin-left: 4px; }
.od-source:hover { text-decoration: underline; }
.op-detail-nav button { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.op-detail-nav button:hover { color: var(--indigo-text); background: var(--indigo-soft); }
.op-detail-nav button[aria-selected="true"] { background: var(--indigo-soft); color: var(--indigo-text); font-weight: 600; }
.op-detail-nav button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.tab-n { white-space: nowrap; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--chip); color: var(--chip-text); font-weight: 600; }
.tab-n.warn { background: var(--amber-surface); color: var(--amber-text); }
.tab-n.indigo { background: var(--surface); color: var(--indigo-text); }
[role="tabpanel"][hidden] { display: none !important; }
.gauge-fill { stroke: var(--sc-accent); }
.tone-high .gauge-fill { stroke: #F5B04C; }
.tone-low .gauge-fill { stroke: var(--sc-faint); }
.op-danger.confirming { border: 1px solid color-mix(in srgb, var(--red-text) 35%, transparent); border-radius: 12px; padding: 14px 16px; background: color-mix(in srgb, var(--red-text) 7%, var(--surface)); }
.op-req-evidence .btn { margin-top: 6px; }
@media (max-width: 1100px) {
}
@media (max-width: 640px) {
  .op-steps { grid-template-columns: 1fr; }
  .od-header-copy h1 { font-size: 20px; }
  .od-header-score svg { width: 48px; height: 48px; }
  .op-dialog-head, .op-dialog-body, .op-dialog-foot { padding-inline: 16px; }
  .op-dialog-foot .row { width: 100%; }
  .op-dialog-foot .row .btn { flex: 1; }
  .od-header { flex-wrap: wrap; }
  .od-header-copy { flex-basis: calc(100% - 64px); }
  .od-header-action { margin-left: 64px; }
  .od-header-copy > .small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 860px) {
  .op-doc-controls { align-items: stretch; }
  .op-doc-controls > label { flex: 1 1 100%; }
  .op-detail-nav { align-self: stretch; }
}
@media (max-width: 480px) {
  .op-sort { width: 100%; justify-content: space-between; }
  .op-requirement > summary { flex-wrap: wrap; }
  .op-requirement > summary > .chip { order: 1; }
  .op-req-copy { flex-basis: calc(100% - 36px); }
  .op-doc-controls > .btn { width: 100%; }
}

/* Keep navigation compact so the workspace remains usable on a phone. */
@media (max-width: 860px) {
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; }
  .sidebar .brand { grid-column: 1; grid-row: 1; padding: 0 4px; }
  .sidebar .brand span { font-size: 23px; }
  .sidebar .brand svg { width: 28px; height: 28px; }
  .sidebar-foot { grid-column: 2; grid-row: 1; margin: 0; padding: 0; }
  #tabs { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  #tabs button { flex-shrink: 0; font-size: 13px; min-height: 44px; }
  #tabs .ico { width: 18px; height: 18px; }
  #tab-opps [id^="od-"] { scroll-margin-top: 128px; }
  #tab-opps .gauge-wrap { padding: 20px; gap: 20px; }
  #tab-opps .gauge-wrap svg.gauge { flex-basis: 220px; margin: 0 auto; }
  #tab-opps .gauge-side h1 { font-size: 28px; }
  .op-requirement > summary { min-height: 44px; }
}

/* ---------- fixed application frame and independently scrolling workspaces ---------- */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.layout { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar { position: relative; height: 100%; min-height: 0; overscroll-behavior: contain; }
.sidebar > .brand, .sidebar > #tabs, .sidebar > .about-link, .sidebar-foot { flex-shrink: 0; }
.dock { min-height: 76px; overflow: auto; overscroll-behavior: contain; }
main { display: flex; min-height: 0; overflow: hidden; padding: 24px clamp(16px, 3vw, 44px); }
.tab { width: 100%; height: 100%; min-height: 0; overflow: hidden; gap: 18px; }
.tab > * { flex-shrink: 0; }
.scroll-region { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding: 12px; scrollbar-gutter: stable; overflow-anchor: none; }
.scroll-region:focus-visible { outline: 2px solid var(--indigo); outline-offset: -2px; border-radius: 8px; }
.screen-body { flex: 1; display: flex; flex-direction: column; gap: 24px; min-height: 0; padding: 3px 6px 20px 3px; }
.screen-body > * { flex-shrink: 0; }
.tab > .head { padding: 2px; }
#upload-engine:empty, #pf-gaps-out:empty { display: none; }

/* Profile controls and section navigation stay in place while the facts move. */
.pf-layout { flex: 1; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); gap: 20px; }
.pf-rail { position: static; max-height: none; }
.pf-rail > * { flex-shrink: 0; }
.pf-content { display: flex; flex-direction: column; gap: 16px; padding: 3px 6px 16px 3px; }
.pf-content > * { flex-shrink: 0; }
.pf-pane { flex-shrink: 0; }

/* The upload form, fact review and evidence list each have a scroll owner. */
.ad-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 14px 20px; }
.ad-inputs { grid-column: 1; grid-row: 1 / -1; padding: 3px 6px 16px 3px; }
.ad-inputs .ad-composer { flex-direction: column; padding: 18px; gap: 20px; }
.ad-inputs .ad-compose, .ad-inputs .ad-tips { flex: none; width: 100%; }
.ad-inputs .dropzone { padding: 24px 14px; }
.ad-view-switch { grid-column: 2; grid-row: 1; justify-self: start; }
.ad-view-switch button { min-height: 40px; }
.ad-source-toggle { display: none !important; }
.ad-records { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ad-library { flex: 1; min-height: 0; }
.ad-library > .row { flex-shrink: 0; }
#library { flex: 1; min-height: 0; }
#library > * { flex-shrink: 0; }
.ad-records > #pending-area { display: none; }
.ad-workspace[data-view="review"] #pending-area { display: flex; flex: 1; min-height: 0; }
.ad-workspace[data-view="review"] .ad-library { display: none; }
#pending-area > .banner { align-self: flex-start; }
/* Review facts: count on the tab, and an empty state when nothing is waiting */
.seg-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--amber-strong); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#pending-area > .rv-empty { align-self: flex-start; width: 100%; max-width: 520px; align-items: flex-start; gap: 8px; }
.rv-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo-text); }
.rv-empty-icon svg { width: 18px; height: 18px; }
.rv-empty .btn { margin-top: 6px; }
#pending-area .rv-panel { flex: 1; min-width: 0; min-height: 0; max-height: 100%; overflow: hidden; }
.rv-scroll { flex: 1; }
.rv-scroll > * { flex-shrink: 0; }
.rv-bar { position: static; flex-shrink: 0; margin-top: 0; }

/* Search, filters and list headings stay available above the saved results. */
.op-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.op-collection { min-width: 0; min-height: 0; gap: 12px; }
.op-collection > :not(#opp-list) { flex-shrink: 0; }
#opp-list { flex: 1; min-height: 0; padding: 3px 6px 16px 3px; }
.op-collection .op-tools { align-items: center; }
.op-collection .pf-search { flex-basis: 220px; }
.od-content { padding-top: 4px; }
#tab-opps [id^="od-"] { scroll-margin-top: 12px; }
#od-preview .doc-preview { max-height: 60vh; max-height: 60dvh; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#od-jobtext { max-height: 320px; overflow: auto; overscroll-behavior: contain; }

/* Background refreshes replace rows without moving either activity pane. */
textarea { max-height: max(140px, 40dvh); }

@media (max-width: 1100px) and (min-width: 861px) {
  .sidebar { width: 224px; }
  .ad-workspace { grid-template-columns: minmax(240px, .9fr) minmax(0, 1.25fr); gap: 14px; }
  .pf-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 860px) {
  .sidebar { position: relative; flex: none; height: auto; overflow: hidden; }
  main { flex: 1; padding: 16px 12px; }
  .tab { gap: 12px; }
  .screen-body { gap: 18px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .pf-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .pf-rail { overflow-y: hidden; scrollbar-gutter: auto; }
  .pf-toolbar { gap: 8px; }
  .pf-toolbar .pf-search { flex-basis: 100%; }
  .pf-toolbar .seg-ctl { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .pf-toolbar .seg-ctl button { flex-shrink: 0; }
  .ad-status { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ad-stat { min-height: 70px; padding: 10px 8px; }
  .ad-stat-l { font-size: 11px; gap: 4px; line-height: 1.25; }
  .ad-stat b { font-size: 16px; margin-top: auto; }
  .ad-stat-l .dot { display: none; }
  .ad-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .ad-view-switch { grid-column: 1; width: 100%; justify-self: stretch; }
  .ad-view-switch button { flex: 1; padding: 0 8px; font-size: 12px; }
  .ad-source-toggle { display: inline-flex !important; }
  .ad-inputs, .ad-records { grid-column: 1; grid-row: 2; }
  .ad-workspace[data-view="source"] .ad-records { display: none; }
  .ad-workspace:not([data-view="source"]) .ad-inputs { display: none; }
  .op-collection .op-tools { flex-wrap: nowrap; gap: 8px; }
  .op-collection .op-sort { width: auto; gap: 4px; }
  .op-collection .op-sort > span { display: none; }
  .op-collection .op-sort select { max-width: 140px; font-size: 13px; }
  .op-collection .pf-search { flex-basis: auto; min-width: 0; }
  .op-collection .pf-search input { font-size: 13px; }
  #op-filters { flex-wrap: nowrap; overflow-x: auto; }
  #op-filters button { flex-shrink: 0; }
  .op-detail-nav { flex-wrap: nowrap; overflow-x: auto; }
  #tab-opps [id^="od-"] { scroll-margin-top: 12px; }
}
@media (max-height: 700px) {
  main { padding-top: 12px; padding-bottom: 12px; }
  .tab { gap: 12px; }
  .tab > .head h1 { font-size: 30px; }
  .tab > .head .eyebrow { display: none; }
}
/* At large text zoom or with a short viewport, keep every control reachable inside the workspace. */
@media (max-height: 500px) {
  .tab { overflow: auto; overscroll-behavior: contain; }
  .tab > .screen-body, .tab > .pf-layout, .tab > .ad-workspace, .tab > .op-workspace { flex: 1 0 260px; }
}
.st-sections > .card:focus:not(:focus-visible) { outline: none; }

/* home: up next */
/* A checklist: every waiting action is a row of the same shape, the first one highlighted.
   The list has a fixed maximum height (about 3 rows) and scrolls inside the card, so the card never grows. */
.next-card { gap: 10px; border: 1px solid var(--indigo-line); background: var(--surface); }
.next-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.next-count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.next-list { list-style: none; margin: 0 -8px; padding: 0 4px 0 0; display: flex; flex-direction: column; max-height: 216px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.next-list:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 8px; }
.next-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 8px 10px 11px; min-height: 60px; flex-shrink: 0;
  border-left: 3px solid transparent; border-radius: 8px; }
.next-item + .next-item { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.next-item.is-first { border-left-color: var(--indigo); background: color-mix(in srgb, var(--indigo-soft) 60%, var(--surface)); }
.next-item.is-first + .next-item { border-top-color: transparent; }
.next-item .todo-dot { align-self: start; margin-top: 5px; }
.next-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-item-title { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text); }
.next-item.is-first .next-item-title { font-size: 15px; }
.next-item-sub { font-size: 12px; line-height: 1.4; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-item-act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 480px) {
  .next-item { grid-template-columns: auto minmax(0, 1fr); }
  .next-item-act { grid-column: 2; justify-content: flex-start; }
}
.link-btn { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 13px; font-weight: 600; color: var(--link); cursor: pointer; white-space: nowrap; border-radius: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--indigo); }

/* home: your story */
.story { gap: 16px; }
.story-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.story-head h2 { font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.story-legend { font-size: 12px; }
.story-key { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.story-chart { display: flex; flex-direction: column; }
.story-row { display: grid; grid-template-columns: minmax(180px, 300px) minmax(0, 1fr); align-items: center; gap: 20px; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: var(--text); text-align: left; }
button.story-row { cursor: pointer; border-radius: 10px; }
button.story-row:hover { background: var(--surface2); }
button.story-row:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.story-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 7px 8px; }
.story-label b { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.story-label span { font-size: 12px; color: var(--muted); }
.story-track { position: relative; align-self: stretch; min-height: 44px; }
.story-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); pointer-events: none; }
.story-bar, .story-mark { z-index: 1; }
.story-bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 8px; min-width: 10px; }
.story-bar.edu { background: var(--track3); }
.story-bar.work { background: var(--indigo); }
.story-bar.ongoing { border-top-right-radius: 2px; border-bottom-right-radius: 2px; background-image: linear-gradient(90deg, transparent 85%, color-mix(in srgb, var(--surface) 45%, transparent)); }
.story-now { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--amber-strong); pointer-events: none; }
.story-now span { display: none; position: absolute; top: -2px; right: 6px; font-size: 11px; font-weight: 600; color: var(--amber-text); white-space: nowrap; }
.story-row:first-child .story-now span { display: block; }
.story-marks { border-top: 1px dashed var(--line2); margin-top: 4px; padding-top: 4px; }
.story-marks .story-track { min-height: 56px; }
.story-mark { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; transform: translateY(calc(var(--lift, 0) * -15px + 8px)); border-radius: 50%; border: 2px solid var(--surface); padding: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--line2); }
.story-mark:hover, .story-mark:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; z-index: 1; }
.story-mark.pub, .story-key.pub { background: #7A5AF8; }
.story-mark.talk, .story-key.talk { background: #2E9E8F; }
.story-mark.award, .story-key.award { background: var(--amber-strong); }
.story-axis .story-track { min-height: 22px; background: none; }
.story-axis .story-track > span { position: absolute; top: 2px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.story-axis .story-track > span:first-child { transform: none; }
.story-axis .story-track > span:last-child { transform: translateX(-100%); }
@media (max-width: 860px) {
  .story-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .story-label { padding-bottom: 0; }
  .story-track { min-height: 30px; margin: 0 8px; }
  .story-axis .story-label { display: none; }
  .story-head h2 { font-size: 18px; }
}
.story:not(.show-all) .story-extra { display: none; }
.story-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.story-foot .link-btn + span { margin-left: auto; }

/* Shown while the eAgent server can't be reached (its Terminal window was closed). */
.offline-banner { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 90; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--red-bg); color: var(--red-text); border: 1px solid color-mix(in srgb, var(--red-text) 35%, transparent); box-shadow: 0 6px 24px rgba(0, 0, 0, .12); font-size: 14px; }
.offline-banner[hidden] { display: none; }
.restart-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 85; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--amber-surface); color: var(--amber-text); border: 1px solid var(--amber-line); box-shadow: 0 6px 24px rgba(0, 0, 0, .12); font-size: 14px; }
.restart-banner[hidden] { display: none; }
