/* Agent Office — one stylesheet. Light + dark themes from the same custom properties (docs/design/SYSTEM.md).
   Theme: <html data-theme="light|dark"> forces one; without it, prefers-color-scheme decides. */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --border: #e7e7ec;
  --border-strong: #d6d6de;
  --border-hover: #c5c5cf;
  --text: #16171d;
  --text-2: #4a4c57;
  --muted: #696b7e;
  --faint: #a3a5b5;

  --accent: #4f46e5;          /* text, icons, focus — on surfaces */
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(79, 70, 229, 0.22);
  --accent-solid: #4f46e5;    /* fills behind --on-accent text (primary button, badge, my bubble) */
  --accent-solid-hover: #4338ca;
  --on-accent: #ffffff;

  --green: #15803d;   --green-bg: #ecfdf3;  --green-bd: #c6f0d6;  --green-fill: #22c55e;  --green-ink: #14532d;
  --amber: #b45309;   --amber-bg: #fff8eb;  --amber-bd: #fbe2b5;  --amber-fill: #f59e0b;  --amber-ink: #78350f;
  --red: #c0262d;     --red-bg: #fef2f2;    --red-bd: #fbd0d0;    --red-fill: #ef4444;    --red-ink: #7f1d1d;
  --blue: #1d5fd6;    --blue-bg: #eff5ff;   --blue-bd: #cfe0fd;   --blue-ink: #1e3a8a;  --blue-fill: #3b82f6;
  --red-solid: #d92d20;  /* count badges behind white text (4.9:1) */
  --violet: #6d3fd6;  --violet-bg: #f5f0ff; --violet-bd: #e2d6fd;
  --gray: #545667;    --gray-bg: #f2f2f5;   --gray-bd: #e2e2e8;
  /* Categorical chart series (fixed order, validated for colour-vision deficiency as adjacent stack pairs). */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --series-other: #a3a5b5;

  --topbar-bg: rgba(247, 247, 249, 0.85);
  --scrim: rgba(20, 20, 40, 0.25);
  --highlight: #fffbe8;
  --auth-glow: #e9ebff;
  --pulse-ring: rgba(29, 95, 214, 0.45);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23696b7e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.05);
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.04), 0 4px 14px rgba(20, 20, 40, 0.05);
  --shadow-lg: 0 10px 30px rgba(20, 20, 40, 0.12);
  --sidebar: 236px;

  /* type scale (px; 14 is body) and spacing scale (4px grid) — see docs/design/SYSTEM.md */
  --fs-micro: 11.5px;  --fs-small: 12.5px;  --fs-ui: 13.5px;  --fs-body: 14px;  --fs-title: 15px;  --fs-h2: 18px;  --fs-h1: 24px;
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;  --space-4: 16px;  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-12: 48px;

  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;   /* hover, press, colour changes */
  --dur: 180ms;        /* menus, popovers, small layout moves */
  --dur-slow: 260ms;   /* drawers (mobile nav) */
}

/* Dark tokens, twice: forced (data-theme="dark") and system (no data-theme + dark preference). Keep in sync. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e12;
  --surface: #16171c;
  --surface-2: #1b1c22;
  --border: #26272f;
  --border-strong: #363742;
  --border-hover: #474856;
  --text: #ededf2;
  --text-2: #c0c2cf;
  --muted: #9092a3;
  --faint: #626475;
  --accent: #a5a7ff;
  --accent-hover: #c0c1ff;
  --accent-soft: #1f2040;
  --accent-ring: rgba(129, 131, 255, 0.38);
  --accent-solid: #5856e0;
  --accent-solid-hover: #6866ea;
  --on-accent: #ffffff;
  --green: #5fd294;   --green-bg: #102419;  --green-bd: #1d3b2a;  --green-fill: #22c55e;  --green-ink: #a3ebc3;
  --amber: #f2b357;   --amber-bg: #291d0b;  --amber-bd: #4a3413;  --amber-fill: #f59e0b;  --amber-ink: #fbd59c;
  --red: #ff8f8f;     --red-bg: #2c1316;    --red-bd: #4e2328;    --red-fill: #ef4444;    --red-ink: #ffc2c2;
  --blue: #7fb3ff;    --blue-bg: #0f1c33;   --blue-bd: #1f3557;   --blue-ink: #bcd6ff;  --blue-fill: #3b82f6;
  --red-solid: #d92d20;
  --violet: #bda8ff;  --violet-bg: #1e1736; --violet-bd: #352a5c;
  --gray: #a9abba;    --gray-bg: #1f2027;   --gray-bd: #2f303a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-other: #626475;
  --topbar-bg: rgba(13, 14, 18, 0.8);
  --scrim: rgba(0, 0, 0, 0.55);
  --highlight: #2a2612;
  --auth-glow: #1c1c3d;
  --pulse-ring: rgba(127, 179, 255, 0.45);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239092a3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0d0e12;
    --surface: #16171c;
    --surface-2: #1b1c22;
    --border: #26272f;
    --border-strong: #363742;
    --border-hover: #474856;
    --text: #ededf2;
    --text-2: #c0c2cf;
    --muted: #9092a3;
    --faint: #626475;
    --accent: #a5a7ff;
    --accent-hover: #c0c1ff;
    --accent-soft: #1f2040;
    --accent-ring: rgba(129, 131, 255, 0.38);
    --accent-solid: #5856e0;
    --accent-solid-hover: #6866ea;
    --on-accent: #ffffff;
    --green: #5fd294;   --green-bg: #102419;  --green-bd: #1d3b2a;  --green-fill: #22c55e;  --green-ink: #a3ebc3;
    --amber: #f2b357;   --amber-bg: #291d0b;  --amber-bd: #4a3413;  --amber-fill: #f59e0b;  --amber-ink: #fbd59c;
    --red: #ff8f8f;     --red-bg: #2c1316;    --red-bd: #4e2328;    --red-fill: #ef4444;    --red-ink: #ffc2c2;
    --blue: #7fb3ff;    --blue-bg: #0f1c33;   --blue-bd: #1f3557;   --blue-ink: #bcd6ff;  --blue-fill: #3b82f6;
    --red-solid: #d92d20;
    --violet: #bda8ff;  --violet-bg: #1e1736; --violet-bd: #352a5c;
    --gray: #a9abba;    --gray-bg: #1f2027;   --gray-bd: #2f303a;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-other: #626475;
    --topbar-bg: rgba(13, 14, 18, 0.8);
    --scrim: rgba(0, 0, 0, 0.55);
    --highlight: #2a2612;
    --auth-glow: #1c1c3d;
    --pulse-ring: rgba(127, 179, 255, 0.45);
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239092a3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
code, pre, kbd { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--gray-bg); border: 1px solid var(--gray-bd); border-radius: 5px; padding: 0.05em 0.35em; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25em 0; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Theme flips must not animate every colour at once (app.js adds this class for one frame). */
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--accent-solid); color: var(--on-accent); font-weight: 600; box-shadow: var(--shadow-lg); }
.skip-link:focus { top: 10px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52ch; }
.link { color: var(--accent); font-weight: 500; }
.link:hover { color: var(--accent-hover); text-decoration: underline; }
.icon { width: 18px; height: 18px; flex: none; }
.link-external { display: inline-flex; align-items: center; gap: 4px; }
.num, .tabular, time { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 72px; }

/* ---------- app shell ---------- */

.app { display: flex; min-height: 100vh; background: linear-gradient(90deg, var(--surface) 0 calc(var(--sidebar) - 1px), var(--border) calc(var(--sidebar) - 1px) var(--sidebar), var(--bg) var(--sidebar)); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: var(--sidebar); flex: none;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  z-index: 30;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.office-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15), 0 1px 2px rgba(67,56,202,0.3);
}
.office-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7px 10px; border-radius: 7px;
  color: var(--text-2); font: inherit; font-weight: 500;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.nav-item .icon { color: var(--faint); }
.nav-item:hover { background: var(--gray-bg); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .nav-external { margin-left: auto; width: 13px; height: 13px; color: var(--faint); }
.nav-progress { margin-left: auto; font-size: var(--fs-micro); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--accent-solid); color: var(--on-accent);
  font-size: 11.5px; font-weight: 650; display: grid; place-items: center;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 10px; }
.nav-form { margin: 0; }
.product-mark { padding: 12px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); opacity: 0.8; overflow-wrap: anywhere; }
.product-version { text-transform: none; letter-spacing: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Collapse button (sidebar head) and the collapsed icon rail. The choice is the `sidebar` cookie, rendered by the server
   as <html data-sidebar="collapsed"> so the first paint is already right; app.js flips it in place. Desktop only: at
   phone width the sidebar is a drawer behind the menu button and ignores it. */
.sidebar-toggle-form { margin: 0 0 0 auto; display: flex; }
.sidebar-toggle { width: 28px; height: 28px; border: 0; background: none; padding: 0; position: relative; }
.sidebar-toggle .icon { width: 17px; height: 17px; }
.sidebar-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Tooltips from data-tip (the collapse button always; nav items only in the rail, where their labels are hidden). */
.sidebar-toggle:is(:hover, :focus-visible)::after,
html[data-sidebar="collapsed"] .sidebar .nav-item[data-tip]:is(:hover, :focus-visible)::after {
  content: attr(data-tip); position: absolute; z-index: 40; pointer-events: none;
  left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 550; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow);
}
@media (min-width: 861px) {
  html[data-sidebar="collapsed"] { --sidebar: 64px; }
  html[data-sidebar="collapsed"] .sidebar { padding: 14px 10px; }
  html[data-sidebar="collapsed"] .sidebar-head { flex-direction: column; gap: 10px; padding: 4px 0 14px; }
  html[data-sidebar="collapsed"] .sidebar-toggle-form { margin: 0; }
  html[data-sidebar="collapsed"] .office-name,
  html[data-sidebar="collapsed"] .product-mark,
  html[data-sidebar="collapsed"] .nav-progress,
  html[data-sidebar="collapsed"] .nav-external { display: none; }
  html[data-sidebar="collapsed"] .nav-item { position: relative; justify-content: center; padding: 9px 0; }
  html[data-sidebar="collapsed"] .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[data-sidebar="collapsed"] .nav-item .badge { position: absolute; top: 1px; right: 3px; margin: 0; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--surface); }
}
/* Chat focus mode (chat.css has the chat side): the app sidebar steps aside entirely, whatever its own choice is. */
@media (min-width: 861px) {
  html[data-focus="on"] { --sidebar: 0px; }
  html[data-focus="on"] .sidebar { display: none; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; }
.topbar-office { color: var(--muted); font-weight: 500; white-space: nowrap; }
.topbar-sep { color: var(--faint); }
.topbar-crumb { color: var(--muted); font-weight: 500; white-space: nowrap; }
.topbar-crumb:hover { color: var(--text); }
.topbar-page { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-search { position: relative; display: flex; align-items: center; margin-left: auto; }
.topbar-search + .topbar-actions { margin-left: 6px; }
.topbar-search .icon { position: absolute; left: 9px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.topbar-search input { width: 220px; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
mark, .hit { background: var(--highlight); color: inherit; font-weight: 600; border-radius: 2px; padding: 0 1px; }
.topbar-user { display: flex; flex: none; align-items: center; gap: 10px; padding: 4px 4px 4px 10px; border-radius: 22px; }
.topbar-user:hover { background: var(--gray-bg); }
.topbar-user-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.topbar-user-name { font-weight: 600; font-size: 13px; white-space: nowrap; }
.topbar-user-role { font-size: 11.5px; color: var(--muted); }
.nav-burger, .nav-scrim { display: none; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 28px 64px; }
/* Every page shares one column width so the left edge never jumps between pages; `wide` is kept for API compat. */
.content-wide { max-width: 1240px; }

/* ---------- page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; }
.subtitle { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.breadcrumbs { display: flex; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span:last-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 550; font-size: 13.5px; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  user-select: none; list-style: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 15px; height: 15px; }
.btn::-webkit-details-marker { display: none; }
.btn-primary { background: var(--accent-solid); color: var(--on-accent); box-shadow: 0 1px 2px rgba(67,56,202,0.25), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-primary:hover { background: var(--accent-solid-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-hover); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-bd); }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 22px; padding: 0 6px; font-size: 11.5px; }
.btn-danger-ghost { background: transparent; color: var(--muted); }
.btn-danger-ghost:hover { background: var(--red-bg); color: var(--red); }

/* icon button + dropdown menu (a <details>; works without JS) */
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); cursor: pointer; list-style: none; transition: background var(--dur-fast), color var(--dur-fast); }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover, .menu[open] > .icon-btn { background: var(--gray-bg); color: var(--text); }
.when-light, .when-dark { display: none; }
[data-theme-pref="light"] .when-system, [data-theme-pref="dark"] .when-system { display: none; }
[data-theme-pref="light"] .when-light, [data-theme-pref="dark"] .when-dark { display: block; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 168px; margin: 0;
  padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  transform-origin: top right; animation: menu-in var(--dur) var(--ease-out);
}
.menu-label { padding: 6px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--gray-bg); color: var(--text); outline: none; }
.menu-item .menu-check { margin-left: auto; color: var(--accent); visibility: hidden; }
.menu-item[aria-pressed="true"] { color: var(--text); font-weight: 550; }
.menu-item[aria-pressed="true"] .menu-check { visibility: visible; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-2px); } to { opacity: 1; transform: none; } }

/* segmented control */
.segmented { display: flex; gap: 2px; padding: 3px; margin: 0; background: var(--gray-bg); border: 1px solid var(--gray-bd); border-radius: 9px; }
.segmented-item {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.segmented-item .icon { width: 14px; height: 14px; }
.segmented-item:hover { color: var(--text); }
.segmented-item[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.card-foot-note { margin: 10px 0 0; }
.card-flush > .card-foot-pad { margin: 0; padding: 12px 20px 16px; }
.pre.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
/* A field the server sent back (src/web/form-state.ts): the message under it, the input outlined. */
small.field-error { display: block; color: var(--red); font-size: 12.5px; font-weight: 550; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline > span { white-space: nowrap; }
.field-short { max-width: 240px; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; min-height: 34px; width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; cursor: pointer; }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: var(--border-hover); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent-solid); }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Name field with suggested names: "‹" and "Another name" sit beside the input (shown by app.js). */
.field > .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
/* "Where to find it" under a field's label (whereField in ui.ts, docs/ux/PRINCIPLES.md §11): the service's menu path and a
   direct link in one line; steps only when needed, folded. Reads as help, not as a caption: text-2, not muted. */
.where-hint { display: flex; flex-direction: column; gap: 4px; margin-top: -2px; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.where-hint-line { margin: 0; overflow-wrap: anywhere; }
.where-hint-line strong { font-weight: 600; color: var(--text); }
.where-hint code { overflow-wrap: anywhere; }
.where-hint-link { white-space: nowrap; font-weight: 550; }
.where-hint .where-hint-steps > summary { cursor: pointer; width: fit-content; color: var(--accent); font-weight: 550; }
.where-hint .where-hint-steps > summary:hover { color: var(--accent-hover); }
.where-hint-steps > ol, .where-hint-steps > ul { margin: 6px 0 2px; padding-left: 20px; display: grid; gap: 3px; }
.where-hint-steps > ol > li, .where-hint-steps > ul > li { min-width: 0; overflow-wrap: anywhere; }
.name-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.name-pick input { flex: 1 1 160px; min-width: 0; }
.name-steps { display: flex; flex: none; gap: 4px; }
.name-pick .name-step { height: 34px; }
.name-pick .name-step[data-name-step="-1"] { width: 30px; padding: 0; font-size: 17px; }
.name-pick input.is-new { animation: name-in 0.32s var(--ease-out); }
@keyframes name-in { 0% { background: var(--accent-soft); transform: translateY(2px); } 100% { transform: none; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-actions > .small { flex: 1 1 14rem; min-width: 0; }
.form-actions-center { justify-content: center; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.fieldset legend { font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 0 4px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-narrow { max-width: 720px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 14.5px; font-weight: 650; }
.card-head-pad { padding: 16px 20px 0; }
.card-empty { color: var(--muted); margin: 4px 0; }
/* A bare empty line in a flush card has no card padding to lean on: inset it like a table cell. */
.card-flush > .card-empty { margin: 0; padding: 14px 16px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; font-weight: 650; }
.count { background: var(--gray-bg); border: 1px solid var(--gray-bd); color: var(--text-2); border-radius: 10px; font-size: 12px; font-weight: 600; padding: 0 8px; }

/* ---------- pills, tags, avatars ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-live .dot { animation: pulse 1.6s ease-in-out infinite; }
.pill-green { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.pill-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.pill-red { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.pill-blue { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-bd); }
.pill-violet { color: var(--violet); background: var(--violet-bg); border-color: var(--violet-bd); }
.pill-gray { color: var(--gray); background: var(--gray-bg); border-color: var(--gray-bd); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 550; color: var(--text-2); background: var(--gray-bg); margin-right: 4px; }
.tag-blue { color: var(--blue); background: var(--blue-bg); }
.tag-violet { color: var(--violet); background: var(--violet-bg); }
.tag-red { color: var(--red); background: var(--red-bg); }
.tag-accent { color: var(--accent); background: var(--accent-soft); }
a.tag:hover { filter: brightness(0.97); text-decoration: underline; text-underline-offset: 2px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 9px; font-weight: 650; letter-spacing: 0.01em;
  color: #fff; user-select: none;
}
.avatar-human { border-radius: 50%; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; border-radius: 7px; }
.avatar-human.avatar-sm { border-radius: 50%; }
.avatar-md { width: 34px; height: 34px; font-size: 12.5px; }
.avatar-lg { width: 42px; height: 42px; font-size: 15px; border-radius: 11px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }
.avatar-human.avatar-lg, .avatar-human.avatar-xl { border-radius: 50%; }
.av-0 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.av-1 { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.av-2 { background: linear-gradient(135deg, #10b981, #047857); }
.av-3 { background: linear-gradient(135deg, #f59e0b, #c2410c); }
.av-4 { background: linear-gradient(135deg, #ec4899, #be185d); }
.av-5 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.av-6 { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.av-7 { background: linear-gradient(135deg, #64748b, #334155); }
.chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; vertical-align: middle; }
a.chip:hover { color: var(--accent); }

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stats-5 { grid-template-columns: 1.4fr repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-value-sm { font-size: 15px; font-weight: 600; letter-spacing: 0; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-of { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-hint { font-size: 12px; color: var(--muted); }

/* ---------- floor ---------- */

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 20px; }
.agent-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.agent-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.agent-card.is-muted { background: var(--surface-2); }
.agent-card.is-muted .avatar { filter: grayscale(0.7); opacity: 0.75; }
.agent-card-head { display: flex; align-items: center; gap: 12px; }
.agent-card-title { flex: 1; min-width: 0; }
.agent-name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-role { color: var(--muted); font-size: 13px; }
.agent-card-body { min-height: 22px; }
.activity { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.activity-live { color: var(--blue); font-weight: 550; }
.activity-paused { color: var(--amber); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 0 var(--pulse-ring); animation: ring 1.6s ease-out infinite; }
.agent-card-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: auto; }
.agent-card-meta { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }
.agent-card-flag, .agent-card .activity-live { position: relative; z-index: 1; }
.activity-live:hover { text-decoration: underline; text-underline-offset: 3px; }
.activity-since { font-weight: 450; color: var(--muted); }
.agent-card.is-working { border-color: color-mix(in srgb, var(--blue-fill) 30%, var(--border)); }

/* Presence: the floor's status language on an avatar (List, desk), matching the 2D/3D seats.
   Working = blue ring that breathes, suspended = dashed amber ring, idle = no ring; red count = waiting on you,
   accent badge = new mail. */
.presence { position: relative; display: inline-flex; flex: none; }
.presence::before { content: ""; position: absolute; inset: -4px; border-radius: 14px; border: 2px solid transparent; pointer-events: none; }
.presence-xl::before { inset: -5px; border-radius: 20px; }
.presence.is-working::before { border-color: var(--blue-fill); animation: presence 2.4s var(--ease-out) infinite; }
.presence.is-suspended::before { border: 2px dashed var(--amber-fill); }
.presence.is-proposed::before { border: 2px dashed var(--border-strong); }
.presence.is-suspended .avatar, .presence.is-proposed .avatar { filter: grayscale(0.7); opacity: 0.75; }
.presence-badge {
  position: absolute; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 750; line-height: 1; color: var(--on-accent);
  box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.presence-needs { top: -8px; background: var(--red-solid); }
.presence-mail { bottom: -8px; background: var(--accent-solid); }
.presence-mail svg { width: 10px; height: 10px; }
.presence-xl .presence-badge { right: -9px; min-width: 22px; height: 22px; border-radius: 11px; font-size: 12px; }
.presence-xl .presence-needs { top: -9px; }
.presence-xl .presence-mail { bottom: -9px; }
@keyframes presence { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue-fill) 35%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-fill) 0%, transparent); } }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 var(--pulse-ring); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }

.activity-list { list-style: none; margin: 0 -8px; padding: 0; }
.activity-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.activity-row:hover { background: var(--surface-2); }
.activity-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { width: 82px; text-align: right; color: var(--muted); font-size: 12.5px; flex: none; }

/* ---------- budget bar ---------- */

.budget { display: flex; flex-direction: column; gap: 6px; }
.budget-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 550; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--gray-bg); overflow: hidden; }
.budget:not(.budget-compact) .bar { height: 8px; border-radius: 4px; }
.fill { display: block; height: 100%; border-radius: inherit; min-width: 0; transition: width 0.3s; }
.fill-green { background: var(--green-fill); }
.fill-amber { background: var(--amber-fill); }
.fill-red { background: var(--red-fill); }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* ---------- desk ---------- */

.desk-head { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.desk-head-text { flex: 1; min-width: 0; }
.desk-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.desk-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.desk-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.desk-stats { margin-bottom: 16px; }
.desk-stats .stat-value { font-size: 22px; }
.bar-stat { margin: 8px 0 6px; }
.desk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 13px; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.desk-main, .desk-side { min-width: 0; }
.caps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.caps li { position: relative; padding-left: 24px; font-size: 13.5px; }
.caps li::before {
  content: "✓"; position: absolute; left: 0; top: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--green-bg); color: var(--green); font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}
.caps-small li { font-size: 12.5px; color: var(--text-2); }
/* A grant line the office doesn't apply (a tailnet entry off the tailnet, an internet entry on it): no tick. */
.caps li.cap-refused { color: var(--text-2); }
.caps li.cap-refused::before { content: "!"; background: var(--amber-bg); color: var(--amber); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-compact { font-size: 12.5px; gap: 4px 12px; margin: 8px 0; }
.kv-compact dt::first-letter { text-transform: uppercase; }

.popover { position: relative; }
.popover > summary { list-style: none; }
.popover-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10;
  width: 320px; padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.disclosure { margin-top: 12px; }
.card > .disclosure:first-child { margin-top: 0; }
.kv + p, .kv + .btn { margin-top: 12px; }
p + .btn { margin-top: 4px; }
.disclosure > summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; padding: 4px 0; }
.disclosure[open] > summary { margin-bottom: 10px; }

/* chat styles live in chat.css (linked on chat pages only) */

/* ---------- prose (charters, mail) ---------- */

.prose { font-size: 14px; line-height: 1.65; color: var(--text-2); }
.prose h3, .prose h4, .prose h5, .prose h6 { color: var(--text); font-size: 14px; font-weight: 650; margin: 1.3em 0 0.4em; }
.prose h3:first-child, .prose h4:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 0.9em; }
.prose li { margin: 0.25em 0; }
/* Front matter of a Markdown note (src/web/markdown.ts): its fields on one quiet line. */
.md-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 1em; font-size: 12.5px; color: var(--muted); }
.md-meta-key { color: var(--text-2); font-weight: 600; }
.prose strong { color: var(--text); font-weight: 620; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose blockquote { margin: 0 0 1em; padding: 2px 14px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.prose pre, .pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.55; margin: 0; }
.prose pre code { background: none; border: 0; padding: 0; }
.pre-code { white-space: pre; }
/* A code block in agent text (web/code-block.ts) and its copy button, top right. The button exists only with JavaScript
   (app.js sets .js-on). Quiet at rest (0.25), clearer while the block is hovered (0.6), full when the button itself is
   hovered, focused from the keyboard or showing that it copied; 0.6 on touch screens, where nothing hovers. The block keeps
   room on its right, so the button never covers code, and the button sits on the block, not in its scrolling area, so it
   stays in the corner while a long line scrolls. */
.code-block { position: relative; }
.code-block > pre { padding-right: 46px; }
.code-copy { display: none; }
.js-on .code-copy {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 28px; height: 28px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--muted);
  font: inherit; font-size: var(--fs-micro); font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  opacity: 0.25; transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast), background var(--dur-fast);
}
.js-on .code-block:hover .code-copy { opacity: 0.6; }
.js-on .code-block .code-copy:is(:hover, :focus-visible, [data-state]) { opacity: 1; color: var(--text); }
.js-on .code-copy:hover { background: var(--surface-2); }
.code-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.code-copy:active { transform: scale(0.97); }
.code-copy-ic { width: 14px; height: 14px; flex: none; }
.code-copy-ic-done, .code-copy[data-state="copied"] .code-copy-ic-copy, .code-copy-label:empty { display: none; }
.code-copy[data-state="copied"] .code-copy-ic-done { display: block; }
.js-on .code-block .code-copy[data-state="copied"] { color: var(--green); }
/* "Copied" / "Press ⌘C": a tooltip above the button, so it covers no code (like the sidebar's tooltips). */
.code-copy-label {
  position: absolute; right: -1px; bottom: calc(100% + 6px); pointer-events: none;
  padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 550; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow);
}
@media (pointer: coarse) {
  .js-on .code-copy { opacity: 0.6; min-width: 32px; height: 32px; }
  .code-block > pre { padding-right: 50px; }
}
.lead { font-size: 15px; color: var(--text); }
/* A run's outcome: the agent's final message as markdown, at a readable measure. */
.run-outcome-text { max-width: 72ch; font-size: 14.5px; color: var(--text); }
.run-outcome-text p { margin: 0 0 0.75em; }
.run-outcome-text > :last-child { margin-bottom: 0; }
.subtitle .chip { color: var(--text-2); }
.desk-main > :last-child, .desk-side > :last-child { margin-bottom: 0; }

/* ---------- desk board (what an agent pins to its desk: src/server/routes/desk-board.ts, the 2D floor) ---------- */

.board {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding: 12px 14px 10px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 4px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.board:hover { border-color: var(--border-hover); box-shadow: var(--shadow); text-decoration: none; }
.board:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.board-title { font-weight: 650; font-size: var(--fs-ui); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-asof { flex: none; color: var(--muted); font-size: var(--fs-micro); white-space: nowrap; }
.board-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.board-items.board-n1 { grid-template-columns: minmax(0, 1fr); }
.board-item { display: flex; flex-direction: column; min-width: 0; }
.board-value { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.board-label { color: var(--text-2); font-size: var(--fs-small); line-height: 1.3; overflow-wrap: anywhere; }
.board-change { font-size: var(--fs-micro); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; color: var(--muted); }
.board-change.is-good { color: var(--green); }
.board-change.is-bad { color: var(--red); }
.board-more { color: var(--muted); font-size: var(--fs-micro); }
.board-artifact, .board-foot { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-small); }
.board-artifact { flex-wrap: wrap; }
.board-artifact-text { flex: 1; min-width: 0; color: var(--text-2); }
.board-artifact-kind { color: var(--muted); }
.board-thumb { display: block; width: 100%; max-height: 140px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; }
.board-open { color: var(--accent); font-weight: 550; white-space: nowrap; margin-left: auto; }
.board-pinned .board-artifact-text { flex-basis: 0; }
.agent-card .board { position: relative; z-index: 1; padding: 10px 12px 8px; gap: 8px; }
.agent-card .board-value { font-size: 15px; }
.desk-board-card .board { box-shadow: none; }
.desk-board-card .board-title { white-space: normal; overflow-wrap: anywhere; }
.desk-board-run { margin: 10px 0 0; }

/* ---------- tables & lists ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.card:not(.card-flush) .table th:first-child, .card:not(.card-flush) .table td:first-child { padding-left: 0; }
.card:not(.card-flush) .table th:last-child, .card:not(.card-flush) .table td:last-child { padding-right: 0; }
.card:not(.card-flush) .table th { background: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stack-label { display: none; }
.row-link:hover td { background: var(--surface-2); }
.row-link td > a:not(.cell-agent) { display: block; }
/* The cell that takes the spare width, so a .truncate inside it shortens instead of pushing the table past its card. */
.cell-fill { width: 100%; max-width: 0; }
.cell-agent { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.table-ledger td { font-size: 13px; vertical-align: top; }
.table-ledger tr:target td { background: var(--highlight); }
.action { background: none; border: 0; padding: 0; color: var(--text); font-weight: 550; }
.action-red { color: var(--red); }
.audit-action { font-weight: 550; color: var(--text); }
.audit-action.action-red { color: var(--red); }
.audit-code { font-size: 11.5px; color: var(--muted); font-weight: 450; }
.audit-fields { color: var(--text-2); overflow-wrap: anywhere; margin-bottom: 2px; }
.data summary { cursor: pointer; list-style: none; color: var(--accent); font-size: 12.5px; }
.data summary::-webkit-details-marker { display: none; }
.data summary code { background: none; border: 0; padding: 0; color: var(--muted); }
.data[open] .pre { margin: 8px 0 6px; max-width: 480px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.list li:last-child .list-row { border-bottom: 0; }
.card:not(.card-flush) .list-row { padding-left: 0; padding-right: 0; }
a.list-row:hover { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main > code { align-self: flex-start; max-width: 100%; }
.list-ext { flex: none; display: inline-flex; color: var(--muted); }
.list-ext svg { width: 14px; height: 14px; }
.list-main > .out-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.list-main > .out-items { white-space: normal; overflow: visible; margin-top: 2px; }
.out-items > summary { cursor: pointer; color: var(--accent); width: max-content; }
.out-item-list { display: block; margin-top: 4px; overflow-wrap: anywhere; line-height: 1.6; }
.fold-toggle:not(:checked) ~ .fold-more, .fold-toggle:not(:checked) ~ .fold-label .fold-open, .fold-toggle:checked ~ .fold-label .fold-closed { display: none; }
.fold-label { display: inline-block; margin-top: 12px; cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; }
.fold-toggle:focus-visible ~ .fold-label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.fold-more { border-top: 1px solid var(--border); }
.list-line { font-size: 13px; }
.list-subject { color: var(--text-2); }
.list-subject.is-unread { color: var(--text); font-weight: 620; }
.list-time { width: 80px; text-align: right; font-size: 12.5px; color: var(--muted); flex: none; }

.pager { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- empty states & flashes ---------- */

.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; }
.empty-page { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 24px; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.empty-icon .icon { width: 22px; height: 22px; }
.empty-icon-green { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px var(--green-bd); }
.empty-icon-red { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-bd); }
.empty-icon-gray { background: var(--gray-bg); color: var(--gray); box-shadow: inset 0 0 0 1px var(--gray-bd); }
.empty h3 { font-size: 16px; font-weight: 650; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: min(52ch, 100%); margin: 0 auto 18px; overflow-wrap: anywhere; }
.empty p code { overflow-wrap: anywhere; white-space: normal; }
.agent-grid + .empty, .stats + .empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; }

.flash { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.flash a { font-weight: 600; text-decoration: underline; }
.flash-ok { background: var(--green-bg); border-color: var(--green-bd); color: var(--green-ink); }
.flash-error { background: var(--red-bg); border-color: var(--red-bd); color: var(--red-ink); }
.flash-info { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue-ink); }
.flash-warn { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber-ink); }
/* A service's raw error under a plain flash, folded (src/connections/check-error.ts). */
.flash-details { margin-top: 6px; font-size: 12.5px; }
.flash-details > summary { cursor: pointer; width: fit-content; font-weight: 600; }
.flash-details > code { display: block; margin-top: 6px; padding: 6px 8px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); background: var(--surface); border-color: var(--border); }

/* A run refused on the model credential: what happened, who can fix it, how (Settings, run details, chat). */
.cred-fix { min-width: 0; max-width: 100%; border: 1px solid var(--red-bd); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.cred-fix > * + * { margin-top: 8px; }
.cred-fix-head { display: flex; align-items: center; gap: 8px; color: var(--red-ink); }
.cred-fix-head .icon, .cred-fix-head .ic { width: 15px; height: 15px; color: var(--red); flex: none; }
.cred-fix-lead { margin: 0; color: var(--text-2); }
.cred-fix-option { border-top: 1px solid var(--border); padding-top: 8px; }
.cred-fix-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 600; }
.cred-fix-tag { font-size: 11.5px; font-weight: 550; color: var(--text-2); background: var(--gray-bg); border: 1px solid var(--gray-bd); border-radius: 999px; padding: 0 8px; }
.cred-fix-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.cred-fix-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; }
.cred-fix-action > p { margin: 0; flex: 1 1 240px; min-width: 0; }
.signin-list { list-style: none; counter-reset: signin; margin: 0; padding: 0; display: grid; gap: 20px; }
.signin-list > li { counter-increment: signin; position: relative; padding-left: 36px; min-width: 0; }
.signin-list > li::before { content: counter(signin); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12.5px; display: grid; place-items: center; }
.signin-list h2 { margin: 0 0 4px; font-size: 15px; }
.signin-list p { margin: 0 0 8px; }
.signin-code { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.signin-code .field { flex: 1 1 260px; margin: 0; min-width: 0; }
.signin-hint { flex-basis: 100%; margin-top: -4px; font-size: 12px; color: var(--muted); }
.signin-cancel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border); }
.signin-facts { margin: 8px 0 12px; padding-left: 20px; display: grid; gap: 4px; }
.signin-start { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cred-fix-more > summary { cursor: pointer; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.cred-fix-more > summary:hover { color: var(--text); }
summary.cred-fix-title { display: list-item; font-size: 13.5px; color: var(--text); margin-top: 0; }
summary.cred-fix-title > .cred-fix-tag { margin-left: 8px; }
.cred-fix-steps { margin: 6px 0 0; padding-left: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.cred-fix-steps > li { min-width: 0; }
.cred-fix-cmd { display: block; width: fit-content; max-width: 100%; margin-top: 4px; padding: 4px 8px; overflow-x: auto; white-space: pre; user-select: all; }
.cred-fix-after { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.cred-fix-raw { margin: 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- runs ---------- */

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 14px; padding: 7px 0; }
.tl-dot { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--surface); border: 2px solid var(--faint); }
.tl-blue .tl-dot { border-color: var(--blue); }
.tl-green .tl-dot { border-color: var(--green); background: var(--green-fill); }
.tl-amber .tl-dot { border-color: var(--amber); }
.tl-red .tl-dot { border-color: var(--red); background: var(--red-fill); }
.tl-body { flex: 1; min-width: 0; }
.tl-denied .tl-body { background: var(--red-bg); border: 1px solid var(--red-bd); border-radius: var(--radius-sm); padding: 8px 12px; margin: -2px 0; }
.tl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.tl-type { font-weight: 600; }
.tl-denied .tl-type { color: var(--red); }
.tl-tool { font-size: 11.5px; color: var(--muted); }
.tl-tool-name { font-size: 13px; color: var(--text); }
.tl-time { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tl-summary { font-size: 13px; color: var(--text-2); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-denied .tl-summary { color: var(--red-ink); }
.tl-stderr { margin-top: 4px; }
.tl-stderr .pre { max-height: 320px; overflow: auto; }
.tl-shot { display: block; margin-top: 6px; max-width: 320px; height: auto; border: 1px solid var(--border, #e5e5e5); border-radius: 6px; }
.tl-hidden { color: var(--faint); font-style: italic; }

/* ---------- needs you ---------- */

.requests { display: flex; flex-direction: column; gap: 12px; }
.request { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.request-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 13px; }
.request-head .pill { margin-left: auto; }
.request-head .pill + .pill { margin-left: 0; }
.request-removes { border-color: var(--red-bd); box-shadow: 0 0 0 1px var(--red-bd), var(--shadow-sm); }
.removal-warning { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--red-bg); color: var(--red-ink); font-size: 13.5px; font-weight: 600; }
.request-title { font-size: 15px; font-weight: 640; margin: 10px 0 6px; }
.request-outcomes { margin: 8px 0 0; color: var(--text-2); }
.request-tech { margin-top: 8px; }
.next-step { margin: 10px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--blue-bg); border: 1px solid var(--blue-bd); color: var(--blue-ink); font-size: 13.5px; }
.next-step p { margin: 2px 0 0; }
/* Needs you: Slack bots to reinstall (one row per bot, its Reinstall button at the end). */
.reinstall-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.reinstall-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.reinstall-item > span { min-width: 0; overflow-wrap: anywhere; font-weight: 560; }
/* A write on someone's mirror account (approval-body.ts mirrorCall): the conversation now, then the exact text. */
.request-mirror-label { margin: 12px 0 4px; }
.request-mirror-recent { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-mirror-text { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.request-actions input { flex: 1; }
/* A held call the agent can no longer make (routes/needs.ts ungrantedCall): why Approve isn't offered. */
.request-cant { margin: 12px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--amber-bg); border: 1px solid var(--amber-bd); color: var(--amber-ink); font-size: 13.5px; }
.request-actions .small { flex: 1; }
/* A policy proposal that can't merge (conflicts with something merged since), and Close pull request (a disclosure). */
.proposal-conflict { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--amber-bg); border: 1px solid var(--amber-bd); color: var(--amber-ink); font-size: 13.5px; overflow-wrap: anywhere; }
/* A proposal granting a repository that doesn't exist (proposal-actions.ts missingRepoWarning): merging skips that grant. */
.proposal-missing-repo { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--amber-bg); border: 1px solid var(--amber-bd); color: var(--amber-ink); font-size: 13.5px; overflow-wrap: anywhere; }
.proposal-missing-repo ul { margin: 0; padding: 0; list-style: none; }
.proposal-missing-repo p { margin: 4px 0 0; }
/* A grant the office skipped, and an agent it can't set up (routes/grant-problems.ts). */
.grant-problem-why { margin: 0; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }
.setup-problem-raw { margin-top: 6px; font-weight: 400; }
.setup-problem-raw > summary { cursor: pointer; width: fit-content; }
.setup-problem-raw pre { margin: 6px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; }
.cap-skipped { text-decoration: none; }
/* One the forge is still re-checking after another merge (proposal-actions.ts): not a problem, just a moment. */
.proposal-checking { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }
.proposal-queued { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--text); }
/* A hire's capabilities every agent gets, folded under its own (proposal-actions.ts proposalChangeList). */
.proposal-standard { margin: 6px 0 0; font-size: 13px; }
.proposal-standard > summary { cursor: pointer; width: fit-content; color: var(--text-2); padding: 2px 0; }
.proposal-standard > summary .muted { font-weight: 400; }
.proposal-standard[open] > summary { margin-bottom: 2px; }
.request-actions:has(> .pr-close) { flex-wrap: wrap; }
.pr-close { min-width: 0; }
.pr-close[open] { flex-basis: 100%; }
.pr-close > summary { list-style: none; width: fit-content; }
.pr-close > summary::-webkit-details-marker { display: none; }
.pr-close[open] > summary { margin-bottom: 8px; }
.pr-close-form { display: grid; gap: 8px; min-width: 0; }
/* Closed, its form takes no room at all (a closed <details> in a flex row can still lay it out past the edge). */
.pr-close:not([open]) > .pr-close-form { display: none; }
.pr-close-form textarea { width: 100%; box-sizing: border-box; }
/* Needs you: what agents ask (routes/asks.ts). A question or an action approval, its markdown body, PR chips. */
.ask-kicker { margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ask-kicker + .ask-title { margin-top: 2px; }
.ask-title { overflow-wrap: anywhere; }
.ask-kicker-inline { color: var(--muted); font-weight: 560; }
.ask-settled { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--green-bg); border: 1px solid var(--green-bd); color: var(--green-ink); font-size: 13.5px; font-weight: 560; }
.ask-body { margin-top: 8px; min-width: 0; max-width: 72ch; overflow-wrap: anywhere; }
.ask-body > :last-child { margin-bottom: 0; }
.ask-body p { margin: 0 0 0.7em; }
.ask-body h4, .ask-body h5, .ask-body h6 { color: var(--text); font-size: 13.5px; font-weight: 650; margin: 1em 0 0.3em; }
.ask-body hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.ask-body code { font-size: 12.5px; }
.ask-body li > ul, .ask-body li > ol { margin: 0.25em 0 0.4em; }
/* What the agent asks the person to open first (ask_human `actions`): a labelled strip of secondary buttons under the
   question (Send answer stays the card's only primary); the first one outlined in the accent, never filled. */
.ask-first { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.ask-first-label { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-action { max-width: 100%; white-space: normal; text-align: left; text-decoration: none; }
.ask-action-main { border-color: var(--accent); color: var(--accent); }
.ask-action-main:hover { border-color: var(--accent); }
.ask-first-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
/* How to find the answer (ask_human how_to_answer): the agent's steps and links, right above the answer box. An info
   surface (blue), calm: a tinted inset with a label, the steps in the body's own type. Once settled it folds. */
.ask-howto { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--blue-bd); border-radius: var(--radius-sm); background: var(--blue-bg); min-width: 0; max-width: 78ch; overflow-wrap: anywhere; }
.ask-howto-label { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 12.5px; font-weight: 650; color: var(--blue-ink); }
.ask-howto-label svg { width: 14px; height: 14px; flex: none; }
.ask-howto-body { color: var(--text); font-size: 14px; }
.ask-howto-body > :first-child { margin-top: 0; }
.ask-howto-body > :last-child { margin-bottom: 0; }
.ask-howto-body p { margin: 0 0 0.6em; }
.ask-howto-body ol, .ask-howto-body ul { margin: 0 0 0.6em; padding-left: 1.4em; }
.ask-howto-body li { margin: 0.2em 0; }
.ask-howto-body code { font-size: 12.5px; }
.ask-howto-folded { background: var(--surface-2); border-color: var(--border); }
.ask-howto-folded > .ask-howto-label { display: list-item; margin: 0; cursor: pointer; width: fit-content; color: var(--accent); font-weight: 550; }
.ask-howto-folded[open] > .ask-howto-label { margin-bottom: 6px; }
/* Once settled: the same pages as one quiet line (answering doesn't mean they were done). */
.ask-from-question { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.ask-from-question a { white-space: nowrap; }
/* Links that leave the office (GitHub, the web): a small ↗ after the words. */
.ask-ext-mark { margin-left: 2px; font-size: 0.8em; text-decoration: none; display: inline-block; }
/* A long body folds after the first screen, "Show all" opens it (a checkbox: no JavaScript needed). On /act at any
   width; on cards at phone width only. */
.ask-long-more { display: none; margin-top: 6px; width: fit-content; cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; }
.ask-long-hide { display: none; }
.ask-long-toggle:checked ~ .ask-long-more .ask-long-show { display: none; }
.ask-long-toggle:checked ~ .ask-long-more .ask-long-hide { display: inline; }
.ask-long-toggle:focus-visible ~ .ask-long-more { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.ask-long-always .ask-long-toggle:not(:checked) ~ .ask-body { max-height: 20em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
.ask-long-always .ask-long-more { display: block; }
@media (max-width: 640px) {
  .ask-long-phone .ask-long-toggle:not(:checked) ~ .ask-body { max-height: 20em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
  .ask-long-phone .ask-long-more { display: block; }
}
/* A page opened from a question's button: the way back to the question (web.ts questionBanner). */
.question-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 16px; padding: 8px 12px; border: 1px solid var(--violet-bd); border-radius: var(--radius-sm); background: var(--violet-bg); font-size: 13.5px; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.question-banner strong { color: var(--text); font-weight: 600; }
.decide-from { margin: 8px 0 0; }
.md-table-wrap { max-width: 100%; overflow-x: auto; margin: 0 0 0.9em; }
.md-table { border-collapse: collapse; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); color: var(--text); font-weight: 620; }
.md-table .md-al-center { text-align: center; }
.md-table .md-al-right { text-align: right; }
/* Task lists ("- [x] done"): a read-only box in place of the bullet. */
.prose .md-tasks { list-style: none; padding-left: 0.2em; }
.md-task { position: relative; padding-left: 24px; }
.md-task-box { position: absolute; left: 0; top: 0.3em; margin: 0; width: 14px; height: 14px; accent-color: var(--accent-solid); }
/* A question about a brief or report: the document, linked above the question's body. */
.ask-docs { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.ask-doc {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; min-width: 0; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.ask-doc:hover { border-color: var(--accent); background: var(--accent-soft); }
.ask-doc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask-doc-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; }
.ask-doc-icon .icon { width: 17px; height: 17px; }
.ask-doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ask-doc-title { font-weight: 600; font-size: var(--fs-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-doc-meta { font-size: var(--fs-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-doc-go { flex: none; color: var(--accent); font-weight: 600; }
.ask-pr { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; vertical-align: baseline; padding: 0 7px 0 6px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; line-height: 20px; text-decoration: none; color: var(--text); background: var(--surface); white-space: nowrap; }
.prose a.ask-pr { text-decoration: none; color: var(--text); }
.ask-pr:hover { border-color: var(--border-hover); }
.ask-pr-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ask-pr-num { font-weight: 620; font-variant-numeric: tabular-nums; }
.ask-pr-state { font-size: 11.5px; font-weight: 620; padding: 0 6px; border-radius: 999px; line-height: 16px; }
.ask-pr-open .ask-pr-state { color: var(--green); background: var(--green-bg); }
.ask-pr-merged .ask-pr-state { color: var(--violet); background: var(--violet-bg); }
.ask-pr-closed .ask-pr-state { color: var(--gray); background: var(--gray-bg); }
.ask-pr-conflict .ask-pr-state { color: var(--red); background: var(--red-bg); }
.ask-refs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.ask-refs-label { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-right: 2px; }
.ask-ref { padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; line-height: 20px; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.ask-ref-plain { color: var(--muted); border-style: dashed; }
/* A long repository name in a pull request chip or reference: ellipsized on a phone (the full name is in the title). */
@media (max-width: 480px) {
  .ask-pr-num { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .ask-ref { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
}
.ask-run { margin: 8px 0 0; }
.ask-holds-up { margin: 0 0 10px; padding: 6px 10px; background: var(--accent-soft); border-radius: var(--radius-sm); color: var(--text-2); overflow-wrap: anywhere; }
.ask-explain { margin: 10px 0 0; font-size: 13px; color: var(--text-2); }
.ask-explain strong { color: var(--text); font-weight: 620; }
.ask-who { margin: 12px 0 0; }
/* What answering does (office/ask-consequence.ts): one plain line, everything the agent may do folded under it. */
.ask-effect { margin: 12px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.ask-effect-line { margin: 0; }
.ask-effect-line strong { color: var(--text); font-weight: 620; }
.ask-effect-more { margin-top: 4px; }
.ask-effect-more > summary { cursor: pointer; width: fit-content; color: var(--accent); font-weight: 550; padding: 2px 0; }
.ask-effect-cant { margin: 4px 0 0; }
.ask-effect-group { margin: 8px 0 0; font-weight: 620; color: var(--text); }
.ask-effect-list { margin: 2px 0 0; padding-left: 18px; }
.ask-effect-list li { margin: 2px 0; }
.ask-dismiss-hint { margin-right: auto; }
.ask-form { margin: 0; }
.ask-form .request-actions { justify-content: flex-end; }
/* "⌘↵ to send" beside a form's main button (app.js writes it; only with a keyboard and room for it). */
/* "⌘↵ to send": under its text box, right-aligned (like the chat composer's "Enter to send"); written by app.js, or by
   the chat island's question card. On the help text's line when the box has one. */
.mod-enter-hint, .field > .mod-enter-hint { display: block; margin: 4px 0 0; font-size: 11.5px; font-weight: 400; line-height: 16px; color: var(--muted); text-align: right; white-space: nowrap; }
.field > .mod-enter-hint { margin-top: -2px; } /* the .field gap already spaces it */
.mod-enter-hint-in-help, .field small .mod-enter-hint-in-help { display: inline; float: right; margin: 0 0 0 12px; line-height: inherit; }
.mod-enter-hint kbd { font-size: 11px; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); font-family: var(--font); }
.mod-enter-hint.is-nudge { color: var(--text-2); }
@media (max-width: 640px), (hover: none) { .mod-enter-hint, .field > .mod-enter-hint, .field small .mod-enter-hint-in-help { display: none; } }
.ask-note { margin-top: 10px; }
.ask-note > summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; padding: 2px 0; width: fit-content; }
.ask-note[open] > summary { margin-bottom: 6px; }
.ask-note textarea { width: 100%; }
.ask-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ask-choice { max-width: 100%; white-space: normal; text-align: left; }
.ask-answer { margin-top: 12px; }
.ask-answer textarea { width: 100%; min-height: 84px; }
.ask-answer-echo { color: var(--text-2); }
.list-main > .ask-decided-meta, .list-main > .ask-answer-echo { white-space: normal; overflow-wrap: anywhere; }
/* Work (routes/work.ts): an item's title and meta are its content, so they wrap; the filter row; the quick filters. */
.list-main > .work-title, .list-main > .work-meta { white-space: normal; overflow-wrap: anywhere; }
.work-filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 8px; }
.work-quick { margin: 0 0 10px; }
.work-quick .work-quick-on { font-weight: 650; text-decoration: underline; }
@media (max-width: 480px) {
  .list-row.work-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 6px; }
  .list-row.work-row > :first-child { grid-row: 1 / span 2; align-self: start; }
  .list-row.work-row > .pill { grid-column: 2; justify-self: start; }
}
/* An office decision's rule: the content itself, so it wraps instead of being cut. */
.list-main > .decision-rule { white-space: normal; overflow-wrap: anywhere; }
/* An office decision's page (/decisions/adr/<n>): where the record lives, set off from it. */
.decision-foot { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.ask-desk { margin-bottom: 20px; }
.ask-desk-all { margin-left: auto; }
.diff { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.diff li { padding: 5px 10px 5px 28px; border-radius: 6px; position: relative; }
.diff li::before { position: absolute; left: 10px; font-weight: 700; font-family: var(--mono); }
.diff-plus { background: var(--green-bg); color: var(--green-ink); }
.diff-plus::before { content: "+"; color: var(--green); }
.diff-minus { background: var(--red-bg); color: var(--red-ink); }
.diff-minus::before { content: "−"; color: var(--red); }
/* A grant that never applied, dropped; a grant of a repository that doesn't exist (proposal-actions.ts). */
.diff-neutral { background: var(--surface-2); color: var(--text-2); }
.diff-neutral::before { content: "·"; color: var(--text-3, var(--text-2)); }
.diff-warn { background: var(--amber-bg); color: var(--amber-ink); }
.diff-warn::before { content: "!"; color: var(--amber-ink); }

/* ---------- hire ---------- */

.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; padding-right: 18px; position: relative; }
.steps li:not(:last-child)::after { content: ""; width: 24px; height: 1px; background: var(--border-strong); margin-left: 6px; }
.steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 650; background: var(--gray-bg); border: 1px solid var(--gray-bd); }
.steps .is-active { color: var(--text); font-weight: 600; }
.steps .is-active span { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--on-accent); }
.steps .is-done span { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.role-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px;
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.role-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); transform: translateY(-1px); }
.role-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em; }
.role-title { font-weight: 650; font-size: 15px; }
.role-desc { color: var(--muted); font-size: 13px; flex: 1; }
.role-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.role-foot > .link { white-space: nowrap; flex-shrink: 0; }
/* "Something else": a role that isn't listed. Not a link itself, so no lift on hover; dashed to read as an open slot. */
.role-card-other { border-style: dashed; background: var(--surface-2); }
.role-card-other:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); transform: none; }
.role-card-other .role-icon { background: var(--gray-bg); color: var(--text-2); font-size: 18px; }
.role-other-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.role-other-actions small { flex-basis: 100%; font-size: 12px; }
.cap-pick { display: flex; flex-direction: column; gap: 8px; }
.cap-pick-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--text); }
.cap-pick-row input { width: auto; height: auto; margin-top: 3px; flex: none; }
.next-steps { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.success { text-align: center; padding: 36px 28px; max-width: 680px; margin: 0 auto; }
.success h1 { font-size: 22px; margin-bottom: 8px; }
.success .diff { text-align: left; margin: 16px 0 20px; }
.success-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--green-bg); color: var(--green); font-size: 24px; font-weight: 800; border: 1px solid var(--green-bd); }

/* ---------- people & account ---------- */

.grants { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.grants > li { display: flex; align-items: center; gap: 6px; }
.grant summary { cursor: pointer; font-weight: 550; font-size: 13px; }
.grant ul { margin: 6px 0 4px; padding-left: 1.1em; }
.grant-block + .grant-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.linked-head { font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
/* Access changes waiting for approval (People): one card per pull request, its people listed; a person's row notes it. */
.pending-people { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pending-people > li { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pending-people > li > div { min-width: 0; overflow-wrap: anywhere; }
.pending-gain { color: var(--green); font-weight: 550; }
.pending-loss { color: var(--red); font-weight: 550; }
.pending-ref { white-space: nowrap; }
.pending-note { margin-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pending-access .request-actions { flex-wrap: wrap; }
.person-pending, .person-pending td { background: var(--amber-bg); }
.person-merged, .person-merged td { background: var(--blue-bg); }
.person-invite-link .copyable { margin: 6px 0 0; padding: 4px 4px 4px 10px; }
.linked-head:first-of-type { margin-top: 4px; }
.linked-list { list-style: none; margin: 0 0 8px; padding: 0; }
.linked-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.linked-row:first-child { border-top: 0; }
.linked-main { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.linked-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 8px 0 4px; }
.linked-add input[type="email"], .linked-add input[name="user_id"] { flex: 1 1 220px; min-width: 0; max-width: 360px; }
.linked-add .field-inline { margin: 0; }
.linked-how { margin: 0; padding-left: 18px; line-height: 1.6; }
.copyable { min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 8px 8px 12px; margin: 10px 0 14px; }
.copyable code { flex: 1; min-width: 0; background: none; border: 0; padding: 0; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }
.copyable-multi code { white-space: pre-wrap; overflow-wrap: anywhere; }
.token-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.token-form .field { flex: 1; min-width: 260px; }
.note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- audit & settings ---------- */

.chain { display: flex; align-items: center; gap: 14px; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; border: 1px solid; }
.chain-ok { background: var(--green-bg); border-color: var(--green-bd); }
.chain-bad { background: var(--red-bg); border-color: var(--red-bd); }
.chain-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.chain-ok .chain-icon { background: var(--surface); color: var(--green); box-shadow: inset 0 0 0 1px var(--green-bd); }
.chain-bad .chain-icon { background: var(--surface); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-bd); }
.chain-text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.chain-text strong { color: var(--text); font-size: 14px; }
.chain-anchor { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; text-align: right; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; }
.check-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; color: #fff; margin-top: 1px; }
.check-ok { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px var(--green-bd); }
.check-bad { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-bd); }
.check-warn { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber-bd); }
.check-todo { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.check-label { font-weight: 600; }
.check-fix { margin: 6px 0 4px; }
.check .copyable { margin: 6px 0; }
.check-who { font-weight: 400; color: var(--text-2); }
.check .pill { vertical-align: middle; }
/* A check's text column may hold a command to copy (Readiness): it scrolls in its own box instead of widening the card. */
.check > div { flex: 1; min-width: 0; }
.problems { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

/* ---------- mail thread ---------- */

.thread { padding: 0; }
.thread-msg { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.thread-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.thread-reply { padding: 16px 20px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- auth pages ---------- */

.auth-body { background: radial-gradient(1200px 600px at 30% -10%, var(--auth-glow) 0%, var(--bg) 60%); }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 48px; max-width: 1120px; margin: 0 auto; padding: 40px 32px; }
.auth-main { display: flex; flex-direction: column; align-items: center; }
.auth-hero { max-width: 460px; justify-self: end; }
.auth-product { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.product-logo { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-solid); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.product-logo svg { width: 18px; height: 18px; }
.auth-pitch { font-size: 32px; line-height: 1.15; font-weight: 720; letter-spacing: -0.025em; margin: 22px 0 12px; color: var(--text); text-wrap: balance; }
.auth-lede { color: var(--text-2); font-size: 15px; line-height: 1.6; margin: 0 0 28px; max-width: 46ch; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px 30px 26px; }
.auth-card h1 { font-size: 21px; font-weight: 680; margin-bottom: 4px; }
.auth-card > p.muted { margin-bottom: 20px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; margin-bottom: 26px; }
.auth-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.auth-hint a { color: var(--accent); }
.auth-foot { margin-top: 22px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.auth:has(.auth-hero) .auth-foot { display: none; }

/* A decision opened from a notification (/act): the office's name, then the decision. No hero: Approve stays on the
   first screen of a phone, and stays at the bottom of the screen while the person reads a long request. */
.decide-body { background: var(--bg); }
.decide { max-width: 560px; margin: 0 auto; padding: 14px 16px 32px; }
.decide-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--text-2); margin: 0 0 12px; }
.decide-head .office-mark { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.decide-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 18px 18px 16px; min-width: 0; overflow-wrap: anywhere; }
.decide-card h1 { font-size: 19px; line-height: 1.3; font-weight: 680; margin: 0 0 6px; }
.decide-card .ask-kicker { margin-top: 0; }
.decide-card > p.muted { margin: 0 0 14px; }
.decide-what { margin: 0 0 8px; font-weight: 560; }
.decide-echo { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.decide-text { margin-top: 6px; }
.decide-form > p.small { margin: 8px 0 0; }
.decide-text .kv-compact { margin: 10px 0; }
.decide-text .request-args { max-height: 240px; overflow: auto; }
/* A step held mid-run (approval-body.ts heldTool): the whole command, wrapped, never off the edge. */
.request-held-code { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 18em; overflow: auto; margin: 0; }
.request-list { margin: 0; padding-left: 1.1em; }
.decide-actions { position: sticky; bottom: 0; z-index: 2; margin: 12px -18px -16px; padding: 12px 18px 14px; background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 14px 14px; }
.decide-actions .btn { flex: 1; justify-content: center; }
.decide .auth-hint { margin-top: 14px; }
.decide-card .btn-block { margin-top: 12px; }

/* Step-up confirmation (routes/step-up.ts): what will happen, then a passkey, the password or SSO. */
.stepup-detail { margin: 6px 0 10px; }
.stepup-detail .diff { margin: 6px 0 0; }
.stepup-detail > p.small { margin: 0; }
.stepup-form { margin: 12px 0 0; }
.stepup-form .field { margin: 0 0 4px; }
.stepup-form > p.small { margin: 6px 0 0; }
.stepup-error { color: var(--red-ink); margin: 6px 0 8px; }
.stepup-warning { margin: 6px 0 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--red-bg); border: 1px solid var(--red-bd); color: var(--red-ink); font-weight: 600; font-size: 13.5px; }
.stepup-says { margin: 8px 0 2px; font-size: 13px; color: var(--text-2); }
.stepup-alt { margin: 12px 0 0; border-top: 1px solid var(--border); padding-top: 10px; }
.stepup-alt > summary { cursor: pointer; font-size: 13.5px; color: var(--text-2); }

/* Sign-in: a known browser, Google, the second step, setting one up (routes/auth.ts, routes/second-step.ts) */
.auth-card .stack + .stack, .auth-card .stack + .btn, .auth-card .btn + .stack, .auth-card .btn-block + .btn-block { margin-top: 10px; }
.auth-known { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, var(--bg)); overflow-wrap: anywhere; }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.google-mark { flex: none; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.setup-choices { display: grid; gap: 10px; margin: 0 0 6px; }
.setup-choice { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; }
.setup-choice .btn { margin-top: 6px; }
a.setup-choice:hover { border-color: var(--accent); }
.totp-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 14px; }
.totp-steps > li { padding-left: 2px; }
.totp-qr { margin: 10px 0 6px; }
/* The QR code is for a phone looking at this screen; on the phone itself, the app opens from a button instead. */
@media (min-width: 641px) { .totp-narrow { display: none; } }
@media (max-width: 640px) { .totp-wide { display: none; } }
.totp-open { margin: 10px 0 8px; }
.totp-qr-img { display: block; width: 184px; height: 184px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.totp-manual > summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.totp-key code { font-size: 15px; letter-spacing: 0.06em; overflow-wrap: anywhere; }
.totp-confirm { margin-top: 8px; }
.recovery-codes { list-style: none; padding: 12px; margin: 10px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius-sm); }
.recovery-codes code { font-size: 14.5px; letter-spacing: 0.04em; }
.recovery-actions { display: flex; gap: 8px; margin: 0 0 14px; }
/* Account → Two-step sign-in */
.twostep-list { list-style: none; margin: 4px 0 12px; padding: 0; }
.twostep-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.twostep-row:last-child { border-bottom: 1px solid var(--border); }
.twostep-row > div { min-width: 0; overflow-wrap: anywhere; }

/* Account → Passkeys */
.passkey-nudge { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--blue-bg); border: 1px solid var(--blue-bd); color: var(--blue-ink); font-size: 13.5px; }
.passkey-list { list-style: none; margin: 0 0 12px; padding: 0; }
.passkey-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.passkey-row:last-child { border-bottom: 1px solid var(--border); }
.passkey-main { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.passkey-rename > summary { list-style: none; }
.passkey-rename > summary::-webkit-details-marker { display: none; }
.passkey-rename[open] { flex-basis: 100%; order: 3; }
.passkey-rename .inline-form { display: flex; gap: 8px; margin-top: 6px; }
.passkey-rename input { flex: 1; min-width: 0; }
.passkey-hint { margin-left: auto; display: block; text-align: right; line-height: 1.6; }
.passkey-hint .link { margin: 0 4px; }
.passkey-hint .inline-form { display: inline; }
@media (max-width: 600px) { .passkey-hint { margin-left: 0; flex-basis: 100%; text-align: left; } }
.passkey-rename .inline-form .btn-ghost { flex: none; }

/* The hero illustration: an office drawn with theme tokens (the floor's status language). */
.hero-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 28px color-mix(in srgb, var(--text) 8%, transparent)); }
.ha-floor { fill: var(--surface); stroke: var(--border); }
.ha-zone { fill: color-mix(in srgb, var(--accent) 6%, var(--surface)); stroke: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.ha-zone-2 { fill: color-mix(in srgb, var(--green-fill) 6%, var(--surface)); stroke: color-mix(in srgb, var(--green-fill) 24%, var(--surface)); }
.ha-zone-label { font: 700 9.5px var(--font); letter-spacing: 0.1em; fill: var(--accent); }
.ha-zone-label-2 { fill: var(--green); }
.ha-desk { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.ha-screen { fill: color-mix(in srgb, var(--text) 40%, var(--surface)); }
.is-working .ha-screen { fill: var(--accent-solid); }
.ha-ring { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.is-working .ha-ring { stroke: var(--blue-fill); stroke-width: 2.4; animation: ha-breathe 2.4s var(--ease-out) infinite; transform-box: fill-box; transform-origin: center; }
.ha-initials { font: 700 10.5px var(--font); fill: #fff; }
.av-fill-0 { fill: #4f46e5; } .av-fill-2 { fill: #059669; } .av-fill-3 { fill: #ea580c; } .av-fill-5 { fill: #7c3aed; }
.ha-trail { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 4 5; opacity: 0.45; }
.ha-mail rect { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.ha-mail path { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.ha-mail { animation: ha-float 3.2s ease-in-out infinite; }
.ha-badge circle { fill: var(--red-solid); stroke: var(--surface); stroke-width: 2; }
.ha-badge text { font: 800 10px var(--font); fill: #fff; }
@keyframes ha-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.6; } }
@keyframes ha-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 24px; padding: 28px 16px; align-content: start; }
  .auth-hero { justify-self: center; text-align: left; width: 100%; max-width: 400px; }
  .auth-pitch { font-size: 24px; margin: 16px 0 8px; }
  .auth-lede { font-size: 14px; margin-bottom: 0; }
  .hero-art { display: none; }
  .auth-card { padding: 24px 20px 22px; }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .desk-grid { grid-template-columns: 1fr; }
  .stats-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .app { background: var(--bg); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .sidebar-toggle-form { display: none; }
  .nav-burger { display: flex; flex-direction: column; gap: 4px; padding: 8px; margin-left: -8px; cursor: pointer; }
  .nav-burger span { width: 18px; height: 2px; background: var(--text-2); border-radius: 1px; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .topbar-user-text { display: none; }
  .topbar-search input { width: 130px; }
  .table th:nth-child(n+5), .table td:nth-child(n+5) { display: none; }
  /* .table-stack: on phones each row becomes a small block (first cell + .stack-end on one line,
     .stack-full cells on their own line, .stack-meta muted, .stack-push pushed right). */
  .table.table-stack { min-width: 0 !important; }
  .table-stack thead { display: none; }
  .table-stack tbody { display: block; }
  .table-stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table.table-stack td:nth-child(n) { display: block; padding: 0; border: 0; min-width: 0; }
  .table.table-stack td:empty { display: none; }
  .table-stack td:first-child { order: -2; }
  .table-stack td.stack-end { order: -1; margin-left: auto; }
  .table-stack td.stack-full { flex-basis: 100%; max-width: 100%; }
  .table-stack .copyable { margin: 4px 0; }
  .table-stack td:first-child.stack-full { flex-basis: calc(100% - 120px); flex-grow: 1; }
  .table-stack td.stack-meta { font-size: 12.5px; color: var(--muted); }
  .table-stack td.stack-full.num { text-align: left; }
  .table-stack td.stack-push { margin-left: auto; }
  .table.table-stack td.stack-hide, .table.table-stack td:nth-child(n+5):not(.stack-push):not(.stack-end) { display: none; }
  .table-stack .stack-label { display: inline; }
  .table-stack tr.row-link:hover { background: var(--surface-2); }
  .table-stack tr.row-link:hover td { background: none; }
  .request-actions { flex-wrap: wrap; }
  .request-actions .small { flex-basis: 100%; }
  .request-actions .small + .btn, .request-actions .small + form { margin-left: auto; }
  /* the note takes its own line on a phone, so its placeholder isn't cut; the buttons follow, on the right */
  .request-actions > input[name="note"] { flex-basis: 100%; }
  .request-actions > input[name="note"] + .btn { margin-left: auto; }
  /* list rows with a pill and a time: the pill drops under the time so the subject gets the width */
  .list-row:has(> .list-time) { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; }
  .list-row:has(> .list-time) > :first-child { grid-row: 1 / span 2; align-self: center; }
  .list-row:has(> .list-time) > .list-main { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .list-row:has(> .list-time) > .list-time { grid-column: 3; grid-row: 1; width: auto; }
  .list-row:has(> .list-time) > .pill { grid-column: 3; grid-row: 2; justify-self: end; }
  .list-mail .list-subject { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  /* Other tables never get clipped: their card scrolls sideways instead. */
  .card-flush, .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-flush > .table, .table-scroll > .table { min-width: 520px; }
  .truncate { max-width: 26ch; }
  .topbar-office, .topbar-office + .topbar-sep { display: none; }
  .nav-item { padding: 10px 12px; }
  .nav-toggle:focus-visible ~ .main .nav-burger { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
  .filters { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .filters .field-inline { display: grid; grid-template-columns: 64px 1fr; }
  .filters select, .filters input { width: 100%; min-width: 0; }
  .filters > .btn { justify-self: start; }
  .token-form .field { min-width: 0; }
  .token-form { flex-direction: column; align-items: stretch; }
  .token-form .field-inline { flex-direction: column; align-items: stretch; }
  .desk-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; align-items: start; }
  .desk-head .page-actions { grid-column: 1 / -1; }
  .desk-head .page-actions > .btn-primary { flex: 1; justify-content: center; }
  .desk-head h1 { font-size: 22px; }
  .desk-meta { gap: 6px 12px; }
  .chain { flex-wrap: wrap; }
  .chain-anchor { align-items: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.card-pad-x { padding: 0 20px 12px; margin: 0; }

/* ---------- floor card links + chat entry points (chat lane) ---------- */
.agent-card { position: relative; }
.agent-card-link { color: inherit; display: block; }
.agent-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.agent-card-link:focus-visible { outline: none; }
.agent-card:has(.agent-card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-card-chat { position: relative; z-index: 1; gap: 5px; }
.icon-sm { width: 15px; height: 15px; flex: none; }
.btn .icon-sm { margin-left: -2px; }
.desk-chats .card-head { align-items: center; }
.desk-chats .btn { gap: 6px; }
.desk-chats-foot { padding-top: 10px; }
.page-actions .btn { gap: 6px; }
.content-fill { max-width: none; padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.content-fill > .flash { margin: 12px 20px 0; }
.content-fill > [data-island="chat"] { flex: 1; min-height: 0; display: flex; }
.page-fill .main { height: 100vh; height: 100dvh; min-height: 0; }
body.page-fill { height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.page-fill .app { height: 100vh; height: 100dvh; min-height: 0; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 6px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.release-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--border); border-left: 3px solid var(--accent-solid); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; }
.release-banner form { margin-left: auto; }
/* The office won't come back on its own (server/web.ts supervisionBanner): what, who fixes it, the command, then Remind me / Don't show again. */
.supervision-banner { display: flex; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--amber-bd); border-left: 3px solid var(--amber-fill); border-radius: var(--radius-sm); background: var(--amber-bg); color: var(--amber-ink); font-size: 14px; line-height: 1.5; }
.supervision-banner-text { flex: 1 1 420px; min-width: 0; }
.supervision-banner-text p { margin: 0 0 6px; }
.supervision-banner-text .copyable { margin: 0 0 6px; }
.supervision-banner-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
/* A newer release (routes/upgrade.ts): one line on Today, a block inside Settings → This release. */
.upgrade-line { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--border); border-left: 3px solid var(--accent-solid); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; }
.upgrade-line-today { margin-bottom: 16px; }
.upgrade-line-settings { margin-top: 10px; padding: 10px 12px; font-size: 13px; }
.upgrade-line-today-side { margin-bottom: 16px; padding: 12px 14px; border-left-width: 1px; border-radius: var(--radius); font-size: 13px; }
.upgrade-line-today-side .upgrade-line-dismiss { margin-left: 0; }
.upgrade-line-text { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.upgrade-line-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upgrade-line-dismiss { margin-left: auto; }
.upgrade-check { margin-top: 8px; }
.upgrade-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.upgrade-step-done { color: var(--green-ink); }
.upgrade-step-now { font-weight: 600; }
.upgrade-step-next { color: var(--muted); }
.upgrade-breaking { margin: 10px 0; padding: 10px 12px; background: var(--red-bg); border: 1px solid var(--red-bd); border-left: 3px solid var(--red-solid); border-radius: var(--radius-sm); }
.upgrade-breaking ul { margin: 6px 0 0; padding-left: 18px; }
.upgrade-confirm { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 10px; }
.upgrade-result { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.upgrade-result-good { background: var(--green-bg); border-color: var(--green-bd); color: var(--green-ink); }
.upgrade-result-bad { background: var(--red-bg); border-color: var(--red-bd); color: var(--red-ink); }
.upgrade-log { margin-bottom: 10px; font-size: 13px; }
.upgrade-log > summary { cursor: pointer; }
.upgrade-log pre { max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.upgrade-line-bad { border-left-color: var(--red-solid); }
.upgrade-by-hand > summary { cursor: pointer; font-weight: 600; }
.upgrade-by-hand[open] > summary { margin-bottom: 10px; }
.mini-head { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.auto-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.auto-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.auto-list code { overflow-wrap: anywhere; }
.auto-note summary { cursor: pointer; list-style: none; }
.auto-note summary::-webkit-details-marker { display: none; }
.auto-note[open] summary { display: none; }
.feedback-rating { margin-bottom: 4px; }
.feedback-rating .segmented-item { white-space: nowrap; gap: 6px; padding: 0 8px; }
.feedback-rating input { margin: 0; padding: 0; flex: none; }
.feedback-rating .segmented-item:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.feedback-rating .segmented-item:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.feedback .check-inline { display: flex; align-items: flex-start; gap: 8px; }
.feedback .check-inline input { margin: 3px 0 0; flex: none; }
.feedback-notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }

/* Evals (desk card, eval run page, policy PR card) */
.eval-pr + .eval-pr { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.eval-pr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.eval-scores td, .eval-scores th { padding: 6px 8px; }
.eval-delta { margin: 8px 0; }
.eval-pr-case { margin: 10px 0; }
.eval-checks { gap: 8px; margin: 8px 0; }
.eval-case { margin: 8px 0; }
.eval-case > summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Graduated autonomy (routes/autonomy.ts) */
.text-amber { color: var(--amber); }
textarea.mono, .mono { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12.5px; }
/* Rows that say something long (a temporary access and when it ends, a grant under review): it reads in full, and on a
   narrow screen what sits beside it ("who can end it early", End now, Remove / Keep) moves below instead of squeezing
   it into one word per line. */
.list-wrap .list-row { flex-wrap: wrap; row-gap: 6px; }
.list-wrap .list-main { flex: 1 1 200px; overflow-wrap: anywhere; }
.list-wrap .list-main > * { white-space: normal; overflow: visible; text-overflow: clip; }
.list-wrap .window-who { flex: 1 1 220px; min-width: 0; text-align: right; }
@media (max-width: 640px) { .list-wrap .window-who { flex-basis: 100%; text-align: left; } }
.autonomy-list .list-main code { margin-left: 2px; }
.autonomy-list .list-row { align-items: flex-start; }

/* ---------- busy buttons (app.js marks the clicked submit button while its form is on its way) ---------- */
form[data-busy] [aria-disabled="true"] { pointer-events: none; }
.btn.is-busy, .btn.is-busy[aria-disabled="true"] { opacity: 1; cursor: progress; justify-content: center; }
.btn.is-busy.btn-primary { background: var(--accent-solid-hover); }
.btn-spinner {
  width: 13px; height: 13px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: ao-spin 0.7s linear infinite;
}
@keyframes ao-spin { to { transform: rotate(360deg); } }

/* ---------- Needs you: jump bar (the same sections and counts as the nav badge) ---------- */
.needs-jump { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: -4px 0 20px; }
.needs-jump-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 550; text-decoration: none; }
.needs-jump-link:hover { border-color: var(--border-strong); }
.needs-jump-link.is-muted { color: var(--muted); font-weight: 500; }
/* A flash moved next to the card a redirect points at (app.js): the result where the person now is. */
.flash-at-target { margin: 0 0 12px; scroll-margin-top: 72px; }
.requests > .flash-at-target { margin: 0; }
.merging-soon { margin: 0 0 12px; }

/* ---------- Needs you: what someone else decides (folded when long) ---------- */
.waiting-others-summary { cursor: pointer; margin-bottom: 10px; }
.waiting-others-summary::marker { color: var(--muted); }
.waiting-others-summary h2 { display: inline; margin: 0 8px 0 2px; font-size: 15px; font-weight: 650; }

/* ---------- office activity indicator (bottom right, every page) ---------- */
.office-activity {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 11px 14px; border-radius: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.35;
  animation: ao-activity-in 0.18s ease-out;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.office-activity-idle { display: none; }
/* Nothing in it to click: clicks go through to the page under it. Over a control (the next card's Approve), app.js
   shrinks it to its icon so the control stays readable; it grows back when the page scrolls clear. */
.office-activity { pointer-events: none; }
.office-activity-compact { padding: 8px; border-radius: 999px; gap: 0; }
@media (max-width: 640px) { .office-activity.office-activity-compact { left: auto; } }
.office-activity-compact .office-activity-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.office-activity-leaving { opacity: 0; transform: translateY(6px); pointer-events: none; }
.office-activity-text { display: flex; flex-direction: column; min-width: 0; }
.office-activity-step { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.office-activity-spinner {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent-solid);
  animation: ao-spin 0.8s linear infinite;
}
.office-activity-icon { display: inline-flex; flex: none; }
.office-activity-icon .icon { width: 18px; height: 18px; }
.office-activity-done { border-color: var(--green-bd); }
.office-activity-done .office-activity-icon { color: var(--green); }
.office-activity-error { border-color: var(--red-bd); }
.office-activity-error .office-activity-icon { color: var(--red); }
@keyframes ao-activity-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .office-activity { left: 12px; right: 12px; bottom: 12px; max-width: none; } }
/* A page that shows the change's progress itself (a connection's setup stepper): the indicator stays out of the way
   (still updated, so its result counts as seen), unless something failed. */
body:has([data-activity-quiet]) .office-activity:not([data-activity="error"]) { display: none; }
@media (prefers-reduced-motion: reduce) {
  /* The global rule stops every animation; a frozen spinner reads as broken, so these keep a slow turn. */
  .btn-spinner, .office-activity-spinner { animation: ao-spin 2s linear infinite !important; }
}

/* ---------- held message (chat and mail): it looked like it held a credential (server/secret-guard.ts) ---------- */
.secret-held { border: 1px solid var(--amber-bd); background: var(--amber-bg); color: var(--amber-ink); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; font-size: 13px; }
.secret-held-text { margin: 0 0 8px; line-height: 1.45; }
.secret-held-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.secret-held .small { margin: 8px 0 0; }

/* ---------- connection access: presets (Read only / Draft / Act), setup checklist, agent "Tools & connections" ---------- */
.access-choice { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
/* One option: the radio and its words (title, description, counts, one line each), then "Show tools" or Act's picker. */
.access-option { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); min-width: 0; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.access-option:hover { border-color: var(--border-hover); }
.access-option-on, .access-option:has(> .access-option-head input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }
.access-option:has(> .access-option-head input:not(:checked)) { border-color: var(--border); box-shadow: none; }
.access-option:has(> .access-option-head input:not(:checked)):hover { border-color: var(--border-hover); }
.access-option-head { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; min-width: 0; }
.access-option-head > input { margin-top: 3px; flex: none; }
.access-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-ui); }
.access-option-text > br { display: none; }
.access-option-title { font-weight: 650; color: var(--text); }
.access-option-title .tag { margin-left: 4px; vertical-align: 1px; }
.access-option-hint { color: var(--muted); font-size: var(--fs-small); }
.access-counts { color: var(--text-2); font-size: var(--fs-small); font-weight: 550; font-variant-numeric: tabular-nums; }
.access-option-note { margin: 0 0 0 23px; }
/* "Show tools": parts (Reads / Waits …), each a set of groups flowing in columns. */
.access-tools { margin-left: 23px; min-width: 0; }
.access-tools > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent); font-size: var(--fs-small); font-weight: 550; list-style: none; border-radius: 4px; }
.access-tools > summary::-webkit-details-marker { display: none; }
.access-tools > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); flex: none; }
.access-tools[open] > summary::before { transform: rotate(45deg); }
.access-tools > summary:hover { color: var(--accent-hover); }
.access-tools > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.access-tools[open] > summary { margin-bottom: 10px; }
.access-part + .access-part { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.access-part-head { margin: 0 0 6px; font-size: var(--fs-small); color: var(--text-2); }
.access-group-name { color: var(--text-2); }
.access-part-n, .access-group-n { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.access-groups { columns: 3 168px; column-gap: 20px; }
.access-group { break-inside: avoid; margin: 0 0 10px; min-width: 0; }
.access-group-head { margin: 0 0 2px; font-size: var(--fs-micro); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.access-group-tools { list-style: none; margin: 0; padding: 0; }
.access-group-tools li { font-size: 12.5px; color: var(--text-2); line-height: 1.45; padding: 1px 0; overflow-wrap: break-word; }
.access-group-tools .access-tool-code { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--faint); background: none; border: 0; padding: 0; }
/* Act: the changes to allow, grouped, with a filter, "Select all" per group and a live count. */
.access-act { margin-left: 23px; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-top: 10px; border-top: 1px solid var(--border); }
.access-option:has(> .access-option-head input:not(:checked)) > .access-act { display: none; }
.access-act-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.access-act-filter { flex: 1 1 200px; max-width: 320px; min-height: 30px; padding: 4px 10px; font-size: var(--fs-ui); }
.access-act-count { font-size: var(--fs-small); font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.access-act-groups { columns: 3 190px; column-gap: 16px; }
.access-act-group { break-inside: avoid; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0 0 10px; padding: 6px 10px 8px; min-width: 0; background: var(--surface-2); }
.access-act-legend { float: left; padding: 0; line-height: 22px; font-size: var(--fs-micro); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.access-act-all { float: right; border: 0; background: none; padding: 0; line-height: 22px; color: var(--accent); font: inherit; font-size: var(--fs-micro); font-weight: 600; cursor: pointer; }
.access-act-all:hover { color: var(--accent-hover); text-decoration: underline; }
.access-act-all:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.access-act-tools { clear: both; list-style: none; margin: 0; padding: 2px 0 0; min-width: 0; }
.access-act-tools label { display: flex; align-items: flex-start; gap: 6px; padding: 2px 0; cursor: pointer; font-size: 12px; min-width: 0; }
.access-act-tools input { margin-top: 2px; flex: none; }
.access-act-tools .access-tool { min-width: 0; overflow-wrap: break-word; line-height: 1.35; }
.access-act-tools .access-tool-name { color: var(--text-2); font-size: 12.5px; }
.access-act-tools .access-tool-code { display: block; background: none; border: 0; padding: 0; color: var(--faint); font-size: 10.5px; line-height: 1.4; }
.access-act-tools label:has(input:checked) .access-tool-name { color: var(--text); font-weight: 600; }
.access-act-none { margin: 0; }
/* Act with nothing ticked: the same as Read only. A plain note while so (gone once a box is ticked, without JS too); red after a refused Save. */
.access-act-empty { margin: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-small); line-height: 1.45; }
.access-act-error { border-color: var(--red-bd); background: var(--red-bg); color: var(--red-ink); font-weight: 550; scroll-margin-top: 120px; }
.access-option-note + .access-act-error { margin-left: 23px; }
.access-act:has(.access-act-tools input:checked) .access-act-empty { display: none; }
.access-form .form-actions { flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.access-agents { display: grid; gap: 8px; }
.access-agent { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.access-agent[open] > .access-agent-head { margin-bottom: 10px; }
.access-agent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; cursor: pointer; min-width: 0; }
.access-agent-sum { flex: 1 1 200px; min-width: 0; }
.access-agent-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 4px 0; }
.access-agent-preset { display: flex; align-items: center; gap: 6px; min-width: 0; }
.access-agent-preset select { max-width: 100%; }
.access-advanced { margin-top: 18px; }
.access-checklist { margin-bottom: 16px; }
.access-checklist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.access-checklist-head::-webkit-details-marker { display: none; }
/* The open/closed state: a chevron that turns down when open (the native marker is hidden above). */
.access-checklist-head::before { content: ""; width: 7px; height: 7px; margin: 0 3px 2px 1px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); flex: none; }
.access-checklist[open] > .access-checklist-head::before { transform: rotate(45deg); margin-bottom: 4px; }
.access-checklist-head:hover::before { border-color: var(--text-2); }
.access-checklist-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.access-checklist-head h2 { font-size: var(--fs-title); margin: 0; }
.access-checklist[open] > .access-checklist-head { margin-bottom: 12px; }
.access-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.access-step { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.access-step-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; font-weight: 800; margin-top: 1px; }
.access-step-done .access-step-mark { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.access-step-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; font-size: 13.5px; }
.access-step-done .access-step-body { color: var(--text-2); }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.access-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.access-row:first-child { border-top: 0; }
.access-row-main { display: flex; flex-direction: column; gap: 3px; flex: 1 1 220px; min-width: 0; }
.access-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.access-row-actions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.access-row-pending { flex-basis: 100%; min-width: 0; }
.access-also { margin-top: 12px; }
.access-also > summary { cursor: pointer; }
.access-also[open] > summary { margin-bottom: 8px; }

/* File pickers (ui.ts fileField). Without JavaScript: the browser's own input, its button styled like a secondary
   button. With app.js (.file-drop-enhanced): a drop zone, then the chosen file with Replace and Remove. */
.file-drop { min-width: 0; }
.file-drop-input { width: 100%; min-height: 0; height: auto; padding: 8px; font-size: 13.5px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.file-drop-input::file-selector-button { margin-right: 12px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); cursor: pointer; }
.file-drop-input::file-selector-button:hover { background: var(--surface-2); }
.file-drop-enhanced .file-drop-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; }
.file-drop-zone, .file-drop-chosen { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.file-drop-zone { border: 1.5px dashed var(--border-strong); cursor: pointer; transition: border-color .15s, background .15s; }
.file-drop-zone:hover { border-color: var(--accent); }
.file-drop-over .file-drop-zone { border-color: var(--accent); background: var(--accent-soft); }
.file-drop-input:focus-visible + .file-drop-zone, .file-drop-input:focus-visible ~ .file-drop-chosen { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.file-drop-chosen { border: 1px solid var(--border); background: var(--surface); }
.file-drop-zone[hidden], .file-drop-chosen[hidden] { display: none; }
.file-drop-icon { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.file-drop-icon svg { width: 18px; height: 18px; }
.file-drop-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13.5px; overflow-wrap: anywhere; }
.file-drop-button { flex: none; pointer-events: none; }
@media (max-width: 640px) {
  .file-drop-zone, .file-drop-chosen { flex-wrap: wrap; padding: 12px; }
  .file-drop-zone .file-drop-text { flex-basis: calc(100% - 46px); }
}

/* A grant's accounts on a mirror (mirrors.ts accountsPicker): on every page an agent's access is chosen. */
.mirror-pick { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 12px 0 0; min-width: 0; }
.mirror-pick legend { font-size: var(--fs-small); font-weight: 600; color: var(--text-2); padding: 0 4px; }
.mirror-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mirror-pick-all { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.mirror-pick-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-ui); }
.mirror-pick-row input { width: auto; height: auto; }

/* Tool review (routes/tool-review.ts): the agent page card, its form and the instructions editor. */
.review-facts { margin: 0; display: grid; gap: 4px; font-size: var(--fs-ui); }
.review-facts dt { color: var(--muted); font-size: 12px; margin-top: 6px; }
.review-facts dt:first-child { margin-top: 0; }
.review-facts dd { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.review-facts dd strong { font-weight: 600; }
.review-facts + p { margin-top: 10px; }
.review-legend { font-weight: 600; font-size: var(--fs-ui); padding: 0; margin-bottom: 6px; }
.review-pickers { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-left: 23px; }
.review-pickers select { max-width: 100%; }
.review-new { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.review-editor { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.review-checks { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; min-width: 0; }
.review-checks > .review-legend { grid-column: 1 / -1; }
.review-check { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: var(--fs-ui); }
.review-check code { overflow-wrap: anywhere; }
.review-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
/* Only the chosen option's pickers, and the new-rules fields only when "Write new rules…" is chosen. */
.access-option:has(> .access-option-head input:not(:checked)) > .review-pickers { display: none; }
.review-newfile { display: grid; gap: 8px; flex-basis: 100%; }
.review-pickers label:has(option[value="_new"]:not(:checked)) + .review-newfile { display: none; }
.review-filters { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 14px; }
.review-filter { font-size: var(--fs-ui); padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); background: var(--surface); text-decoration: none; }
.review-filter:hover { border-color: var(--border-hover); }
.review-filter-on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }

/* Skills (routes/skills.ts, approval-body.ts): the agent card, a skill's page and a proposal's diff. */
.skill-list .list-row { align-items: center; }
.skill-desc { white-space: normal; overflow-wrap: anywhere; }
.skill-uses { white-space: nowrap; }
.skill-list-narrow .list-main { gap: 2px; }
.skill-waiting { color: var(--amber-ink); font-weight: 600; }
.skill-editor { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.skill-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.skill-files { margin: 12px 0 0; }
.skill-remove { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.skill-change + .skill-change { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.skill-change-title { margin: 0 0 4px; font-size: var(--fs-ui); font-weight: 600; }
.skill-diff { list-style: none; margin: 8px 0 0; padding: 6px 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 420px; overflow: auto; }
.skill-diff li { padding: 0 10px 0 24px; position: relative; white-space: pre-wrap; overflow-wrap: anywhere; }
.skill-diff li::before { position: absolute; left: 8px; }
.skill-diff-add { background: var(--green-bg); color: var(--green-ink); }
.skill-diff-add::before { content: "+"; }
.skill-diff-del { background: var(--red-bg); color: var(--red-ink); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red-ink) 40%, transparent); }
.skill-diff-del::before { content: "−"; }
.skill-diff-same { color: var(--text-2); }
.skill-diff-gap { color: var(--muted); }
.skill-stale-note { margin: 4px 0 8px; padding: 8px 10px; background: var(--amber-bg); color: var(--amber-ink); border-radius: var(--radius-sm); }
.skill-history-row summary { list-style: none; cursor: pointer; }
.skill-history-row summary::-webkit-details-marker { display: none; }
.skill-history-row summary .list-main > span:first-child::after { content: " ▸"; color: var(--muted); }
.skill-history-row details[open] summary .list-main > span:first-child::after { content: " ▾"; }
.skill-history-row details > .skill-diff { margin: 0 0 8px; }
.skill-undo { margin: 0 0 12px; }
