/* Subrosa — one stylesheet. Tokens first, then base, layout (the IDE shell), components.
   Fonts are vendored (OFL, static/fonts); nothing is loaded from outside this origin (P4). */

/* ------------------------------------------------------------------ fonts */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/inter-latin-400-normal.da03732a27e1.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/inter-latin-500-normal.51205681a1ba.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/inter-latin-600-normal.2ede57db1a3a.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/source-serif-4-latin-400-normal.95bbd98f2b3c.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/source-serif-4-latin-400-italic.fa10869cc45e.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/source-serif-4-latin-600-normal.beb0c8d8bee8.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.caf0dfde4e44.woff2") format("woff2"); }

/* ----------------------------------------------------------------- tokens */
:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #efede7; --raised: #ffffff;
  --fg: #1d1c19; --muted: #6d6961; --faint: #9a968d; --line: #e3e0d8; --line-strong: #d3cfc5;
  --accent: #3550c8; --accent-fg: #ffffff; --accent-soft: rgba(53, 80, 200, .09);
  --ok: #2b8a3e; --warn: #b8690a; --danger: #c0392b;
  --hl-yellow: rgba(255, 205, 64, .42); --hl-note: rgba(53, 80, 200, .16);
  --shadow: 0 1px 2px rgba(20, 18, 12, .05), 0 2px 8px rgba(20, 18, 12, .05);
  --radius: 8px; --radius-sm: 6px;
  --topbar-h: 48px; --explorer-w: 256px; --chat-w: 372px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312; --surface: #1a1a18; --surface-2: #171715; --raised: #20201e;
    --fg: #ebe9e3; --muted: #a39f96; --faint: #75716a; --line: #2a2926; --line-strong: #37352f;
    --accent: #8ea2ff; --accent-fg: #11131c; --accent-soft: rgba(142, 162, 255, .13);
    --ok: #5fc27a; --warn: #e3a342; --danger: #f07167;
    --hl-yellow: rgba(255, 205, 64, .26); --hl-note: rgba(142, 162, 255, .22);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --surface: #1a1a18; --surface-2: #171715; --raised: #20201e;
  --fg: #ebe9e3; --muted: #a39f96; --faint: #75716a; --line: #2a2926; --line-strong: #37352f;
  --accent: #8ea2ff; --accent-fg: #11131c; --accent-soft: rgba(142, 162, 255, .13);
  --ok: #5fc27a; --warn: #e3a342; --danger: #f07167;
  --hl-yellow: rgba(255, 205, 64, .26); --hl-note: rgba(142, 162, 255, .22);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ------------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.6rem; margin: .2rem 0 .5rem; } h2 { font-size: 1.12rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; font-size: .75em; color: var(--muted); background: var(--surface); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .faint { color: var(--faint); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* buttons and inputs */
button, a.button { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-fg); font: 500 .9rem/1.2 var(--sans);
  cursor: pointer; text-decoration: none; transition: filter .12s, background .12s; }
button:hover, a.button:hover { filter: brightness(1.06); }
button.secondary, a.button.secondary { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
button.secondary:hover, a.button.secondary:hover { background: var(--surface-2); filter: none; }
button.small { padding: .28rem .6rem; font-size: .8rem; }
button.danger { color: var(--danger); }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.iconbtn { background: none; border: 1px solid transparent; color: var(--muted); padding: .3rem; border-radius: var(--radius-sm); line-height: 0; }
.iconbtn:hover { background: var(--surface-2); color: var(--fg); filter: none; }
.iconbtn svg { width: 18px; height: 18px; }
input[type=text], input[type=search], input[type=email], input[type=password], input:not([type]), select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: .5rem .65rem; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
form.inline { display: inline-flex; gap: .5rem; align-items: center; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0 1rem; }

/* ----------------------------------------------------------------- topbar */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 .9rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
.brand .logo { width: 22px; height: 22px; }
.brand .org { color: var(--muted); font-weight: 500; }
.topbar nav { display: flex; gap: .9rem; align-items: center; font-size: .9rem; }
.topbar nav a { color: var(--muted); text-decoration: none; } .topbar nav a:hover { color: var(--fg); }
.topsearch { flex: 1; max-width: 34rem; margin: 0 auto; position: relative; }
.topsearch input { width: 100%; padding: .38rem .7rem .38rem 2rem; background: var(--surface-2); border-color: transparent; }
.topsearch input:focus { background: var(--surface); }
.topsearch svg { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.topsearch kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }

/* node indicator (F6) */
.node { display: flex; align-items: center; gap: .5rem; font-size: .85rem; padding: .2rem .35rem .2rem .6rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.node .label { font-weight: 500; }
.node .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.node .dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.node .dot.starting { background: var(--warn); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.node .countdown.soon { color: var(--danger); font-weight: 600; }
.node form { margin: 0; }

/* ------------------------------------------------------ non-IDE pages */
.content { max-width: 62rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.footer { max-width: 62rem; margin: 2rem auto 1rem; padding: .75rem 1.25rem; border-top: 1px solid var(--line);
  display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .85rem; }
.auth-card { max-width: 25rem; margin: 4rem auto; padding: 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.auth-card form div { margin-bottom: .8rem; }
.auth-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] { width: 100%; }
/* TOTP QR code is an SVG with a transparent background; keep it scannable in dark mode. */
.auth-card img { display: block; width: 12rem; height: 12rem; padding: .6rem; margin: .75rem 0; background: #fff; border-radius: .35rem; }

/* ------------------------------------------------------------ IDE shell */
body.ide-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.ide { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--explorer-w) minmax(0, 1fr) var(--chat-w); }
.ide.no-explorer { grid-template-columns: 0 minmax(0, 1fr) var(--chat-w); }
.ide.no-chat { grid-template-columns: var(--explorer-w) minmax(0, 1fr) 0; }
.ide.no-explorer.no-chat { grid-template-columns: 0 minmax(0, 1fr) 0; }
.ide.no-explorer .explorer, .ide.no-chat .chatpane { visibility: hidden; }
.pane { min-height: 0; overflow: auto; }
.center { background: var(--bg); }
.page { max-width: 76rem; margin: 0 auto; padding: 1.5rem 2rem 4rem; }
@media (max-width: 1100px) { .ide { grid-template-columns: 0 minmax(0, 1fr) 0; } .explorer, .chatpane { visibility: hidden; } }

/* explorer */
.explorer { background: var(--surface-2); border-right: 1px solid var(--line); font-size: .88rem; display: flex; flex-direction: column; }
.explorer .ex-actions { display: flex; gap: .4rem; padding: .75rem .75rem .5rem; }
.explorer .ex-actions a { flex: 1; justify-content: center; }
.explorer .ex-filter { margin: 0 .75rem .5rem; } .explorer .ex-filter input { width: 100%; padding: .32rem .55rem; font-size: .85rem; }
.explorer details { margin: 0; }
.explorer summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; padding: .3rem .75rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); user-select: none; }
.explorer summary::-webkit-details-marker { display: none; }
.explorer summary::before { content: ""; flex: none; width: 5px; height: 5px; margin: 0 .2rem 0 .05rem; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .12s; }
.explorer details[open] > summary::before { transform: rotate(45deg); }
.explorer summary .count { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; }
.explorer ul { list-style: none; margin: 0 0 .5rem; padding: 0; }
.explorer li a, .explorer .folder > summary.folder-name { display: flex; align-items: center; gap: .45rem; padding: .22rem .75rem .22rem calc(.75rem + var(--depth, 0) * .9rem);
  color: var(--fg); text-decoration: none; border-radius: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explorer .folder > summary.folder-name { text-transform: none; letter-spacing: 0; font-size: .88rem; font-weight: 500; color: var(--fg); }
.explorer li a:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.explorer li a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.explorer li a .ico { flex: none; width: 15px; height: 15px; color: var(--faint); }
.explorer li a.active .ico { color: var(--accent); }
.explorer li a .t { overflow: hidden; text-overflow: ellipsis; }
.explorer li a .by { margin-left: auto; font-size: .7rem; color: var(--faint); }
.explorer .more { display: block; padding: .15rem .75rem .5rem; font-size: .8rem; }
.explorer .ex-foot { margin-top: auto; padding: .6rem .75rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; }
.explorer .ex-foot a { color: var(--muted); text-decoration: none; } .explorer .ex-foot a:hover { color: var(--fg); }

/* chat pane */
.chatpane { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.chat-head .title { font-weight: 600; } .chat-head .model { color: var(--faint); font-size: .75rem; font-family: var(--mono); }
.chat-head .grow { flex: 1; }
.chat-body { flex: 1; overflow: auto; padding: .9rem; display: flex; flex-direction: column; gap: .8rem; }
.bubble { max-width: 100%; font-size: .9rem; line-height: 1.55; }
.bubble .who { font-size: .72rem; font-weight: 600; color: var(--faint); margin-bottom: .2rem; letter-spacing: .02em; }
.bubble.user { align-self: flex-end; max-width: 88%; }
.bubble.user .text { background: var(--accent-soft); border-radius: 12px 12px 3px 12px; padding: .5rem .75rem; }
.bubble.agent .text { padding: 0 .1rem; }
.bubble .text > :first-child { margin-top: 0; } .bubble .text > :last-child { margin-bottom: 0; }
.bubble table { font-size: .82rem; }
.chat-empty { margin: auto 0; text-align: center; color: var(--muted); padding: 1rem; }
.chat-empty .suggest { display: flex; flex-direction: column; gap: .4rem; margin-top: .9rem; }
.chat-empty .suggest button { justify-content: flex-start; text-align: left; font-weight: 400; }
.thinking { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.thinking::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.chat-compose { border-top: 1px solid var(--line); padding: .7rem .8rem .8rem; }
.chat-compose textarea { width: 100%; resize: none; min-height: 4.2rem; max-height: 14rem; font-size: .9rem; }
.chat-compose .row { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-compose .row .grow { flex: 1; }

/* ----------------------------------------------------------- documents */
.doc-head { margin-bottom: 1rem; }
.doc-head .kicker { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.doc-head h1 { font-size: 1.75rem; margin: .25rem 0 .35rem; }
.meta { font-size: .84rem; color: var(--muted); }
.document { font-family: var(--serif); font-size: 1.06rem; line-height: 1.68; color: var(--fg); }
.document h2 { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 2rem 0 .7rem; }
.document p { margin: 0 0 .95rem; }
.document p[data-block], .document .description p { white-space: pre-line; }
.claims { padding-left: 1.6rem; } .claims li { margin-bottom: .8rem; padding-left: .2rem; }
.claims li::marker { font-family: var(--sans); font-size: .85rem; color: var(--faint); font-weight: 600; }
.claims li.independent::marker { color: var(--accent); }
.note-body { line-height: 1.65; }
.document .note-body { font-size: inherit; }
.note-body pre { overflow-x: auto; padding: .8rem; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .82rem; }
.note-body table { border-collapse: collapse; font-family: var(--sans); font-size: .88rem; } .note-body th, .note-body td { border: 1px solid var(--line); padding: .35rem .55rem; }
.note-body blockquote { margin: .5rem 0; padding: .1rem 1rem; border-left: 3px solid var(--line-strong); color: var(--muted); }
.note-body a[href*="#ann-"], .note-body a[href*="/assets/"], .note-body a[href*="/chat/"] { font-family: var(--mono); font-size: .82em; padding: 0 .25rem; border-radius: 4px; background: var(--accent-soft); text-decoration: none; }

/* reading surface with a margin (F12) */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 2rem; align-items: start; }
@media (max-width: 1350px) { .reader { grid-template-columns: minmax(0, 1fr) 16rem; gap: 1.25rem; } }
.margin { position: sticky; top: 0; max-height: calc(100vh - var(--topbar-h) - 1.5rem); overflow-y: auto; font-size: .86rem; padding: .25rem .1rem 1rem; }
.margin-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem; }
.margin-head strong { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.margin .composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem; box-shadow: var(--shadow); }
.margin .composer textarea { width: 100%; margin: .3rem 0 .45rem; font-size: .86rem; border-color: var(--line); min-height: 3.6rem; resize: vertical; }
.margin .composer .quote-preview { margin: 0 0 .2rem; display: flex; align-items: baseline; gap: .35rem; }
.margin .composer .quote-preview .quote-text { flex: 1; }
/* The ✕ that drops the quote: without it a selection could only be replaced, never removed. */
.margin .composer .quote-clear { flex: none; padding: 0 .3rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: none; color: var(--muted); font-size: .75rem; line-height: 1.4; cursor: pointer; }
.margin .composer .quote-clear:hover { color: var(--text); border-color: var(--line-strong); }
.margin .cards { list-style: none; padding: 0; margin: .8rem 0 0; }
.margin #margin-waiting { margin: .8rem 0 0; font-size: .8rem; color: var(--accent); }
.margin .ann { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm); padding: .5rem .65rem; margin-bottom: .55rem; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.margin .ann:hover { box-shadow: var(--shadow); }
.margin .ann.flash { outline: 2px solid var(--accent); outline-offset: 1px; }
.margin .ann .quote { margin: .3rem 0; padding-left: .55rem; border-left: 2px solid var(--line-strong); color: var(--muted); font-family: var(--serif); font-size: .9rem; }
.margin .ann .badge { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.margin .ann .note-body { font-size: .85rem; } .margin .ann .note-body p { margin: .15rem 0; display: inline; }
.margin .ann .actions { margin-top: .3rem; color: var(--faint); }
.margin .ann.status-open .status { color: var(--accent); font-weight: 500; }
.margin .ann.status-awaiting_user .status { color: var(--warn); font-weight: 500; }
.margin .ann.orphaned { opacity: .75; border-style: dashed; }
.margin .ann.by-agent { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.kind-highlight { border-left-color: #e3b21b !important; }
.kind-note { border-left-color: var(--accent) !important; }
.kind-comment { border-left-color: var(--line-strong) !important; }
mark.hl { background: var(--hl-yellow); color: inherit; border-radius: 2px; cursor: pointer; padding: .05em 0; }
mark.hl.kind-note { background: var(--hl-note); }
mark.hl.active { outline: 2px solid var(--accent); }
mark.hl.by-agent { outline: 1px dashed var(--faint); }
.ref { font-family: var(--mono); font-size: .75em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; background: var(--surface); }

/* note editor */
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: stretch; }
@media (max-width: 1250px) { .editor { grid-template-columns: 1fr; } }
.editor-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.editor-head input[name=title] { flex: 1; font: 600 1.35rem/1.3 var(--sans); padding: .35rem .5rem; border-color: transparent; background: transparent; }
.editor-head input[name=title]:focus { border-color: var(--line-strong); background: var(--surface); }
.editor-head input[name=folder] { width: 14rem; font-size: .85rem; }
.editor textarea { width: 100%; min-height: 62vh; font: .9rem/1.6 var(--mono); padding: 1rem; background: var(--surface); resize: vertical; }
.editor .preview { min-height: 62vh; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--serif); font-size: 1.02rem; overflow: auto; }
.editor-foot { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }

/* generic components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; }
.card.pending { border-color: var(--accent); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .9rem; }
.stat { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; } .stat-label { color: var(--muted); font-size: .8rem; }
.messages { list-style: none; padding: 0; } .messages li { padding: .55rem .8rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: .5rem; }
.helptext, .errorlist { font-size: .85rem; color: var(--muted); } .errorlist { color: var(--danger); }
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .25rem; } .searchbar input[type=search] { flex: 1 1 22rem; }
.results { padding-left: 0; list-style: none; } .results li { margin: 0 0 1.1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.results .title { font-weight: 600; text-decoration: none; font-size: 1rem; }
.snippet { margin-top: .3rem; font-family: var(--serif); font-size: .98rem; }
.tag { display: inline-block; margin-left: .35rem; padding: 0 .45rem; border: 1px solid var(--line); border-radius: 999px; font-size: .72rem; color: var(--muted); background: var(--surface); }
mark { background: var(--hl-yellow); color: inherit; padding: 0 .1em; border-radius: 2px; }
.stages { display: flex; gap: 1rem; list-style: none; padding: 0; margin: .5rem 0; font-size: .88rem; color: var(--muted); }
.stages li::before { content: "○ "; } .stages li.done::before { content: "● "; color: var(--accent); }
.stages li.current { color: var(--fg); font-weight: 600; } .stages li.current::before { content: "◐ "; color: var(--accent); }
table.list { width: 100%; border-collapse: collapse; } table.list th, table.list td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
table.list th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; }
.noteform textarea, .noteform input[type=text] { width: 100%; }
.noteform textarea { font-family: var(--mono); font-size: .9rem; }
.entries { list-style: none; padding: 0; } .entry { border-left: 3px solid var(--line-strong); padding: .3rem 0 .3rem .95rem; margin: 0 0 1.1rem; }
.entry-agent { border-left-color: var(--accent); } .entry-operator { border-left-color: var(--ok); }
.rating button { padding: .1rem .5rem; } .rating button.on { border-color: var(--accent); }
.quote { border-left: 3px solid var(--accent); margin: .5rem 0; padding: .25rem .9rem; color: var(--muted); }
.shots { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; } .shots img { max-width: 14rem; max-height: 9rem; border: 1px solid var(--line); border-radius: .35rem; }
pre.small { font-size: .78rem; max-height: 14rem; overflow: auto; }

/* model options chart (transparency page) */
.model-chart svg.chart { width: 100%; height: auto; max-width: 50rem; display: block; margin: 1rem 0; }
.chart text { fill: currentColor; font: 12px var(--sans); }
.chart .tick { fill: var(--muted); font-size: 11px; } .chart .axis { fill: var(--muted); font-size: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .label { font-weight: 600; font-size: 12.5px; } .chart .sub { fill: var(--muted); font-size: 11px; }
.chart .range { stroke-width: 3; stroke-linecap: round; }
.chart .inside .range { stroke: var(--ok); } .chart .inside .dot, .chart .inside-dot { fill: var(--ok); stroke: var(--bg); stroke-width: 2; }
.chart .outside .range { stroke: var(--faint); stroke-dasharray: 2 4; } .chart .outside .dot, .chart .outside-dot { fill: var(--bg); stroke: var(--muted); stroke-width: 2; }
.chart .ours .range { stroke: var(--accent); } .chart .ours .dot { fill: var(--accent); } .chart .ours .label { fill: var(--accent); }
.chart .frontier { fill: none; stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .6; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); } ul.plain li:last-child { border-bottom: 0; }

/* search view */
.searchpanel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; box-shadow: var(--shadow); margin-bottom: .6rem; }
.searchrow { display: flex; gap: .5rem; } .searchrow input { flex: 1; font-size: 1rem; padding: .6rem .8rem; }
.scopes { display: flex; gap: .35rem; margin: .65rem 0 .2rem; }
.scope { padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; cursor: pointer; color: var(--muted); }
.scope input { display: none; } .scope.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 500; }
.filters summary { cursor: pointer; font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.filterrow { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.filterrow label { display: inline-flex; align-items: center; gap: .4rem; } .filterrow input, .filterrow select { font-size: .85rem; padding: .3rem .5rem; }
.explorer .ex-search a { font-weight: 500; }
a.button.small { padding: .32rem .6rem; font-size: .82rem; white-space: nowrap; }

/* notifications (L25) */
.bell { position: relative; } .bell > summary { list-style: none; cursor: pointer; position: relative; display: inline-flex; }
.bell > summary::-webkit-details-marker { display: none; }
.bell .count { position: absolute; top: -3px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font: 600 10px/16px var(--sans); text-align: center; }
.bell .count.zero { display: none; }
.bell .menu { position: absolute; right: 0; top: calc(100% + 8px); width: 26rem; max-height: 70vh; overflow: auto; z-index: 40;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.menu-head, .menu-foot { display: flex; justify-content: space-between; align-items: center; padding: .6rem .85rem; font-size: .85rem; }
.menu-head { border-bottom: 1px solid var(--line); } .menu-foot { border-top: 1px solid var(--line); }
ul.inbox { list-style: none; margin: 0; padding: 0; }
.inbox-item { padding: .65rem .85rem; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.inbox-item.unread { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.inbox-item .snippet { font-size: .86rem; max-height: 6.5em; overflow: hidden; margin: .2rem 0 .35rem; }
.inbox-item .snippet p { margin: .1rem 0; }
.inbox-empty { padding: .9rem; }
.page-inbox .inbox-item { background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm); margin-bottom: .6rem; }
.page-inbox .inbox-item .snippet { max-height: none; font-size: .92rem; }
.whoami { font-size: .82rem; color: var(--muted); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: .3rem; }
.unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: .3rem; vertical-align: middle; }
.bubble.unread .text { box-shadow: inset 3px 0 0 var(--accent); padding-left: .6rem; }
.bubble .readbar { margin-top: .25rem; font-size: .75rem; }
.readmark { color: var(--faint); }
.margin .ann .unread-note { color: var(--accent); font-weight: 500; }

/* feature requests (§17) */
.progress { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.progress-new { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.progress-clarifying { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.progress-planned { color: var(--fg); }
.progress-in_progress { color: #fff; background: var(--accent); border-color: transparent; }
.progress-done { color: #fff; background: var(--ok); border-color: transparent; }
.progress-declined { text-decoration: line-through; }
ul.requests { list-style: none; padding: 0; } .request { margin: 0 0 .6rem; padding: .75rem 1rem; }
.rq-head { display: flex; align-items: center; gap: .6rem; } .rq-head .title { font-weight: 600; text-decoration: none; font-size: 1rem; }
.request-new input[type=text] { width: 100%; font-weight: 500; } .request-new textarea { width: 100%; margin: .5rem 0; }
.request-new .row, .progress-form .row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.progress-form .row input[type=text] { flex: 1; min-width: 12rem; }

/* claim elements (D30) */
.claims details.elements { margin: .35rem 0 .2rem; font-family: var(--sans); font-size: .85rem; }
.claims details.elements > summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.claims .preamble { margin: .4rem 0 .2rem; color: var(--muted); }
.claims .element-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line-strong); }
.claims .element-list li { padding: .18rem 0 .18rem .6rem; margin: 0; font-family: var(--serif); font-size: .95rem; }
.claims .element-list li.level-1 { padding-left: 1.6rem; } .claims .element-list li.level-2 { padding-left: 2.6rem; }
.claims .element-list .eid { font-family: var(--mono); font-size: .72rem; color: var(--faint); margin-right: .35rem; }
.claims .element-list li.kind-wherein .eid::after, .claims .element-list li.kind-further .eid::after { content: " ·"; }
.provenance { color: var(--faint); font-family: var(--sans); }

/* LLM reading of a patent (D30 tier 1) */
.reading { font-family: var(--sans); font-size: .92rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1rem .6rem; margin-bottom: 1rem; }
.reading h2 { margin-top: .8rem !important; }
.reading ul.caps { padding-left: 1.1rem; margin: .4rem 0; } .reading ul.caps li { margin-bottom: .45rem; }
.reading .cap-name { font-weight: 600; }
.reading .cap-quote { color: var(--muted); font-family: var(--serif); margin-top: .1rem; }
.reading .verified { color: var(--ok); font-weight: 700; font-family: var(--sans); } .reading .unverified { color: var(--warn); font-weight: 700; font-family: var(--sans); }

/* estimated legal status (C1) */
.lstatus { display: inline-block; font: 600 .68rem/1.5 var(--sans); letter-spacing: .02em; text-transform: none; padding: 0 .45rem; border-radius: 999px; border: 1px solid var(--line); vertical-align: 1px; }
.lstatus.in_force { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.lstatus.expired { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.lstatus.application { color: var(--muted); }
.statusboxes { display: inline-flex; gap: .6rem; align-items: center; }

/* Search feedback (L28): visible while a search is in flight; htmx adds .htmx-request. */
.search-busy { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; visibility: hidden; }
.search-busy.htmx-request { visibility: visible; }
.spinner { width: .9em; height: .9em; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.search-notice { font-size: .85rem; color: var(--fg); background: var(--accent-soft); border-left: 3px solid var(--warn); padding: .4rem .6rem; border-radius: var(--radius-sm); }
.searchrow button[disabled] { opacity: .6; cursor: progress; }

/* Search results say what matched and where; the patent page marks that passage (L29). */
.matched { color: var(--muted); }
.hit { background: var(--hl-yellow); border-radius: var(--radius-sm); box-shadow: 0 0 0 .25rem var(--hl-yellow); }
.hit-note { color: var(--muted); }
@keyframes hitflash { from { box-shadow: 0 0 0 .6rem var(--accent-soft); } }
.hit-flash { animation: hitflash 1.2s ease-out; }
/* The "?" next to the search box: a panel that works without JavaScript. */
.searchrow .help { margin-left: .25rem; }
.searchrow .help > summary { list-style: none; cursor: help; width: 1.7rem; height: 1.7rem; line-height: 1.6rem;
  text-align: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); }
.searchrow .help > summary::-webkit-details-marker { display: none; }
.searchrow .help[open] > summary { background: var(--accent-soft); color: var(--accent); }
.helpbody { position: absolute; z-index: 5; max-width: 46rem; margin-top: .5rem; padding: .9rem 1.1rem;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.helpbody h3 { font-size: .95rem; margin: .8rem 0 .3rem; } .helpbody h3:first-child { margin-top: 0; }
.helpbody p, .helpbody li { font-size: .9rem; }

.weak { color: var(--warn); }
.hitactions { display: flex; align-items: center; gap: .6rem; margin-top: .25rem; }

/* Searching without the workspace node: say so plainly, before and after the search. */
.standing-warning { font-size: .85rem; color: var(--fg); background: var(--accent-soft);
  border-left: 3px solid var(--warn); padding: .4rem .6rem; border-radius: var(--radius-sm); margin: .5rem 0 0; }
.recents { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .5rem; }
.recents .chip { font-size: .8rem; padding: .1rem .5rem; border: 1px solid var(--line); border-radius: 1rem;
  background: var(--surface); color: var(--fg); cursor: pointer; }
.recents .chip:hover { border-color: var(--accent); color: var(--accent); }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }
.learn { font-weight: 400; color: var(--muted); text-decoration: underline; margin-left: .5rem; }
.guide { max-width: 44rem; } .guide blockquote { border-left: 3px solid var(--line); padding-left: .8rem; color: var(--muted); }
.guide.technical { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* The node page: one place to start it, stop it and see what it cost (Mani, 2026-09-22). */
.node-now { padding: .8rem 1rem; margin: 0 0 1.2rem; }
.node-now .stages { display: flex; gap: .9rem; list-style: none; padding: 0; margin: .5rem 0; font-size: .82rem; color: var(--muted); }
.node-now .stages li.done { color: var(--text); }
.node-now .stages li.current { color: var(--accent); font-weight: 600; }
.node-now form { display: inline-flex; align-items: baseline; gap: .5rem; margin: .4rem 0 0; }
table.sessions { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.sessions th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: .35rem .5rem; }
table.sessions td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; }
table.sessions tr.live td { background: var(--surface); }
.node .label { color: inherit; text-decoration: none; }
.node .label:hover { text-decoration: underline; }

/* The version pill: a quiet link to "What's new", a dot until the notes for this version are read. */
.version-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; color: var(--muted); text-decoration: none; font-family: var(--mono); }
.version-pill:hover { color: var(--fg); border-color: var(--line-strong); }
.version-pill.unseen { color: var(--accent); border-color: var(--accent); }
.version-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.release.current { border-left: 3px solid var(--accent); padding-left: .8rem; }
.release .chip { font-size: .7rem; font-family: var(--sans); font-weight: 500; padding: .1rem .45rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; margin-left: .4rem; }
.release .chip.muted { background: var(--surface-2); color: var(--muted); }

/* Getting started: a picture per section, its numbered callouts explained underneath. */
.start figure { margin: .6rem 0 .4rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.start figure img { display: block; width: 100%; height: auto; }
.start .callouts { padding-left: 0; list-style: none; counter-reset: callout; }
.start .callouts li { position: relative; padding-left: 2.4rem; margin: .5rem 0; counter-increment: callout; }
.start .callouts li::before { content: counter(callout); position: absolute; left: 0; top: .1rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #d9480f; color: #fff; font: 700 .85rem/1.7rem var(--sans); text-align: center; }
.node-off-note { margin: .2rem 0 .4rem; padding: .35rem .55rem; border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: var(--radius-sm); }
