/* Recolo additions on top of the vendored Beacon build (css/app.css).
 * Keep this file small: app.css is the zip's compiled output and stays
 * byte-comparable with it, so a new rule belongs here, never there. */

body.nav-open { overflow: hidden; }
@media (max-width: 1023px) {
  body.nav-open #mobile-nav { display: block; }
}

/* Landing prose pages (terms, privacy, changelog) reuse the console's .md. */
.l-prose { max-width: 760px; margin-inline: auto; }
.l-prose h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.l-prose h2 { font-size: 18px; font-weight: 600; margin-top: 28px; margin-bottom: 8px; }
.l-prose p, .l-prose li { font-size: 14px; line-height: 1.75; color: var(--muted-foreground); }
.l-prose ul { list-style: disc; padding-left: 20px; margin: 8px 0; }

/* The mobile scrim ships with `.hidden`; the open state must beat the utility
 * layer, which a layered rule cannot do. Unlayered wins. */
body.sidebar-open #sb-scrim { display: block; }
/* Tailwind v4 composes translate/scale as their own properties, so the zip's
 * `transform: none` open state does not reach them. Reset the property the
 * utility actually writes. */
body.sidebar-open #sidebar { translate: 0 0; }

/* Console: quiet enterprise operations, with signal orange reserved for action. */
.console-body {
  background: var(--background);
  color: var(--foreground);
  caret-color: var(--brand);
  font-size: 14px;
}
.console-body ::selection { background: var(--console-selection-bg); color: var(--console-selection-fg); }
.console-body a { text-underline-offset: 3px; }
.console-body .console-sidebar { background: var(--background-soft); }
.console-brand { border-bottom: 1px solid var(--border); }
.console-edition {
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
  color: var(--muted-foreground);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
}
.console-workspace-context {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
/* Workspace switcher (sidebar header). */
.console-switcher {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.console-switcher:hover,
.console-switcher[aria-expanded="true"] { background: var(--muted); border-color: var(--border); }
.console-switcher-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--muted-2);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
}
.console-switcher-mark-sm { width: 20px; height: 20px; border-radius: 4px; font-size: 10.5px; }
.console-switcher-menu { left: 12px; right: 12px; top: 100%; }
.console-switcher-menu [aria-current="true"] { background: var(--muted); }
.console-context-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border-radius: 7px;
  background: var(--console-context-bg);
  color: var(--console-context-fg);
  font-size: 12px;
  font-weight: 600;
}

.console-topbar { border-bottom: 1px solid var(--border); background: var(--background); }
.console-breadcrumbs { align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 11.5px; }
.console-breadcrumbs a:hover { color: var(--foreground); }
.console-breadcrumb-anchor { color: var(--foreground); font-weight: 600; font-size: 12px; letter-spacing: -0.01em; }
.console-breadcrumbs [aria-current="page"] { color: var(--foreground); font-weight: 500; }
.console-top-search {
  height: 32px;
  width: 210px;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
  text-align: left;
}
.console-top-search span { flex: 1; }
.console-top-search:hover { border-color: var(--border-strong); background: var(--muted-2); color: var(--foreground); }
.console-avatar { border-radius: 4px; background: var(--console-avatar-bg); color: var(--console-avatar-fg); }
.console-main { padding-top: 2px; }
.console-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 0 26px;
}
.console-body .page-title {
  max-width: 30ch;
  color: var(--foreground);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.2;
  text-align: left;
  text-wrap: balance;
}
.console-body .page-sub {
  max-width: 75ch;
  margin: 8px 0 0;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
}
.console-page-actions { display: flex; flex: none; align-items: center; gap: 8px; padding-top: 3px; }
.console-body .card,
.console-body .card-soft {
  border-color: var(--border);
  border-radius: 4px;
  background: var(--card);
  box-shadow: none;
}
.console-body .card > h2:first-child,
.console-body .card > div:first-child > h2:first-child { letter-spacing: -.01em; }
.console-body .btn {
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 550;
  transition: background-color 140ms ease-out, border-color 140ms ease-out, color 140ms ease-out;
}
.console-body .btn-brand { background: var(--brand); color: var(--console-context-fg); box-shadow: none; }
.console-body .btn-brand:hover { background: var(--brand-hover); }
.dark .console-body .btn-brand { color: var(--console-context-fg); }
.console-body .btn-dark { box-shadow: none; }
.console-body .btn-outline { border-color: var(--border-strong); background: var(--card); }
.console-body .btn-outline:hover { border-color: var(--faint); background: var(--muted-2); }
.console-body .icon-btn { border-radius: 4px; }
.console-body .input,
.console-body .select,
.console-body .textarea,
.console-body .form-input {
  min-height: 38px;
  border: 1px solid var(--input);
  border-radius: 4px;
  background: var(--card);
  box-shadow: none;
  color: var(--foreground);
  font-size: 13px;
}
.console-body .form-input { width: 100%; padding: 9px 11px; }
.console-body .form-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; }
.console-body .input:focus,
.console-body .select:focus,
.console-body .textarea:focus,
.console-body .form-input:focus { border-color: var(--ring); outline: 2px solid color-mix(in srgb, var(--ring) 18%, transparent); outline-offset: 1px; }
.console-body :is(input, textarea)::placeholder { color: var(--faint); opacity: 1; }
.console-body .label { font-size: 12px; font-weight: 550; }
.console-body .hint { line-height: 1.5; }
.console-body .kbd { border-radius: 4px; background: var(--card); font-family: "Geist Mono", monospace; }
.console-body .nav-group { padding-top: 22px; padding-bottom: 7px; font-family: "Geist", sans-serif; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.console-body .nav-item { height: 34px; gap: 10px; border-radius: 3px; color: var(--muted-foreground); font-size: 13px; font-weight: 450; }
.console-body .nav-item .nav-ico { color: var(--muted-foreground); width: 15px; height: 15px; }
.console-body .nav-item:hover { background: var(--muted); color: var(--foreground); }
.console-body .nav-item[aria-current="page"] { background: var(--nav-active); color: var(--foreground); font-weight: 550; }
.console-body .nav-item[aria-current="page"]::before { top: 8px; bottom: 8px; left: -12px; width: 2px; background: var(--nav-indicator); }
.console-body .seg { height: 32px; border-radius: 3px; font-size: 12.5px; }
.console-body .seg[aria-current="true"],
.console-body .seg.is-active { background: var(--dark-pill); color: var(--dark-pill-foreground); box-shadow: none; }
.console-body .qpill { border-radius: 5px; }
.console-body .badge { border-radius: 3px; font-size: 11px; font-weight: 550; }
.console-body .pill { height: 20px; border-radius: 4px; font-size: 10px; }
.console-body .micro { color: var(--muted-foreground); font-family: "Geist", sans-serif; font-size: 11px; font-weight: 550; letter-spacing: .01em; text-transform: none; }
.console-body .tbl { font-size: 12.5px; }
.console-body .tbl thead th {
  position: relative;
  height: 36px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--muted-2);
  color: var(--muted-foreground);
  font-family: "Geist", sans-serif;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.console-body .tbl tbody td { height: 54px; padding-top: 12px; padding-bottom: 12px; }
.console-body .tbl tbody tr.row-link:hover { background: var(--muted-2); }
.console-body .menu { border-radius: 10px; }
.console-body .toast { border-radius: 9px; }
.console-summary {
  display: grid;
  grid-template-columns: repeat(var(--stats, 4), minmax(0, 1fr));
  margin-bottom: 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.console-stat { display: block; min-width: 0; padding: 15px 20px 15px 0; border-right: 1px solid var(--border); }
.console-stat:not(:first-child) { padding-left: 20px; }
.console-stat:last-child { border-right: 0; }
a.console-stat:hover { background: var(--muted-2); }
.console-stat-label { display: flex; align-items: center; gap: 7px; color: var(--muted-foreground); font-size: 12px; }
.console-stat-value { display: block; margin-top: 5px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.console-stat-meta { display: block; margin-top: 4px; overflow: hidden; color: var(--muted-foreground); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.console-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.console-section-head h2 { font-size: 13.5px; font-weight: 600; }
.console-section-head p { margin-top: 3px; color: var(--muted-foreground); font-size: 12px; }
.console-resource-name { display: block; color: var(--foreground); font-size: 13px; font-weight: 550; }
.console-resource-id { display: block; margin-top: 2px; color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11px; }
.console-agent-glyph { display: grid; width: 30px; height: 30px; flex: none; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--muted-2); font-size: 15px; }
.console-rail { display: flex; flex-direction: column; gap: 18px; }
.console-rail .card { padding: 18px; }
.console-rail h2 { font-size: 13px; font-weight: 600; }
.console-meta { margin-top: 14px; }
.console-meta > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.console-meta > div:last-child { border-bottom: 0; }
.console-meta dt { color: var(--muted-foreground); font-size: 12px; }
.console-meta dd { overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; }
.console-disclosure { overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: transparent; }
.console-disclosure > summary { display: flex; min-height: 54px; cursor: pointer; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; list-style: none; }
.console-disclosure > summary::-webkit-details-marker { display: none; }
.console-disclosure > summary::after { content: "+"; color: var(--muted-foreground); font-size: 20px; font-weight: 300; }
.console-disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.console-disclosure[open] > summary::after { content: "−"; }
.console-disclosure > summary:hover { background: var(--muted-2); }
.console-disclosure-body { padding: 20px 18px; }
.console-filter-bar { padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.console-filter-bar .input,
.console-filter-bar .select { background: var(--background); }
.console-chart { padding: 20px 0; }
.console-chart h2 { font-size: 13.5px; font-weight: 600; }
.console-chart-bars { justify-content: space-around; }
.console-chart-bars > div { max-width: 56px; }
.console-empty { padding: 42px 20px; text-align: center; }
.console-empty h3 { font-size: 13px; font-weight: 600; }
.console-empty p { max-width: 50ch; margin: 6px auto 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.6; }
.console-inline-links { display: flex; flex-direction: column; margin-top: 12px; }
.console-inline-links a { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 12px; }
.console-inline-links a:last-child { border-bottom: 0; }
.console-inline-links a:hover { color: var(--foreground); }
.console-status { display: inline-flex; align-items: center; gap: 6px; color: var(--console-success); font-size: 12px; }
.console-status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }


/* Resource indexes use rules and alignment, not dashboard cards. */
.workspace-ledger { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 0 0 22px; color: var(--muted-foreground); font-size: 13px; }
.workspace-ledger strong { margin-right: 4px; color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.workspace-ledger-access { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.workspace-ledger code { color: var(--muted-foreground); font-size: 11.5px; }
.workspace-ledger-separator { color: var(--border-strong); }
.resource-section { min-width: 0; margin-top: 28px; border-top: 1px solid var(--border-strong); }
.resource-section-head { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.resource-section-head h2 { color: var(--foreground); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.resource-section-head p { margin-top: 3px; color: var(--muted-foreground); font-size: 12.5px; }
.resource-count { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
.console-body .resource-table { font-size: 13px; }
.console-body .resource-table thead th { height: 34px; padding: 0 16px 0 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.console-body .resource-table tbody td { height: 52px; padding: 10px 16px 10px 0; }
.console-body .resource-table th:last-child,
.console-body .resource-table td:last-child { padding-right: 0; text-align: right; }
/* Narrow screens: the sessions list becomes cards. Cells carry their
   column name in data-label and print it above the value. */
@media (max-width: 720px) {
  .sessions-table thead { display: none; }
  .sessions-table, .sessions-table tbody { display: block; }
  .sessions-table tr.row-link { display: block; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
  .sessions-table tr.day-row { display: block; border: none; }
  .sessions-table td { display: block; width: auto !important; height: auto !important; padding: 3px 12px !important; border: none !important; text-align: left !important; }
  .sessions-table td.session-col { padding-top: 10px !important; }
  .sessions-table tr.row-link > td:last-child { padding-bottom: 10px !important; }
  .sessions-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
}
.resource-primary-link { display: inline-flex; align-items: center; gap: 10px; color: var(--foreground); font-weight: 600; }
.resource-primary-link:hover { color: var(--brand); }
.agent-emoji { width: 22px; flex: none; font-size: 16px; text-align: center; }
.resource-name { display: block; color: var(--foreground); font-weight: 550; }
.resource-code { display: block; color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11.5px; }
.resource-table .resource-code { height: auto; padding: 0; background: transparent; }
.kv-list .resource-code { display: inline; color: var(--foreground); font-size: 12px; }
.plan-table tr.is-current td { background: var(--muted-2); }
.console-body .plan-table tr.is-current td:first-child { padding-left: 12px; }
/* Plain badges flatten inside tables; linked badges (agent names) keep their pill. */
.resource-table td > span.badge-gray { height: auto; padding: 0; background: transparent; color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11.5px; font-weight: 400; }
/* Day dividers inside a table: label only, no row chrome of their own. */
.day-row td { border-bottom: none; padding-bottom: 0; }
.resource-subline { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 11.5px; }
.resource-date { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.resource-empty { color: var(--muted-foreground); }
.row-action { display: inline-grid; width: 30px; height: 30px; cursor: pointer; place-items: center; border-radius: 3px; color: var(--muted-foreground); }
.row-action:hover { background: var(--muted); color: var(--foreground); }
.inline-create { border-bottom: 1px solid var(--border); background: var(--muted-2); }
.inline-create > summary { display: flex; cursor: pointer; align-items: center; gap: 12px; padding: 14px 0; list-style: none; font-size: 13px; font-weight: 550; }
.inline-create > summary::-webkit-details-marker { display: none; }
.inline-create > summary::before { color: var(--brand); content: "+"; font-size: 17px; font-weight: 400; }
.inline-create[open] > summary::before { content: "−"; }
.inline-create-note { color: var(--muted-foreground); font-size: 12px; font-weight: 400; }
.inline-create-body { padding: 4px 0 22px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.workspace-secondary-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 40px; }
.workspace-secondary-grid > *, .workspace-directory-layout > * { min-width: 0; }
.resource-create-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 18px 0 4px; border-top: 1px solid var(--border); }
.api-access-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 36px; padding: 18px 0; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 12.5px; }
.setup-guide { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: center; gap: 32px; padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.setup-guide h2 { font-size: 14px; font-weight: 600; }
.setup-guide p { margin-top: 5px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.6; }
.setup-guide .md-pre { margin: 0; }
.session-source { display: flex; align-items: center; gap: 8px; }
.session-source-meta { display: flex; flex-direction: column; gap: 2px; }
.severity-text { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; text-transform: capitalize; }
.severity-text::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.severity-text[class*="sev-"] { height: auto; padding: 0; background: transparent; font-size: 12px; }
.severity-critical { color: var(--sev-critical-bar); }
.severity-high { color: var(--sev-high-bar); }
.severity-medium { color: var(--sev-medium-bar); }
.severity-low { color: var(--sev-low-bar); }
.severity-info { color: var(--sev-info-bar); }
.analytics-chart { min-width: 0; padding: 22px 0; border-top: 1px solid var(--border-strong); }
.analytics-chart h2 { font-size: 14px; font-weight: 600; }

.workspace-directory-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
.creation-panel { align-self: start; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border-strong); }
.creation-panel h2 { font-size: 14px; font-weight: 600; }
.creation-panel > p { margin-top: 5px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.6; }
.creation-panel form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.creation-panel-note { margin-top: 16px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.6; }
.console-rail .card { padding: 18px 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.session-page .resource-section { border-top-color: var(--border-strong); }

/* Underline tabs for entity pages (agent, project, session, settings). They are
   links, so every tab is a URL and works with JS off. */
.tabs { display: flex; gap: 2px; margin: 0 0 22px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; flex: none; align-items: center; gap: 7px; height: 40px; padding: 0 12px; color: var(--muted-foreground); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--foreground); }
.tab[aria-current="page"] { color: var(--foreground); }
.tab[aria-current="page"]::after { position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand); content: ""; }
.tab:first-child[aria-current="page"]::after { left: 0; }
.tab-count { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tab:focus-visible, .subtab:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; border-radius: 3px; }
/* The first section under a tab bar starts the page: the tab rule is its rule. */
.tabs + .resource-section,
.tabs + :not(.grid) > .resource-section:first-child,
.tabs + :not(.grid) > form > .resource-section:first-child { margin-top: 0; border-top: 0; }
/* Second level inside a tab: quiet text links, never pills. */
.subtabs { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 18px; }
.subtab { padding-bottom: 5px; border-bottom: 1px solid transparent; color: var(--muted-foreground); font-size: 12.5px; font-weight: 500; }
.subtab:hover { color: var(--foreground); }
.subtab[aria-current="page"] { border-bottom-color: var(--foreground); color: var(--foreground); }

/* Entity header: identity on the left, actions on the right, facts underneath. */
.entity-head { display: flex; align-items: flex-start; gap: 16px; padding: 28px 0 18px; }
.entity-mark { display: grid; width: 44px; height: 44px; flex: none; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--muted-2); font-size: 22px; }
.entity-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; color: var(--muted-foreground); font-size: 12.5px; }

/* Server-rendered bar chart: peak-relative heights, one colour per series. */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.bars-col { display: flex; flex: 1 1 0; min-width: 2px; flex-direction: column-reverse; height: 100%; }
.bars-col > span { display: block; width: 100%; }
.bars-col > span:last-child { border-radius: 2px 2px 0 0; }
.bars-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-family: var(--font-mono, monospace); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--muted-foreground); font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
/* Ranked palette for open-ended series (models, agents), from the series tokens. */
.bg-k-0 { background: var(--series-command); }
.bg-k-1 { background: var(--series-tool); }
.bg-k-2 { background: var(--series-prompt); }
.bg-k-3 { background: var(--series-mcp); }
.bg-k-4 { background: var(--series-approval); }
.bg-sev-critical { background: var(--sev-critical-bar); }
.bg-sev-high { background: var(--sev-high-bar); }
.bg-sev-medium { background: var(--sev-medium-bar); }

/* ---------------- Console redesign components ---------------- */
.console-sidebar-footer .nav-item { height: 34px; }
/* A visible label inside .field: centre the chevron on the select, not on
   the label plus the select. */
.field:has(> .label) > .select-chev { top: auto; bottom: 12px; transform: none; }
/* Native controls (date pickers, checkboxes, option lists) follow the theme. */
.dark { color-scheme: dark; }
 /* One or two sentences under a tab bar that say what the tab is for. */
.tab-intro { max-width: 80ch; margin: 0 0 18px; color: var(--muted-foreground); font-size: 13px; line-height: 1.6; }
/* Logs (audit, API calls): a count line with exports, removable filter chips,
   then the table. Actions and links are graphite; orange stays for actions. */
.log-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; color: var(--muted-foreground); font-size: 12.5px; }
.log-meta strong { color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.log-meta-sep { margin: 0 8px; color: var(--border-strong); }
.log-meta-actions { display: flex; align-items: center; gap: 6px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: 3px; background: var(--muted-2); color: var(--foreground); font-size: 12px; }
.filter-chip svg { color: var(--muted-foreground); }
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip:hover svg { color: var(--foreground); }
.date-field { width: 168px; }
.date-field .date-prefix { position: absolute; top: 50%; left: 11px; z-index: 1; transform: translateY(-50%); color: var(--muted-foreground); font-size: 12px; pointer-events: none; }
.date-field .input { padding-left: 46px; font-variant-numeric: tabular-nums; }
.log-table td { vertical-align: top; }
.console-body .log-table tbody td { height: auto; padding-top: 12px; padding-bottom: 12px; }
.log-when { display: block; color: var(--foreground); font-family: "Geist Mono", monospace; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-link { color: var(--foreground); }
.log-link:hover, .log-action:hover { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.log-action { display: block; color: var(--foreground); font-family: "Geist Mono", monospace; font-size: 12px; }
.log-table .severity-text { margin-top: 4px; font-size: 11.5px; }
.log-method { margin-right: 4px; color: var(--muted-foreground); font-weight: 600; }
.log-status { display: inline-flex; margin-top: 0; font-family: "Geist Mono", monospace; font-size: 12px; font-variant-numeric: tabular-nums; }
.log-target { color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11.5px; overflow-wrap: anywhere; }
.log-details { color: var(--foreground); font-size: 12.5px; line-height: 1.55; overflow-wrap: anywhere; }
.log-json summary { display: inline-block; margin-top: 3px; color: var(--faint); font-size: 11px; cursor: pointer; list-style: none; }
.log-json summary::-webkit-details-marker { display: none; }
.log-json summary:hover { color: var(--foreground); }
.log-json pre { margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); font-size: 11px; line-height: 1.55; white-space: pre-wrap; word-break: break-all; }
.console-body .log-table td.log-ip { color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11.5px; text-align: left; }
.console-body .log-table th:last-child { text-align: left; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding-top: 18px; }
.pager-page { display: inline-grid; min-width: 28px; height: 28px; place-items: center; padding: 0 6px; border-radius: 3px; color: var(--muted-foreground); font-size: 12.5px; font-variant-numeric: tabular-nums; }
a.pager-page:hover { background: var(--muted); color: var(--foreground); }
.pager-page[aria-current="page"] { background: var(--nav-active); color: var(--foreground); font-weight: 600; }
.pager-gap { padding: 0 4px; color: var(--faint); }
 /* Role legend: the role over what it can do, one ruled row each. */
.role-list > div { padding: 11px 0; border-bottom: 1px solid var(--border); }
.role-list > div:last-child { border-bottom: 0; }
.role-list dt { color: var(--foreground); font-size: 13px; font-weight: 600; }
.role-list dd { margin: 3px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.55; }
 /* Share dialog on a file page (files/file.html): a native <dialog>, laid out
   like a document app's share sheet. Popover elevation, per DESIGN.md. */
.share-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--foreground); box-shadow: var(--shadow-pop); }
.share-dialog[open]:not(:modal) { position: fixed; inset: 0; z-index: 70; height: fit-content; }
.share-dialog::backdrop { background: rgb(10 12 16 / .38); }
.share-dialog-body { padding: 20px 24px 18px; }
.share-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.share-dialog-head h2 { min-width: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.share-section-label { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.share-access { display: flex; align-items: flex-start; gap: 12px; padding: 0 0 14px; }
/* The access state's mark is a status, so it may be a circle (DESIGN.md). */
.share-access-icon { display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: 50%; background: var(--muted); color: var(--muted-foreground); }
.share-access-icon.is-public { background: var(--foreground); color: var(--background); }
.share-access-title { font-size: 13.5px; font-weight: 550; }
.share-access-sub { margin-top: 2px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.55; }
.share-link-row { display: flex; gap: 6px; margin: 0 0 4px 44px; }
.share-url { flex: 1 1 auto; min-width: 0; background: var(--muted-2); color: var(--foreground); font-family: "Geist Mono", monospace; font-size: 12px; }
.share-link-actions { margin: 0 0 12px 44px; }
.share-text-btn { padding: 0; color: var(--muted-foreground); font-size: 12.5px; cursor: pointer; }
.share-text-btn:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.share-more { border-top: 1px solid var(--border); }
.share-more > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: 13px; font-weight: 550; cursor: pointer; list-style: none; }
.share-more > summary::-webkit-details-marker { display: none; }
.share-more > summary::after { color: var(--muted-foreground); content: "+"; font-size: 17px; font-weight: 300; line-height: 1; }
.share-more[open] > summary::after { content: "−"; }
.share-list { margin: 0 0 10px; padding: 0; list-style: none; }
.share-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.share-id { margin-right: 8px; color: var(--foreground); font-family: "Geist Mono", monospace; font-size: 12px; }
.share-list-facts { color: var(--muted-foreground); }
.share-dialog .share-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 0 0 14px; border-top: 0; }
.share-dialog .share-pin { grid-column: 1 / -1; height: auto; }
.share-form-submit { grid-column: 1 / -1; }
.share-note-quiet { margin: 0; padding: 12px 0; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 12.5px; }
.share-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.share-toasts { position: fixed; bottom: 20px; left: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.share-form { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 240px) auto auto; align-items: end; justify-content: start; gap: 12px 16px; padding: 14px 12px; border-top: 1px solid var(--border); }
.share-pin { height: 40px; }
.share-hint { grid-column: 1 / -1; margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.55; }
 /* A file opened from a public link (files/public_file.html). */
.public-file-head { margin: 0 0 16px; }
.public-file-name { color: var(--foreground); font-family: "Geist Mono", monospace; font-size: 17px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.public-file-meta { margin-top: 6px; color: var(--muted-foreground); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.public-file-foot { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--muted-foreground); font-size: 12px; }
 /* Memory: one row to add (text + button), the optional fields behind
   "More fields"; rows grouped under plain sentence-case headings. */
.memory-add { margin: 0 0 6px; padding: 14px 16px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); }
.memory-add-row { display: flex; gap: 8px; }
.memory-add-row .input { flex: 1 1 auto; min-width: 0; }
.memory-more > summary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; color: var(--muted-foreground); font-size: 12px; cursor: pointer; list-style: none; }
.memory-more > summary::-webkit-details-marker { display: none; }
.memory-more > summary::before { content: "+"; font-size: 14px; line-height: 1; }
.memory-more[open] > summary::before { content: "−"; }
.memory-more > summary:hover { color: var(--foreground); }
.memory-more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 4px 0 12px; }
.memory-more-wide { grid-column: 1 / -1; }
.mem-heading { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border-strong); color: var(--foreground); font-size: 13.5px; font-weight: 600; }
.mem-heading span { color: var(--muted-foreground); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.mem-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.mem-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-radius: 3px; color: var(--muted-foreground); font-family: "Geist Mono", monospace; font-size: 11px; }
.mem-due { color: var(--sev-medium-fg, var(--foreground)); font-weight: 550; }
.mem-filter { display: flex; gap: 4px; margin: 14px 0 4px; }
.console-body .qpill[aria-current="true"] { background: var(--nav-active); color: var(--foreground); }
.console-body .qpill[aria-current="true"]:hover { background: var(--nav-active); color: var(--foreground); }
.todo-check { margin-top: -5px; color: var(--muted-foreground); }
.mem-row.is-done .todo-check { color: var(--console-success); }
.mem-row.is-done .todo-text { color: var(--muted-foreground); text-decoration: line-through; text-decoration-color: var(--faint); }
.mem-row .todo-notes { margin-top: 3px; color: var(--muted-foreground); font-size: 12.5px; white-space: pre-line; }
.todo-edit > summary { display: inline-block; margin-top: 4px; color: var(--muted-foreground); font-size: 12px; cursor: pointer; }
.todo-edit > summary:hover { color: var(--foreground); }
.todo-edit-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 560px; padding: 8px 0 4px; }
.todo-edit-form .field { width: 100%; }
/* An empty section that is one sentence, left-aligned with the content. */
.empty-inline { display: flex; align-items: flex-start; gap: 10px; padding: 14px 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.6; }
.empty-inline svg { flex: none; margin-top: 3px; color: var(--faint); }
.empty-inline strong { color: var(--foreground); font-weight: 550; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.filter-more > summary { list-style: none; }
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 10px; }
.section-label { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 4px; color: var(--faint); font-family: var(--font-mono, monospace); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.section-label span { color: var(--muted-foreground); letter-spacing: 0; }
.notice { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); color: var(--muted-foreground); font-size: 12.5px; }
.notice-warning { border-color: var(--sev-medium-bar, var(--border-strong)); color: var(--foreground); }

/* rows */
.list-row, .feed-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
a.list-row:hover strong, a.list-row:hover span:first-child { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.feed-row { align-items: flex-start; font-size: 12.5px; }
.picker-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); transition: border-color .15s ease, background-color .15s ease; }
.picker-row:hover { border-color: var(--border-strong); background: var(--muted-2); }
.picker-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.picker-item { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.picker-item:hover { background: var(--muted-2); }
.picker-item:hover .resource-name { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.setup-list { margin: 0; padding: 0; list-style: none; }
.setup-list li { border-bottom: 1px solid var(--border); }
.setup-list a { display: flex; flex-direction: column; gap: 2px; padding: 10px 0 10px 32px; font-size: 13px; }
.setup-list li { position: relative; }
.setup-list a span { color: var(--muted-foreground); font-size: 12px; }
.setup-mark { position: absolute; top: 11px; left: 0; display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted-foreground); font-size: 11px; }
.setup-list li.is-done .setup-mark { border-color: var(--console-success); color: var(--console-success); }
.setup-list li.is-done strong { color: var(--muted-foreground); font-weight: 500; }

/* memory */
.mem-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mem-row p { min-width: 0; margin: 0; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.mem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; color: var(--muted-foreground); font-size: 11.5px; }
.mem-time { width: 48px; flex: none; padding-top: 1px; color: var(--faint); font-family: var(--font-mono, monospace); font-size: 11.5px; }
.mem-empty { margin: 4px 0 0; color: var(--muted-foreground); font-size: 12.5px; }

/* documents and files */
.doc-view { max-height: 70vh; margin: 8px 0 0; overflow: auto; padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--muted-2); font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.meter { height: 6px; overflow: hidden; border-radius: 2px; background: var(--muted); }
.meter i { display: block; height: 100%; border-radius: 2px; background: var(--foreground); opacity: .75; }
.meter.is-mid i { background: var(--sev-medium-bar, var(--foreground)); opacity: 1; }
.meter.is-high i { background: var(--sev-high-bar, var(--foreground)); opacity: 1; }
.meter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; padding: 14px 0 4px; }
.kv-list { margin: 8px 0 0; }
.kv-list > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-list dt { color: var(--muted-foreground); }
.kv-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; }
.kv-grid dt { color: var(--muted-foreground); font-size: 11.5px; }
.kv-grid dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
.key-reveal { margin: 0 0 20px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--muted-2); }
.key-reveal h2 { margin: 0; font-size: 14px; font-weight: 600; }
.key-reveal p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 12.5px; }
.scope-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12.5px; cursor: pointer; }
.scope-option:has(input:checked) { border-color: var(--foreground); }
.scope-option strong { margin-right: 4px; font-weight: 600; }
.backup-row { border-bottom: 1px solid var(--border); }
/* Settings › Policies: one form per page, one rule per row in three fixed
   columns (rule | value | scope), so every control starts on the same edge.
   The save bar is the agent profile's (.identity-actions, sticky while dirty). */
.policy-row { display: grid; grid-template-columns: minmax(0, 1fr) 280px 220px; align-items: start; gap: 28px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.policy-row:last-child { border-bottom: 0; }
.policy-row h3 { font-size: 13px; font-weight: 600; line-height: 1.45; }
.policy-help { max-width: 62ch; margin-top: 3px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.55; }
.policy-value { min-width: 0; }
.policy-days { display: flex; align-items: center; gap: 8px; }
.policy-days .field { width: 112px; flex: none; }
.policy-unit { color: var(--muted-foreground); font-size: 12.5px; }
.policy-set { display: flex; flex-direction: column; gap: 9px; padding-top: 2px; }
.policy-check { display: inline-flex; align-items: center; gap: 8px; color: var(--foreground); font-size: 13px; cursor: pointer; }
.policy-check:has(input:disabled) { cursor: default; color: var(--muted-foreground); }
.policy-scope { display: flex; min-height: 38px; flex-direction: column; justify-content: center; align-items: flex-start; gap: 3px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
.policy-scope strong { color: var(--foreground); font-weight: 550; }
.policy-lock { display: inline-flex; align-items: center; gap: 6px; color: var(--foreground); font-weight: 550; }
.policy-lock svg { color: var(--muted-foreground); }
.policy-reset { color: var(--link); font-size: 12.5px; cursor: pointer; }
.policy-reset:hover { text-decoration: underline; text-underline-offset: 2px; }
.policy-row .select:disabled,
.policy-row .input:disabled { cursor: not-allowed; background: var(--muted-2); color: var(--muted-foreground); }
.policy-head { align-items: end; padding: 18px 0 10px; }
.policy-head h2 { color: var(--foreground); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.policy-head span { color: var(--muted-foreground); font-size: 11px; font-weight: 500; }
.policy-readonly { display: flex; min-height: 38px; align-items: center; color: var(--foreground); font-size: 13px; font-weight: 550; }
.backup-head { display: flex; align-items: center; gap: 12px; padding: 12px 0 4px; }
.backup-files-toggle { padding: 0 0 10px; }
.backup-files-toggle > summary { display: inline-block; color: var(--muted-foreground); font-size: 12px; cursor: pointer; }
.backup-files-toggle > summary:hover { color: var(--foreground); }
.backup-files-toggle[open] > summary { margin-bottom: 6px; }
.backup-files { margin: 0; padding: 0 0 0 16px; color: var(--muted-foreground); }
.console-body .integrations-table td:last-child, .console-body .integrations-table th:last-child { text-align: left; }
.danger-zone .resource-section-head h2 { color: var(--sev-high-fg, var(--foreground)); }
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.steps { margin: 8px 0 0; padding-left: 20px; list-style: decimal; font-size: 13px; line-height: 1.9; }
.steps li::marker { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 22px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; }
.layers > div { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-right: 1px solid var(--border); font-size: 12.5px; }
.layers > div:last-child { border-right: 0; }
.layers span { color: var(--muted-foreground); }

/* events */
.event-json summary { cursor: pointer; color: var(--link, var(--foreground)); font-family: var(--font-mono, monospace); font-size: 11.5px; list-style: none; }
.event-json[open] .event-json-body { position: absolute; z-index: 20; right: 24px; max-width: min(720px, 80vw); max-height: 60vh; overflow: auto; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: 0 12px 32px -16px rgb(20 23 28 / .35); }
.tool-io summary { cursor: pointer; max-width: 520px; }

/* ---------------- File page (GitHub-style) ---------------- */
.gh-file { padding-top: 4px; }
.gh-pathbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.gh-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 15px; }
.gh-path a { color: var(--link, var(--foreground)); }
.gh-path a:hover { text-decoration: underline; text-underline-offset: 2px; }
.gh-path strong { font-weight: 600; }
.gh-sep { padding: 0 4px; color: var(--faint); }
.gh-path-actions { display: flex; gap: 6px; }
.gh-path-new { flex: 1 1 auto; min-width: 0; }
.gh-path .gh-name-input { width: auto; min-width: 200px; flex: 0 1 380px; height: 32px; margin-left: 2px; font-family: var(--font-mono, monospace); font-size: 13px; }
.gh-path a[href] strong { color: var(--foreground); }
.gh-path-actions [aria-current="page"] { border-color: var(--foreground); }
.gh-box { overflow: hidden; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); }
.gh-box-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--border-strong); background: var(--muted-2); }
.gh-box-tools { display: flex; align-items: center; gap: 4px; }
.gh-status { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
.gh-status.is-dirty { color: var(--foreground); }
.gh-seg { display: inline-flex; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 6px; }
.gh-seg-item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-right: 1px solid var(--border-strong); background: transparent; color: var(--muted-foreground); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.gh-seg-item:last-child { border-right: 0; }
.gh-seg-item:hover { color: var(--foreground); }
.gh-seg-item[aria-current="page"], .gh-seg-item[aria-selected="true"] { background: var(--card); color: var(--foreground); box-shadow: inset 0 -2px 0 var(--brand); }
.gh-danger:hover { color: var(--sev-high-fg); }
.gh-empty { margin: 0; padding: 28px 16px; color: var(--muted-foreground); font-size: 13px; text-align: center; }
.gh-hint { color: var(--faint); font-size: 12px; }
.gh-avatar { display: inline-grid; width: 22px; height: 22px; flex: none; place-items: center; border-radius: 50%; background: var(--foreground); color: var(--background); font-size: 10.5px; font-weight: 600; }

/* latest version bar */
.gh-commitbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); font-size: 13px; }
.gh-commitbar-note { margin-left: 6px; color: var(--muted-foreground); }
.gh-commitbar-note:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.gh-commitbar-meta { color: var(--muted-foreground); font-size: 12px; }
.gh-sha { color: var(--muted-foreground); font-family: var(--font-mono, monospace); font-size: 12px; }
.gh-sha:hover { color: var(--foreground); }
.gh-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--muted-2); font-size: 13px; }

/* code view with line anchors */
.gh-code { width: 100%; border-collapse: collapse; font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 20px; tab-size: 4; }
.gh-code td { padding: 0; vertical-align: top; }
.gh-num { width: 1%; min-width: 52px; padding: 0 12px 0 16px !important; color: var(--faint); text-align: right; user-select: none; white-space: nowrap; }
.gh-num a { color: inherit; }
.gh-num a:hover { color: var(--foreground); }
.gh-line { padding: 0 16px 0 10px !important; white-space: pre-wrap; overflow-wrap: anywhere; }
.gh-code tr:first-child td { padding-top: 10px !important; }
.gh-code tr:last-child td { padding-bottom: 10px !important; }
.gh-code tr:target { background: var(--brand-soft, var(--muted)); }
.gh-code tr:target .gh-num { color: var(--foreground); }

/* syntax colours (Pygments short classes), from the series tokens so both themes work */
.gh-line .k, .gh-line .kc, .gh-line .kd, .gh-line .kn, .gh-line .kp, .gh-line .kr, .highlight .k, .highlight .kd, .highlight .kn { color: var(--series-prompt); }
.gh-line .kt, .gh-line .nb, .gh-line .nf, .gh-line .nc, .highlight .nf, .highlight .nb { color: var(--series-command); }
.gh-line .s, .gh-line .s1, .gh-line .s2, .gh-line .sb, .gh-line .sd, .gh-line .sh, .gh-line .sx, .gh-line .sr, .gh-line .ss, .highlight .s, .highlight .s1, .highlight .s2 { color: var(--series-tool); }
.gh-line .c, .gh-line .c1, .gh-line .cm, .gh-line .cp, .gh-line .cs, .gh-line .ch, .highlight .c, .highlight .c1 { color: var(--faint); }
.gh-line .m, .gh-line .mi, .gh-line .mf, .gh-line .mh, .gh-line .l, .highlight .m, .highlight .mi { color: var(--series-mcp); }
.gh-line .nt, .gh-line .na, .highlight .nt, .highlight .na { color: var(--series-command); }
.gh-line .gh, .gh-line .gu { color: var(--series-command); font-weight: 600; }
.gh-line .gs { font-weight: 700; }
.gh-line .ge { font-style: italic; }
.gh-line .gd { color: var(--sev-high-fg); }
.gh-line .gi { color: var(--console-success); }

/* markdown preview */
.markdown-body { padding: 24px 32px 28px; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
/* Markdown inside a list or a message: no box padding, a smaller scale. */
.markdown-compact { padding: 0; font-size: 13.5px; line-height: 1.6; white-space: normal; }
/* Compact Markdown sits inline (a thread reply, a memory line): the phone-width
   .markdown-body padding below must not indent it. */
.markdown-body.markdown-compact { padding: 0; }
.markdown-compact > :last-child { margin-bottom: 0; }
.markdown-compact h1 { font-size: 18px; } .markdown-compact h2 { font-size: 16px; } .markdown-compact h3 { font-size: 14.5px; }
.markdown-compact h1, .markdown-compact h2 { margin: 16px 0 8px; }
.mem-row code, .tbl td code { padding: 1px 5px; border-radius: 4px; background: var(--muted); font-family: var(--font-mono, monospace); font-size: 12px; }
.mem-row a { text-decoration: underline; text-underline-offset: 2px; }
.markdown-body h1, .markdown-body h2 { margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-weight: 600; letter-spacing: -.01em; }
.markdown-body h1 { font-size: 24px; }
.markdown-body h2 { font-size: 19px; }
.markdown-body h3 { margin: 20px 0 8px; font-size: 16px; font-weight: 600; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body blockquote, .markdown-body table, .markdown-body pre { margin: 0 0 14px; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li + li { margin-top: 3px; }
.markdown-body li.task { list-style: none; margin-left: -20px; }
.markdown-body li.task input { margin-right: 6px; vertical-align: -1px; }
.markdown-body a { color: var(--link, var(--brand)); text-decoration: underline; text-underline-offset: 2px; }
.markdown-body code { padding: 1px 5px; border-radius: 4px; background: var(--muted); font-family: var(--font-mono, monospace); font-size: 12.5px; }
.markdown-body pre { overflow: auto; padding: 14px 16px; border-radius: 6px; background: var(--muted-2); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.6; }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body blockquote { padding: 0 14px; border-left: 3px solid var(--border-strong); color: var(--muted-foreground); }
.markdown-body hr { margin: 22px 0; border: 0; border-top: 1px solid var(--border); }
.markdown-body table { display: block; width: max-content; max-width: 100%; overflow: auto; border-collapse: collapse; }
.markdown-body th, .markdown-body td { padding: 6px 12px; border: 1px solid var(--border); }
.markdown-body th { background: var(--muted-2); font-weight: 600; }

/* diffs */
.gh-diffstat { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border-strong); background: var(--muted-2); color: var(--muted-foreground); font-size: 12.5px; }
.gh-add { color: var(--console-success); font-weight: 600; }
.gh-del { color: var(--sev-high-fg); font-weight: 600; }
.gh-diff { width: 100%; border-collapse: collapse; font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 20px; }
.gh-diff td { padding: 0; vertical-align: top; }
.gh-diff .gh-num { min-width: 44px; padding: 0 8px !important; border-right: 1px solid var(--border); }
.gh-diff .gh-line { padding: 0 12px !important; white-space: pre-wrap; }
.gh-sign { display: inline-block; width: 16px; color: var(--faint); user-select: none; }
.gh-hunk td { padding: 4px 12px !important; background: var(--muted); color: var(--muted-foreground); }
.gh-row-add { background: color-mix(in srgb, var(--console-success) 12%, transparent); }
.gh-row-add .gh-sign { color: var(--console-success); }
.gh-row-del { background: color-mix(in srgb, var(--sev-high-bar) 12%, transparent); }
.gh-row-del .gh-sign { color: var(--sev-high-fg); }

/* history */
.gh-history { max-width: 1100px; }
.gh-history-day { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; color: var(--muted-foreground); font-size: 12.5px; font-weight: 500; }
.gh-history-day:first-child { margin-top: 0; }
.gh-history-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border-strong); border-bottom-width: 0; background: var(--card); }
.gh-history-day + .gh-history-row { border-top-left-radius: 6px; border-top-right-radius: 6px; }
.gh-history-row:has(+ .gh-history-day), .gh-history-row:has(+ .gh-hint) { border-bottom-width: 1px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
.gh-history-text { min-width: 0; flex: 1 1 0; }
.gh-history-title { font-size: 13.5px; font-weight: 600; }
.gh-history-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.gh-history-meta { margin: 2px 0 0; color: var(--muted-foreground); font-size: 12px; }
.gh-delta { min-width: 72px; color: var(--muted-foreground); font-family: var(--font-mono, monospace); font-size: 12px; text-align: right; }

/* form fields (templates/_fields.html) */
.set-row { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 8px 40px; padding: 22px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { padding-top: 6px; border-top: 0; }
.set-label { display: block; font-size: 13px; font-weight: 600; color: var(--foreground); }
.set-optional { margin-left: 4px; color: var(--faint); font-size: 11.5px; font-weight: 450; }
.set-help { margin: 5px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.5; }
.set-row-control { min-width: 0; }
.field-grow { min-height: 0; line-height: 1.55; resize: vertical; }
.field-count { margin: 5px 0 0; color: var(--faint); font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }
.field-count.is-low { color: var(--sev-high-fg); }
.md-field { overflow: hidden; border: 1px solid var(--input); border-radius: 8px; background: var(--card); }
.md-field:focus-within { border-color: var(--ring); }
.md-field-head { display: flex; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--muted-2); }
.md-field-input { display: block; width: 100%; min-height: 132px; padding: 10px 12px; border: 0; background: transparent; color: var(--foreground); font-size: 13.5px; line-height: 1.6; resize: vertical; }
.md-field-input:focus { outline: none; }
.md-field-preview { min-height: 132px; padding: 12px 14px; }
.md-field-foot { margin: 0; padding: 6px 12px; border-top: 1px solid var(--border); color: var(--faint); font-size: 11.5px; }
.tag-field-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); cursor: text; }
.tag-field-box:focus-within { border-color: var(--ring); }
.tag-chip { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 3px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--muted-2); color: var(--foreground); font-size: 12px; font-weight: 500; }
.tag-chip button { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: var(--muted-foreground); font-size: 14px; line-height: 1; }
.tag-chip button:hover { background: var(--muted); color: var(--foreground); }
.tag-field-input { flex: 1 1 140px; min-width: 120px; height: 26px; border: 0; background: transparent; color: var(--foreground); font-size: 13px; }
.tag-field-input:focus { outline: none; }

/* agent identity */
.identity-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 40px; align-items: start; }
.identity-form fieldset { min-width: 0; }
.identity-name { display: flex; gap: 8px; }
.identity-name .input:last-child { flex: 1; }
/* emoji picker (ui/assets/js/emoji-picker.js) */
.emoji-field { position: relative; flex: none; }
.emoji-field-input { width: 56px; padding: 0; font-size: 18px; text-align: center; }
.emoji-trigger { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--input); border-radius: 8px; background: var(--card); color: var(--muted-foreground); }
.emoji-trigger:hover { background: var(--muted-2); color: var(--foreground); }
.emoji-trigger[aria-expanded="true"] { border-color: var(--ring); }
.emoji-trigger-char { font-size: 21px; line-height: 1; }
.emoji-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; display: flex; width: min(352px, calc(100vw - 32px)); height: 424px; flex-direction: column; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--card); box-shadow: var(--shadow-pop); }
.emoji-pop-top { display: flex; gap: 6px; padding: 10px 10px 6px; }
.emoji-search { position: relative; display: flex; flex: 1; align-items: center; }
.emoji-search svg { position: absolute; left: 9px; color: var(--faint); pointer-events: none; }
.emoji-search input { width: 100%; height: 32px; padding: 0 10px 0 28px; border: 1px solid var(--input); border-radius: 7px; background: var(--background); color: var(--foreground); font-size: 13px; }
.emoji-search input:focus { border-color: var(--ring); outline: none; }
.emoji-tone-btn { width: 32px; height: 32px; flex: none; border: 1px solid var(--input); border-radius: 7px; font-size: 16px; }
.emoji-tone-btn:hover { background: var(--muted-2); }
.emoji-tones { display: flex; justify-content: flex-end; gap: 2px; padding: 0 10px 6px; }
.emoji-tones button { width: 30px; height: 30px; border-radius: 6px; font-size: 17px; }
.emoji-tones button:hover, .emoji-tones [aria-checked="true"] { background: var(--muted); }
.emoji-cats { display: flex; justify-content: space-between; padding: 0 8px; border-bottom: 1px solid var(--border); }
.emoji-cats button { display: grid; width: 30px; height: 32px; place-items: center; border-bottom: 2px solid transparent; color: var(--muted-foreground); font-size: 16px; filter: grayscale(1); opacity: .6; }
.emoji-cats button:hover { opacity: 1; filter: none; }
.emoji-cats [aria-current="true"] { border-bottom-color: var(--foreground); opacity: 1; filter: none; }
.emoji-cats.is-searching button { opacity: .35; }
.emoji-scroll { flex: 1; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.emoji-scroll h4 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 4px 4px; background: var(--card); color: var(--muted-foreground); font-size: 11.5px; font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); }
.emoji-cell { display: grid; aspect-ratio: 1; place-items: center; border-radius: 6px; font-size: 22px; line-height: 1; }
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--muted); outline: none; }
.emoji-empty { padding: 28px 8px; color: var(--muted-foreground); font-size: 12.5px; text-align: center; }
.emoji-foot { display: flex; min-height: 52px; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--muted-2); }
.emoji-foot-char { font-size: 28px; line-height: 1; }
.emoji-foot-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.emoji-foot-text strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.emoji-foot-text small, .emoji-foot-hint { color: var(--muted-foreground); font-size: 11.5px; }
.emoji-foot-hint { flex: 1; }
.emoji-remove { margin-left: auto; padding: 4px 8px; border-radius: 6px; color: var(--muted-foreground); font-size: 12px; white-space: nowrap; }
.emoji-remove:hover { background: var(--muted); color: var(--foreground); }
.identity-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; padding: 14px 0; border-top: 1px solid var(--border); background: var(--background); }
/* The save bar follows the page only while there is something to save. */
.is-dirty .identity-actions { position: sticky; bottom: 0; z-index: 5; }
.identity-dirty { margin-right: auto; color: var(--muted-foreground); font-size: 12.5px; }
.identity-aside { min-width: 0; }
.identity-aside .gh-code { font-size: 12px; }
@media (max-width: 1100px) {
  .identity-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .set-row { grid-template-columns: minmax(0, 1fr); padding: 18px 0; }
}

/* editor */
.gh-editor-body { position: relative; display: flex; min-height: 480px; max-height: 72vh; }
.gh-gutter { width: 56px; flex: none; overflow: hidden; padding: 12px 12px 12px 0; border-right: 1px solid var(--border); background: var(--muted-2); color: var(--faint); font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 20px; text-align: right; white-space: pre; user-select: none; }
.gh-gutter:empty { display: none; }
.gh-textarea { flex: 1; min-height: 480px; padding: 12px 14px; border: 0; outline: none; resize: vertical; background: var(--card); color: var(--foreground); font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 20px; tab-size: 2; white-space: pre-wrap; }
.gh-textarea.is-nowrap { white-space: pre; overflow-x: auto; }
.gh-textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--ring, var(--brand)); }
.gh-pane { min-height: 480px; max-height: 72vh; overflow: auto; }
.gh-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--muted-foreground); font-size: 12px; }
.gh-commit { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); }
.gh-commit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.gh-commit-head span { color: var(--muted-foreground); }
.gh-commit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.gh-commit-actions .gh-hint { margin-left: auto; }
.gh-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }

/* conversations */
.thread-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 260px; gap: 28px; }
.thread-outline { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
.thread-outline a { display: block; padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 12.5px; }
.thread-outline a:hover { color: var(--foreground); }
.thread-rail { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto; overscroll-behavior: contain; }
.msg { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.msg-who { padding-top: 2px; color: var(--muted-foreground); font-size: 12px; font-weight: 500; }
.msg-user .msg-who { color: var(--foreground); }
/* A permalink timestamp under the speaker: hover a message to see when it ran. */
.msg-who .msg-time { display: block; margin-top: 2px; font-weight: 400; font-size: 11px; color: var(--faint); }
.msg-who .msg-time:hover { color: var(--foreground); }
/* The session header + tabs stay put while a long thread scrolls. */
.session-page .session-stick { position: sticky; top: 0; z-index: 20; padding-top: 10px; background: color-mix(in srgb, var(--background) 93%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.session-page .session-stick .entity-head { padding-top: 8px; }
/* Code blocks carry their own copy button (the global [data-copy] handler). */
pre.highlight { position: relative; }
.copy-code { position: absolute; top: 6px; right: 6px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--background); color: var(--muted-foreground); font-size: 11px; opacity: 0; transition: opacity .15s ease; }
pre.highlight:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
.copy-code:hover { color: var(--foreground); border-color: var(--border-strong); }
/* A live session pulses instead of sitting static. */
@keyframes eng-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.badge-live { animation: eng-pulse 1.6s ease-in-out infinite; }
.msg-body { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body.markdown-compact { white-space: normal; }
.msg-system .msg-body { color: var(--muted-foreground); font-size: 12.5px; }
.msg-command .msg-body { color: var(--muted-foreground); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; }
.msg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.msg-more summary { margin-top: 6px; cursor: pointer; color: var(--muted-foreground); font-size: 12px; }
.msg-more[open] summary { margin-bottom: 4px; }
/* A block the person pasted: the harness's wrapper tags never reach the page. */
.msg-paste { margin: 4px 0; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); }
.msg-paste > summary { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; cursor: pointer; color: var(--muted-foreground); font-size: 12px; }
.msg-paste-label { color: var(--foreground); font-weight: 500; }
.msg-paste-meta { margin-left: auto; font-variant-numeric: tabular-nums; }
.msg-paste[open] > summary { border-bottom: 1px solid var(--border); }
.msg-paste-body { margin: 0; padding: 8px 10px; max-height: 420px; overflow: auto; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Images and blobs an event carried, served by the attachments route. */
.msg-media { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 8px; }
.msg-image img { display: block; max-width: min(100%, 420px); max-height: 260px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); }
.msg-file { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); color: var(--muted-foreground); font-family: var(--font-mono, monospace); font-size: 11.5px; }
.tool-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted-2); color: var(--muted-foreground); font-family: var(--font-mono, monospace); font-size: 11.5px; }
a.tool-chip:hover { border-color: var(--border-strong); color: var(--foreground); }
.msg-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 12px; }
.msg-flag:hover > span:last-child { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.tool-chip:focus-visible, .msg-flag:focus-visible, .session-title:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }

/* One session page: the conversation and its telemetry tabs. Links from a tool
   chip, a flag or a search land on a row or a turn; the header is sticky, so
   targets keep clear of it, and the landed-on target is tinted. */
.msg, .msg-anchor, .session-page tr[id] { scroll-margin-top: 72px; }
.msg-anchor { display: block; }
.msg:target, .msg:has(.msg-anchor:target), .session-page tr[id]:target { background: var(--muted-2); }
.session-heading { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.session-col { min-width: 260px; max-width: 420px; }
.session-title { color: var(--foreground); font-size: 12.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.session-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.session-id { display: block; margin-top: 3px; color: var(--muted-foreground); font-size: 11.5px; }
.thread-matches { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.kv-grid-wide { grid-column: 1 / -1; }
.rail-facts { margin-top: 14px; }
.rail-facts > div { padding: 8px 0; border-bottom: 1px solid var(--border); }
.rail-facts dt { color: var(--muted-foreground); font-size: 11.5px; }
.rail-facts dd { margin: 2px 0 0; font-size: 12.5px; overflow-wrap: anywhere; }
.rail-facts dd.font-mono { font-size: 12px; }
.session-summary { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; margin-bottom: 24px; }
.session-summary > .resource-section { margin-top: 0; border-top: 0; }
.session-summary .pill[aria-current="true"] { box-shadow: inset 0 0 0 1px currentColor; }
.tool-counts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: -4px 0 12px; color: var(--muted-foreground); font-size: 12px; }
.tool-counts .font-mono { color: var(--foreground); }

/* search */
.search-hit { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.search-hit:hover .search-hit-where strong { text-decoration: underline; text-underline-offset: 2px; }
.search-hit-where { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--muted-foreground); }
.search-hit-where strong { color: var(--foreground); }
.search-hit-line { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.65; }
.workspace-search-form .search-query { flex: 1 1 280px; min-width: 0; }
.workspace-search-form .select { max-width: 100%; }
.search-guidance { margin: -4px 0 20px; color: var(--muted-foreground); font-size: 12.5px; }
.search-hit-where { overflow-wrap: anywhere; }
.search-mark { padding: 0 1px; border-radius: 2px; background: var(--console-selection-bg); color: var(--console-selection-fg); font-weight: 600; }
.search-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; color: var(--muted-foreground); font-size: 12.5px; }
.search-pagination > div { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1100px) {
  .workspace-secondary-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .thread-layout { grid-template-columns: minmax(0, 1fr) 240px; }
  .thread-outline { display: none; }
  .session-summary { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .workspace-directory-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .policy-row { grid-template-columns: minmax(0, 1fr) 240px; }
  .policy-row .policy-scope { grid-column: 2; }
}
@media (max-width: 767px) {
  .markdown-body { padding: 16px; }
  .gh-history-row { flex-wrap: wrap; row-gap: 8px; }
  .gh-history-text { flex-basis: calc(100% - 34px); }
  .gh-history-row .gh-delta { min-width: 0; margin-left: 34px; text-align: left; }
  .gh-commit-actions .gh-hint { margin-left: 0; }
  .meter-grid, .layers { grid-template-columns: 1fr 1fr; }
  .thread-layout { grid-template-columns: 1fr; }
  .thread-outline, .thread-rail { position: static; max-height: none; overflow: visible; }
  .search-hit { grid-template-columns: 1fr; gap: 4px; }
  .kv-list > div { grid-template-columns: 1fr; gap: 2px; }
  .policy-row { grid-template-columns: 1fr; gap: 10px; }
  .policy-row .policy-scope { grid-column: auto; }
  .share-form, .share-dialog .share-form { grid-template-columns: 1fr; }
  .share-link-row, .share-link-actions { margin-left: 0; }
  .share-dialog-body { padding: 18px 16px 16px; }
  .policy-head span { display: none; }
  .policy-scope, .policy-readonly { min-height: 0; }
  .tabs { mask-image: linear-gradient(to right, var(--foreground) calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(to right, var(--foreground) calc(100% - 28px), transparent); }
  .entity-head { flex-wrap: wrap; }
  .console-page-header { flex-direction: column; gap: 14px; padding: 24px 0 20px; }
  .console-page-actions { width: 100%; }
  .console-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .console-stat { border-bottom: 1px solid var(--border); }
  .console-stat:nth-child(2n) { border-right: 0; }
  .console-stat:last-child, .console-stat:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .console-stat { padding: 15px; }
  .console-stat:not(:first-child) { padding-left: 15px; }
  .console-stat-value { font-size: 20px; }
  .workspace-ledger-access { width: 100%; margin-left: 0; }
  .resource-create-form { grid-template-columns: 1fr; }
  .resource-create-form .btn { width: 100%; }
  .setup-guide { grid-template-columns: 1fr; gap: 16px; }
  .inline-create-note { display: none; }
  .api-access-note { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .console-body *, .console-body *::before, .console-body *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.auth-body { background: var(--background-soft); }
.auth-header { border-bottom: 1px solid var(--border); background: var(--background); }
.auth-card { border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 12px 32px -20px rgb(20 23 28 / .25); }

/* A shared session (sessions/shared.html): the transcript, and the run's facts
   beside it. No console chrome, so the grid is simpler than .thread-layout. */
.shared-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; }
@media (max-width: 900px) {
  .shared-layout { grid-template-columns: minmax(0, 1fr); }
  .shared-layout .thread-rail { position: static; }
  .shared-layout .msg { grid-template-columns: 1fr; gap: 4px; }
}
