/* Spaces Web preview — design tokens and component styles.
   One coherent visual system: warm paper surfaces, near-black ink, a single violet
   accent for interaction, and a small semantic set for work state and evidence. */

:root {
  --font: Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --surface-3: #eeede7;
  --ink: #17171c;
  --ink-2: #4b4b55;
  --ink-3: #82828c;
  --ink-4: #b0b0b8;
  --line: rgba(23, 23, 28, 0.08);
  --line-strong: rgba(23, 23, 28, 0.16);

  --accent: #5b50d6;
  --accent-ink: #4a40bd;
  --accent-soft: #eeedfb;
  --accent-line: rgba(91, 80, 214, 0.35);

  --attn: #b45309;
  --attn-soft: #fdf1dc;
  --ok: #1a7f3c;
  --ok-soft: #e1f5e7;
  --run: #1d4ed8;
  --run-soft: #e3ebfd;
  --bad: #b91c1c;
  --bad-soft: #fde4e4;
  --infer: #7c3aed;
  --infer-soft: #f1e9fe;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-pop: 0 12px 32px rgba(23, 23, 28, 0.14), 0 1px 2px rgba(23, 23, 28, 0.08);
  --shadow-card: 0 1px 2px rgba(23, 23, 28, 0.05);

  /* One rhythm for every destination: the header, each column's head row, list rows. */
  --header-h: 52px;   /* app header and the head row of sidebar, page and pane */
  --row-h: 44px;      /* single-line list row */
  --row-x: 16px;      /* horizontal padding of list rows and heads */
  --row-y: 10px;      /* vertical padding of list rows */
  --nav-h: 30px;      /* sidebar navigation row */
  --rail-w: 66px;
  --side-w: 264px;
  --pane-w: 372px;

  /* Type scale: 15 title · 13.5 body · 12 small · 11 tiny/label. Nothing above 22. */
  --fs-title: 15px;
  --fs-body: 13.5px;
  --fs-small: 12px;
  --fs-tiny: 11px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 150ms;    /* controls: buttons, rows, menus */
  --t-med: 250ms;     /* panes, dialogs, toasts */
}

[data-theme="dark"] {
  --bg: #121216;
  --surface: #1a1a20;
  --surface-2: #202027;
  --surface-3: #2a2a32;
  --ink: #f1f1f4;
  --ink-2: #c3c3cb;
  --ink-3: #8a8a95;
  --ink-4: #5d5d68;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #8d84ec;
  --accent-ink: #a9a2f2;
  --accent-soft: #2a2748;
  --accent-line: rgba(141, 132, 236, 0.4);
  --attn: #f2b15b;
  --attn-soft: #3a2b12;
  --ok: #5fcf83;
  --ok-soft: #14301d;
  --run: #7aa2ff;
  --run-soft: #172445;
  --bad: #ff7b7b;
  --bad-soft: #3d1717;
  --infer: #c19bff;
  --infer-soft: #2c1f47;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: none;
}

@media (prefers-reduced-motion: reduce) {
  :root { --t-fast: 0ms; --t-med: 0ms; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; /* the app owns its scrolling; the page never bounces */
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: var(--fs-title); }
h3 { font-size: var(--fs-body); }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
/* One focus ring everywhere. Rows and chrome draw it inside their own box so a
   scrolling container never clips it; controls draw it just outside. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.nav-row:focus-visible, .list-row:focus-visible, .work-row:focus-visible, .attn-row:focus-visible, .source-row:focus-visible, .output-tile:focus-visible,
.menu__item:focus-visible, .palette__item:focus-visible, .rail__item:focus-visible, .tabbar a:focus-visible, .tabs a:focus-visible, .tabs button:focus-visible,
.card.click:focus-visible, .step-row:focus-visible, .msg:focus-visible, .evidence-card:focus-visible { outline-offset: -2px; }
.nav-row:focus-visible, .list-row:focus-visible, .work-row:focus-visible, .attn-row:focus-visible, .source-row:focus-visible, .output-tile:focus-visible { background: var(--surface-2); }
.nav-row:focus-visible { border-radius: 8px; }
.tabs a:focus-visible, .tabs button:focus-visible { border-radius: 6px; }
.msg:focus-visible { outline-color: var(--accent-line); }
ul { list-style: none; margin: 0; padding: 0; }
code, kbd, .mono { font-family: var(--mono); font-size: var(--fs-small); }
kbd {
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-tiny);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-small); }
.tiny { font-size: var(--fs-tiny); }
.lede { font-size: 14.5px; }
.strong { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.tight { gap: 4px; }
.row.center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* The one label style: 11px uppercase with 0.04em tracking. Sidebar sections, pane
   sections, day separators, palette groups and in-page groupings all use it. */
.section-label, .side__label, .pane__section h3, .palette__group, .day-sep {
  font-size: var(--fs-tiny); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
}
.section-label { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.section-label > span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.stack > .section-label { margin-top: 20px; }
.stack > .section-label:first-child { margin-top: 0; }
.section-head { margin-bottom: 8px; }
.input.filter { max-width: 360px; }

/* Interactive surfaces share one hover transition; nothing else animates on hover. */
.btn, .iconbtn, .nav-row, .rail__item, .tabbar a, .list-row, .work-row, .attn-row, .source-row, .output-tile,
.tabs a, .tabs button, .seg a, .seg button, .menu__item, .palette__item, .thread-link, .cite, .chip, .card.click, .evidence-card, .step-row, .msg {
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

/* Icon tile: a square identity for things that are not people or agents. Sized by
   context, never larger than the avatar beside it. */
.ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); flex: 0 0 auto; }
.ic svg { width: 15px; height: 15px; }
.ic.accent { background: var(--accent-soft); color: var(--accent-ink); }
.ic.approve { background: var(--attn-soft); color: var(--attn); }
.ic.review { background: var(--accent-soft); color: var(--accent-ink); }
.ic.question { background: var(--run-soft); color: var(--run); }
.ic.blocked { background: var(--bad-soft); color: var(--bad); }

/* ---------- Shell ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
@supports (height: 100dvh) { .app { height: 100dvh; } }
/* Chrome is not a document: nothing in the header, rail, sidebar, tabs or pane heads
   selects when a drag overshoots. Content (messages, pages) stays selectable. */
.header, .rail, .side, .tabbar, .page__head, .pane__head, .tabs, .composer__bar, .msg__actions { user-select: none; -webkit-user-select: none; }
.header {
  height: var(--header-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface);
}
/* Both clusters keep their content width and split the rest equally, so the search
   sits centred on a wide screen and is the first thing to give way on a narrow one. */
.header__left, .header__right { display: flex; align-items: center; gap: 6px; flex: 1 1 0; min-width: max-content; }
.header__right { justify-content: flex-end; }
.header > .search { flex: 0 1 520px; min-width: 200px; width: auto; }
.side-toggle { flex: 0 0 auto; }
/* Fixed-width slots: sign-in state and the pill change text, never the layout. */
.auth-slot { display: inline-flex; justify-content: center; width: 72px; flex: 0 0 auto; }
.auth-slot .btn { width: 100%; padding: 0 6px; }
.company {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-md);
  font-weight: 600; min-width: 0;
}
.company__mark, .company__context { flex: 0 0 auto; }
.company:hover { background: var(--surface-2); }
.company__mark {
  width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #5b50d6, #2b6cb0);
  display: grid; place-items: center; color: white; font-size: 11px; font-weight: 700;
}
.company__context { color: var(--ink-3); font-weight: 500; }
.company__context::before { content: "/"; margin: 0 6px; color: var(--ink-4); }
.search {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink-3);
  width: 100%; text-align: left;
}
.search:hover { border-color: var(--accent-line); }
.search span.grow { color: var(--ink-3); }
.iconbtn {
  position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 8px; color: var(--ink-2);
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn[aria-pressed="true"], .iconbtn.active { background: var(--accent-soft); color: var(--accent-ink); }
.iconbtn .count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--attn); color: white; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.iconbtn .count.zero { transform: scale(0.5); opacity: 0; }
.preview-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 6px; border-radius: 12px;
  border: 1px dashed var(--line-strong); color: var(--ink-3); font-size: 11px; font-weight: 500; white-space: nowrap;
  width: 168px; flex: 0 0 auto; /* the widest state fits; shorter states do not move their neighbours */
}
.preview-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--attn); flex: 0 0 auto; }
.preview-pill.live i { background: var(--ok); }
.preview-pill.live { border-style: solid; }
.preview-pill.offline { color: var(--bad); border-color: rgba(185, 28, 28, 0.35); }
.preview-pill.offline i { background: var(--bad); }
.preview-pill:hover { color: var(--ink); background: var(--surface-2); }

.body { display: flex; flex: 1; min-height: 0; position: relative; }
/* Collapsed sidebar: the rail alone carries navigation. On medium widths the toggle
   opens it as a drawer over the page instead of pushing the page narrower. */
.body.side-hidden .side { display: none; }
.body.side-drawer .side {
  display: flex; position: absolute; top: 0; bottom: 0; left: var(--rail-w); z-index: 25;
  box-shadow: var(--shadow-pop); border-right: 1px solid var(--line);
  animation: drawer-in var(--t-med) var(--ease);
}
@keyframes drawer-in { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.side-scrim { position: absolute; inset: 0; left: var(--rail-w); z-index: 24; background: rgba(23, 23, 28, 0.18); animation: fade var(--t-fast) both; }

.rail {
  width: var(--rail-w); flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  padding: 10px 0; gap: 4px; border-right: 1px solid var(--line); background: var(--surface);
}
.rail__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 58px; padding: 7px 0 6px;
  border-radius: var(--r-md); color: var(--ink-3); font-size: 10px; font-weight: 500; letter-spacing: 0;
}
.rail__item:hover { background: var(--surface-2); color: var(--ink); }
.rail__item[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }
.rail__item svg { width: 20px; height: 20px; }
.rail__spacer { flex: 1; }

.side {
  width: var(--side-w); flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--bg);
}
/* Sidebar, page and pane share the same 52px head row so the three columns line up. */
.side__head { min-height: var(--header-h); padding: 0 8px 0 var(--row-x); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side__head h2 { font-size: var(--fs-title); }
.side__scroll { overflow: auto; flex: 1; padding: 0 8px 12px; overscroll-behavior: contain; }
.side__section { margin-top: 10px; }
.side__section:first-child { margin-top: 0; }
.side__label { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px; }
.side__label button { color: var(--ink-3); font-size: var(--fs-tiny); text-transform: none; letter-spacing: 0; font-weight: 500; }
.side__label button:hover { color: var(--ink); }
.side__label .badge { text-transform: none; letter-spacing: 0; }
.side__note { padding: 4px 8px 8px; font-size: var(--fs-small); color: var(--ink-3); }
.nav-row {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 0 8px; border-radius: 8px;
  color: var(--ink-2); text-align: left; min-height: var(--nav-h);
}
.nav-row:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-row[aria-current="page"], .nav-row.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); font-weight: 500; }
.nav-row svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--ink-3); }
.nav-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row .meta { color: var(--ink-3); font-size: var(--fs-tiny); }
.nav-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.nav-row.indent { padding-left: 28px; }
.nav-row .badge { margin-left: auto; }

.main { flex: 1; display: flex; min-width: 0; min-height: 0; position: relative; }
.page { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.page__head {
  display: flex; align-items: center; gap: 10px; padding: 0 var(--row-x); min-height: var(--header-h);
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.page__head h1, .pane__head h2 { line-height: 1.3; }
.page__head .sub, .pane__head .tiny { line-height: 1.35; margin-top: 1px; }
.page__head h1 { font-size: var(--fs-title); font-weight: 600; }
.page__head .sub { color: var(--ink-3); font-size: var(--fs-small); }
.page__head .sub .badge { vertical-align: middle; }
.page__icon { display: inline-flex; flex: 0 0 auto; }
.page__icon .avatar { width: 28px; height: 28px; font-size: 11px; }
.page__body { flex: 1; overflow: auto; min-height: 0; overflow-x: hidden; overscroll-behavior: contain; }
.page__body.pad { padding: 20px 24px 40px; }
.container { max-width: 960px; margin: 0 auto; }
.container.narrow { max-width: 820px; }

.pane {
  width: var(--pane-w); flex: 0 0 auto; border-left: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
  animation: pane-in var(--t-med) var(--ease);
}
@keyframes pane-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.pane__head {
  display: flex; align-items: center; gap: 8px; padding: 0 12px 0 var(--row-x); min-height: var(--header-h); border-bottom: 1px solid var(--line);
}
.pane__head h2 { font-size: 14px; }
.pane__body { flex: 1; overflow: auto; padding: 14px var(--row-x) 24px; overscroll-behavior: contain; }
.pane__body.flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.pane__scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 8px 0; overscroll-behavior: contain; }
.pane__foot { border-top: 1px solid var(--line); }
.pane__section { margin-bottom: 18px; }
.pane__section h3 { margin-bottom: 8px; }

/* ---------- Primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 500; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* One badge: 20px tall, 11px, semantic tone. No screen sizes its own. */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: var(--fs-tiny); font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2);
}
.badge.attn { background: var(--attn-soft); color: var(--attn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.run { background: var(--run-soft); color: var(--run); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.infer { background: var(--infer-soft); color: var(--infer); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-3); font-weight: 500; }
.badge .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-size: 11px; font-weight: 600; color: white; flex: 0 0 auto; position: relative; letter-spacing: 0.02em;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.xl { width: 56px; height: 56px; font-size: 18px; }
.avatar.agent { border-radius: 8px; }
.avatar.agent::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 3px;
  background: var(--surface); border: 2px solid var(--accent);
}
.avatar.sm.agent::after { width: 8px; height: 8px; right: -2px; bottom: -2px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* One card: 14px radius, hairline, faint shadow. Page-level stats, review boxes and
   identity headers are cards too; only elements nested inside a message use the
   smaller 10px radius. */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
a.card { color: inherit; }
a.card:hover { text-decoration: none; }
.card.pad { padding: 14px var(--row-x); }
.card.flat { box-shadow: none; }
.card.click { cursor: pointer; color: inherit; }
.card.click:hover { border-color: var(--accent-line); text-decoration: none; }
.card__head { display: flex; align-items: center; gap: 8px; padding: 12px var(--row-x); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: var(--row-h); }
.card__head h2, .card__head h3 { flex: 1; }
.card__body { padding: 14px var(--row-x); }
.card__foot { padding: 10px var(--row-x); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.identity { display: flex; align-items: center; gap: 14px; }
.identity .name { font-size: 16px; font-weight: 600; }

/* One list row: 16px sides, 10px top and bottom, 44px minimum, hairline between rows. */
.list { display: flex; flex-direction: column; }
.list > * + *, .setting-row + .setting-row, .claim + .claim { border-top: 1px solid var(--line); }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: var(--row-y) var(--row-x); min-height: var(--row-h); color: inherit; text-align: left; width: 100%;
}
.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .title { font-weight: 500; }
.list-row .desc { color: var(--ink-3); font-size: var(--fs-small); }
.list-row .right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.list-row[aria-current="true"] { background: var(--accent-soft); }

.kv { display: grid; grid-template-columns: minmax(96px, 30%) 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 var(--row-x); background: var(--surface); overflow-x: auto; }
.tabs button, .tabs a {
  padding: 10px 10px; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover, .tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { margin-left: 6px; color: var(--ink-3); font-weight: 500; }
.tabs.bare { padding: 0; background: transparent; margin-top: 12px; }
.tabs .icon { vertical-align: -2px; margin-right: 4px; }

.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: 8px; gap: 2px; }
.seg button, .seg a { padding: 4px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; font-size: 12.5px; }
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.seg a:hover { text-decoration: none; color: var(--ink); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 6px; border-radius: 8px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 500;
  max-width: 100%; min-width: 0;
}
.chip > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: inherit; opacity: 0.7; }
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.chip svg { width: 13px; height: 13px; }
.chip.paste { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.chip.paste .tiny { color: var(--ink-3); }
.chip.paste .chip__label { display: inline; width: auto; height: auto; opacity: 1; font-weight: 600; font-family: var(--mono); font-size: 11.5px; }
.chip.paste .chip__label:hover { background: none; text-decoration: underline; }
.paste-preview {
  margin: 0; max-height: 50vh; overflow: auto; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2);
}

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px;
}
.notice.attn { background: var(--attn-soft); border-color: transparent; color: var(--attn); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }

/* Empty states: the full form centres in a page or list; `compact` sits inside a card
   section at row padding. Both use the same voice and colour. */
.empty {
  padding: 48px 24px; text-align: center; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty h2 { color: var(--ink); }
.empty svg { width: 28px; height: 28px; color: var(--ink-4); }
.empty.compact { padding: 14px var(--row-x); gap: 0; text-align: left; align-items: flex-start; }
.card > .empty:not(.compact), .popover .empty:not(.compact), .palette__list .empty:not(.compact) { padding: 32px 24px; }

/* Placeholders keep the geometry of what they stand in for and breathe slowly; that
   is the whole loading indicator, so nothing else on the screen needs to move. */
.skeleton { display: inline-block; background: var(--surface-3); border-radius: 6px; color: transparent; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.tabs .count .skeleton { vertical-align: middle; }

.input, .textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--ink); transition: border-color var(--t-fast);
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 68px; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.switch { display: inline-flex; align-items: center; gap: 8px; }
.switch__track {
  width: 32px; height: 18px; border-radius: 9px; background: var(--ink-4); position: relative; transition: background var(--t-fast);
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white;
  transition: transform var(--t-fast) var(--ease);
}
.switch[aria-checked="true"] .switch__track { background: var(--accent); }
.switch[aria-checked="true"] .switch__track::after { transform: translateX(14px); }

/* ---------- Overlay / dialog / popover ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(23, 23, 28, 0.32); display: grid; place-items: center; z-index: 40;
  animation: fade var(--t-fast) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  animation: rise var(--t-med) var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog__head { padding: 16px 20px 0; display: flex; align-items: center; gap: 10px; }
.dialog__head h2 { flex: 1; font-size: 15px; }
.dialog__body { padding: 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog__foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.dialog.palette { width: min(640px, calc(100vw - 32px)); align-self: start; margin-top: 12vh; }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette__input input { flex: 1; border: 0; background: transparent; font-size: 15px; outline: none; }
.palette__list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette__group { padding: 8px 10px 4px; }
.palette__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; color: inherit;
}
.palette__item:hover, .palette__item[aria-selected="true"] { background: var(--accent-soft); text-decoration: none; }
.palette__item .kind { margin-left: auto; color: var(--ink-3); font-size: 11px; }

.popover {
  position: absolute; top: calc(var(--header-h) - 6px); right: 12px; width: min(420px, calc(100vw - 24px)); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  animation: rise var(--t-fast) var(--ease) both;
}
.popover.narrow { width: 240px; }
.popover .list { max-height: 60vh; overflow: auto; }
.popover__head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.popover__head h2 { flex: 1; font-size: 13.5px; }
.menu { padding: 6px; min-width: 200px; }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--ink-2);
}
.menu__item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu__item svg { width: 15px; height: 15px; }
.menu__sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu__label { padding: 6px 10px 2px; font-size: 11px; color: var(--ink-3); }

.toast-host { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); font-size: 12.5px; animation: rise var(--t-med) var(--ease) both;
}
.toast a, .toast button { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Conversation ---------- */
.convo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scroll-host { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.convo__scroll { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px 8px; overscroll-behavior: contain; }
.convo__inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; }
/* Arrived below while the reader was up the page: the way down, never a jump. */
.new-chip {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: var(--fs-small); font-weight: 600; box-shadow: var(--shadow-pop);
  animation: rise var(--t-fast) var(--ease) both;
}
.new-chip:hover { background: var(--ink-2); }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); position: relative; }
.msg:hover { background: var(--surface-2); }
.msg.compact { grid-template-columns: 32px 1fr; padding-top: 1px; padding-bottom: 1px; }
.msg.compact .avatar { visibility: hidden; height: 0; }
.msg__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.msg__author { font-weight: 600; }
.msg__time { color: var(--ink-3); font-size: 11px; }
.msg__body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg__body p + p { margin-top: 6px; }
.msg__body ul { padding-left: 18px; list-style: disc; margin: 4px 0; }
.msg__actions {
  position: absolute; right: 8px; top: -12px; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px; box-shadow: var(--shadow-card); opacity: 0; pointer-events: none; transition: opacity var(--t-fast);
}
.msg:hover .msg__actions, .msg:focus-within .msg__actions, .msg:focus .msg__actions { opacity: 1; pointer-events: auto; }
.msg:focus { outline: none; background: var(--surface-2); }
/* Sent, sending and not-sent, in one quiet line under the message. */
.msg__status { margin-top: 3px; font-size: var(--fs-tiny); color: var(--ink-3); }
.msg__status-bad { color: var(--bad); }
.msg.pending.sending .msg__body { color: var(--ink-2); }
.linkish { color: var(--accent-ink); font-weight: 600; font-size: inherit; }
.linkish:hover { text-decoration: underline; }
.msg__actions button { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); }
.msg__actions button:hover { background: var(--surface-2); color: var(--ink); }
.msg__actions button svg { width: 14px; height: 14px; }
.thread-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 8px 4px 4px; border-radius: 8px; color: var(--accent-ink); font-weight: 500; font-size: 12px;
}
.thread-link:hover { background: var(--accent-soft); text-decoration: none; }
.milestone {
  display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 12px; border-radius: var(--r-md);
  border: 1px dashed var(--line-strong); color: var(--ink-2); font-size: 12.5px;
}
.milestone svg { width: 15px; height: 15px; color: var(--accent); }
.milestone a { font-weight: 600; }
.attached {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px;
}
.evidence-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: inherit;
}
.evidence-card:hover { text-decoration: none; border-color: var(--accent-line); }
.evidence-card .t { font-weight: 600; }
.evidence-card .d { color: var(--ink-3); font-size: 12px; }
.cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cite {
  display: inline-block; max-width: 100%; height: 22px; line-height: 20px; padding: 0 8px 0 5px; border-radius: 6px; font-size: 11.5px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.cite svg, .cite b { vertical-align: -2px; margin-right: 4px; }
.cite:hover { border-color: var(--accent-line); color: var(--ink); text-decoration: none; }
.cite b { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; background: var(--ink); color: var(--bg); font-size: 9px; line-height: 1; }
.progress-card {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px;
}
.progress-card .steps { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.progress-card .step { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.progress-card .step svg { width: 14px; height: 14px; }
.progress-card .step.done svg { color: var(--ok); }
.progress-card .step.run svg { color: var(--run); }

.composer { padding: 8px 24px 16px; }
.composer__box {
  max-width: 820px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.composer__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer__ctx { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.composer textarea {
  display: block; width: 100%; border: 0; background: transparent; resize: none; padding: 12px 14px 4px; min-height: 44px; max-height: 240px;
  outline: none; line-height: 1.5;
}
.composer__bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px 8px 8px; }
.composer__bar .iconbtn { width: 28px; height: 28px; }
.composer__bar .iconbtn svg { width: 15px; height: 15px; }
.composer__hint { color: var(--ink-3); font-size: var(--fs-tiny); margin-left: 8px; }
.composer__note { padding: 8px 10px 0; }
.thread-meta { padding: 0 24px 10px; }
.send {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center;
}
.send:disabled { background: var(--ink-4); }
.send svg { width: 14px; height: 14px; }
.typing { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

/* ---------- Work ---------- */
.work-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: var(--row-y) var(--row-x); min-height: var(--row-h); color: inherit; }
.work-row:hover { background: var(--surface-2); text-decoration: none; }
.work-row.click { cursor: pointer; }
.work-row[aria-current="true"] { background: var(--accent-soft); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; margin-left: 4px; }
.work-row .status-dot { margin-top: 5px; }
.status-dot.run { background: var(--run); box-shadow: 0 0 0 3px var(--run-soft); }
.status-dot.attn { background: var(--attn); box-shadow: 0 0 0 3px var(--attn-soft); }
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--bad); }
.status-dot.idle { background: var(--ink-4); }
.work-row .title { font-weight: 600; }
.work-row .latest { color: var(--ink-2); margin-top: 2px; }
.work-row .next { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; color: var(--attn); font-weight: 500; font-size: 12.5px; }
.work-row .metaline { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; color: var(--ink-3); font-size: 12px; align-items: center; }
.work-row .right { text-align: right; color: var(--ink-3); font-size: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.tl-item { position: relative; padding: 4px 0 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-4);
}
.tl-item.ok::before { border-color: var(--ok); background: var(--ok); }
.tl-item.run::before { border-color: var(--run); background: var(--run); }
.tl-item.attn::before { border-color: var(--attn); background: var(--attn); }
.tl-item.bad::before { border-color: var(--bad); background: var(--bad); }
.tl-item .t { font-weight: 500; }
.tl-item .m { color: var(--ink-3); font-size: 12px; }

.output-tile { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: var(--row-y) var(--row-x); align-items: start; color: inherit; }
.output-tile:hover { background: var(--surface-2); text-decoration: none; }

.doc { max-width: 760px; font-size: 14px; line-height: 1.6; }
.doc h1 { font-size: 22px; margin-bottom: 12px; }
.doc h2 { font-size: 16px; margin: 22px 0 8px; }
.doc h3 { font-size: 14px; margin: 16px 0 6px; }
.doc p { margin: 8px 0; }
.doc ul { list-style: disc; padding-left: 22px; margin: 8px 0; }
.doc table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.doc th, .doc td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.doc blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent-line); color: var(--ink-2); }

/* ---------- Watch ---------- */
.watch { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.step-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; padding: 8px 12px; align-items: center; width: 100%; text-align: left; }
.step-row:hover { background: var(--surface-2); }
.step-row:disabled { cursor: default; }
.watch__turn { border-top: 1px solid var(--line); }
.watch__request { padding: 10px 12px 4px; align-items: flex-start; }
.watch__indent { padding: 0 12px 4px 42px; }
.watch__reply { padding: 4px 12px 12px 42px; }
.step-row .icon { width: 16px; height: 16px; display: grid; place-items: center; }
.step-row .icon svg { width: 15px; height: 15px; }
.step-row .name { font-weight: 500; }
.step-row .tool { color: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.step-row .dur { color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.track { height: 4px; background: var(--surface-3); border-radius: 2px; position: relative; margin: 6px 12px 10px 42px; }
.track i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--run); }
.track i.ok { background: var(--ok); }
.track i.attn { background: var(--attn); }
.step-details { margin: 0 12px 8px 42px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; }
.step-details pre { margin: 6px 0 0; white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.nowline { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--run); font-weight: 500; font-size: 12.5px; }
.machine { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.machine__screen { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #1c1c24, #2b2b39); display: grid; place-items: center; color: rgba(255, 255, 255, 0.6); font-size: 12px; position: relative; }
.machine__screen::after { content: ""; position: absolute; inset: 12px; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: 8px; }

/* ---------- Company ---------- */
.object-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.object-grid > * { min-width: 0; }
.stack > * { min-width: 0; }
.claim { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: var(--row-y) var(--row-x); align-items: start; }
.k { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.claim .k { margin-top: 1px; }
.claim.struck .text, .is-struck { text-decoration: line-through; color: var(--ink-3); }
.k svg { width: 12px; height: 12px; }
.claim.fact .k, .k.fact { background: var(--ok-soft); color: var(--ok); }
.claim.infer .k, .k.infer { background: var(--infer-soft); color: var(--infer); }
.claim.open .k, .k.open { background: var(--attn-soft); color: var(--attn); }
.claim.correction .k { background: var(--surface-3); color: var(--ink-2); }
.claim .text { }
.claim .why { color: var(--ink-3); font-size: 12px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.claim .tools { display: flex; gap: 4px; margin-top: 6px; opacity: 0.6; transition: opacity var(--t-fast); }
.claim:hover .tools, .claim:focus-within .tools { opacity: 1; }
.fresh { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
.fresh i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.fresh.stale i { background: var(--attn); }
.fresh.old i { background: var(--bad); }
.source-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: var(--row-y) var(--row-x); min-height: var(--row-h); color: inherit; }
.source-row:hover { background: var(--surface-2); text-decoration: none; }
.excerpt { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border-left: 3px solid var(--accent-line); font-size: 13px; color: var(--ink-2); font-style: italic; }
.graph { position: relative; height: 420px; border-radius: var(--r-lg); border: 1px solid var(--line); background: radial-gradient(circle at 50% 50%, var(--surface) 0, var(--surface-2) 100%); overflow: hidden; }
.graph svg { width: 100%; height: 100%; }
.graph .node { cursor: pointer; }
.graph .node text { font-size: 11px; font-family: var(--font); fill: var(--ink); font-weight: 500; }
.graph .node circle { stroke: var(--surface); stroke-width: 2px; }
.graph .edge { stroke: var(--line-strong); stroke-width: 1.2px; }
.graph .edge.infer { stroke-dasharray: 3 3; stroke: var(--infer); }

.stat { padding: 12px var(--row-x); }
.stat .n { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-3); font-size: var(--fs-small); display: flex; align-items: center; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* ---------- Agents & skills ---------- */
.card.agent-card { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px var(--row-x); color: inherit; align-items: start; }
.agent-card .role { color: var(--ink-3); font-size: var(--fs-small); }
.agent-card .desc { margin-top: 6px; color: var(--ink-2); }
.agent-card .skills { margin-top: 8px; gap: 4px; }
.skill-card { padding: 14px var(--row-x); display: flex; flex-direction: column; gap: 8px; color: inherit; }
.skill-card .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.skill-card .desc { color: var(--ink-2); }
.skill-card .foot { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: var(--fs-small); flex-wrap: wrap; }

/* ---------- Settings ---------- */
.setting-row { display: flex; align-items: center; gap: 14px; padding: var(--row-y) var(--row-x); min-height: var(--row-h); }
.setting-row .t { font-weight: 500; }
.setting-row .d { color: var(--ink-3); font-size: var(--fs-small); margin-top: 1px; }
.setting-row .right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.meter { width: 160px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.attn { background: var(--attn); }
.meter + .pct { width: 36px; text-align: right; }

/* ---------- Standalone workstream ---------- */
.standalone { min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.standalone__bar {
  display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 44px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.standalone__bar .url { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.standalone__head { padding: 20px 24px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.standalone__head h1 { font-size: 22px; }
.standalone__body { flex: 1; padding: 20px 24px 60px; }
.standalone__body .container { max-width: 1040px; }
.standalone .empty + .row { margin-top: -24px; }

/* ---------- Attention ---------- */
.attn-row { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: var(--row-y) var(--row-x); align-items: start; color: inherit; width: 100%; text-align: left; }
.attn-row:hover { background: var(--surface-2); text-decoration: none; }
.attn-row .t { font-weight: 600; }
.attn-row .d { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.attn-row .m { color: var(--ink-3); font-size: 11.5px; margin-top: 4px; }
.review-box { border: 1px solid var(--line-strong); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.review-box__head { padding: 10px var(--row-x); background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 8px; min-height: var(--row-h); }
.review-box__body { padding: 12px var(--row-x); font-size: 13px; }
.review-box__body .diff { margin-top: 10px; }
.review-box__body pre.plain { margin: 0; white-space: pre-wrap; font-family: var(--font); font-size: 13px; }
.review-box__actions { margin-top: 12px; }
fieldset.review-box { margin: 0; padding: 0; }
.choice { align-items: flex-start; gap: 10px; cursor: pointer; }
.choice input { margin-top: 3px; }
.review-box__body .kv { margin-top: 8px; }
.diff { font-family: var(--mono); font-size: 12px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.diff div { padding: 3px 10px; white-space: pre-wrap; }
.diff .del { background: var(--bad-soft); color: var(--bad); }
.diff .add { background: var(--ok-soft); color: var(--ok); }
.diff .ctx { color: var(--ink-3); }

/* ---------- Bottom nav (narrow) ---------- */
.tabbar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  :root { --side-w: 236px; --pane-w: 340px; }
  .object-grid { grid-template-columns: minmax(0, 1fr); }
  .watch { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .pane {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; box-shadow: var(--shadow-pop);
    width: min(var(--pane-w), 92vw);
  }
  .preview-pill { width: 96px; justify-content: center; padding: 0 8px; }
  .preview-pill .hide-narrow { display: none !important; }
  .preview-pill .show-narrow { display: inline !important; }
}
/* Touch: what hover reveals on a pointer device is reachable without one. Message
   actions appear on tap (the row takes focus); claim tools are always visible. */
@media (hover: none) {
  .claim .tools { opacity: 1; }
  .msg__actions { top: -14px; }
  .msg:hover { background: transparent; }
  .msg:hover .msg__actions { opacity: 0; pointer-events: none; }
  .msg:focus, .msg:focus-within { background: var(--surface-2); }
  .msg:focus .msg__actions, .msg:focus-within .msg__actions { opacity: 1; pointer-events: auto; }
}
@media (max-width: 860px) {
  :root { --header-h: 48px; --nav-h: 44px; }
  .header { gap: 8px; padding: 0 8px; }
  .header__left { min-width: 0; }
  .header__right { flex: 0 0 auto; }
  .header .search { display: none; }
  .header .header__right .search-icon { display: inline-grid; }
  .side-toggle { display: none; }
  .company__context { display: none; }
  .rail { display: none; }
  /* 44px targets, and text fields at 16px so iOS does not zoom the page on focus. */
  .iconbtn, .msg__actions button, .composer__bar .iconbtn, .send, .chip button, .step-row { min-width: 44px; min-height: 44px; }
  .msg__actions button, .composer__bar .iconbtn, .send { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .menu__item, .palette__item, .tabs a, .tabs button, .setting-row, .claim, .list-row, .work-row, .attn-row, .source-row, .output-tile { min-height: 44px; }
  .tabs a, .tabs button { display: inline-flex; align-items: center; }
  .seg button, .seg a { min-height: 40px; display: inline-flex; align-items: center; }
  .switch__track { transform: scale(1.25); margin: 0 6px; }
  .header .iconbtn { min-width: 40px; min-height: 40px; }
  .composer textarea, .input, .textarea, .palette__input input { font-size: 16px; }
  .msg__actions { top: -18px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); height: 56px; flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); font-size: 10px; font-weight: 500; }
  .tabbar a[aria-current="page"] { color: var(--accent-ink); }
  .tabbar a svg { width: 20px; height: 20px; }
  .side { width: 100%; border-right: 0; }
  .body.has-page .side { display: none; }
  .body.has-page .main { display: flex; }
  .body:not(.has-page) .main { display: none; }
  .page__body.pad { padding: 16px 14px 32px; }
  .convo__scroll { padding: 14px 12px 8px; }
  .composer { padding: 6px 12px 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .standalone__head, .standalone__body { padding-left: 14px; padding-right: 14px; }
  .work-row { grid-template-columns: 22px 1fr; }
  .work-row .right { grid-column: 2; flex-direction: row; align-items: center; text-align: left; }
  .hide-narrow { display: none !important; }
  .dialog.palette { margin-top: 24px; }
}
@media (max-width: 480px) {
  .company > .truncate { display: none; } /* the mark stands for the company on a phone */
  .preview-pill { width: 84px; }
}
@media (min-width: 861px) {
  .header .search-icon { display: none; }
  .show-narrow { display: none !important; }
}

/* Last so it wins over every animation declared above: durations are already 0ms
   via the tokens; this stops the loops too. */
@media (prefers-reduced-motion: reduce) {
  .badge .pulse, .typing i, .skeleton { animation: none; }
  .skeleton { opacity: 0.8; }
  .iconbtn .count { transition: none; }
}
