/* Dari's look (dari.dev): charcoal, Geist, mint as the one accent. What sits on the page grid is square;
   what is pressed or floats is rounded. Two weights, 450 and 550. Colors are HSL triples, so
   hsl(var(--x) / a) gives any of them at an opacity. The home page and the dashboard share this file. */
@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  /* Stacking, lowest first. Inside a page: a pane's sticky head, a message's hover tools, the jump button,
     the details pane drawn over the thread on narrow screens, and its toggle above it. Over the page:
     tooltips, the phone top bar, menus and lists, the drawer's scrim, the drawer. */
  --z-sticky: 2; --z-hover: 3; --z-jump: 4; --z-pane: 6; --z-pane-toggle: 7;
  --z-tip: 20; --z-topbar: 30; --z-menu: 40; --z-scrim: 45; --z-drawer: 50;
  color-scheme: dark;
  --background: 240 2.4% 8%;
  --foreground: 0 0% 92.9%;
  --card: 240 2% 10%;
  --popover: 240 3% 12.9%;
  --muted: 240 3.3% 11.8%;
  --muted-foreground: 240 2.9% 73.3%;
  --faint: 240 2.8% 51.6%;
  --border: 240 1% 19%;
  --input: 240 1% 25%;
  --accent: 240 1.4% 13.5%;
  --brand: 152 63.8% 72.9%;
  --warning: 37.8 57.5% 62.2%;
  --sage: 120 5.3% 52.4%;
  --destructive: 358 66% 54%;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 248px;
}

* { box-sizing: border-box; border-color: hsl(var(--border)); scrollbar-color: hsl(var(--foreground) / 0.24) transparent; scrollbar-width: thin; }
[hidden] { display: none !important; }
/* No rubber-band at the window's edges: a hard scroll would pull the whole page, sidebar included,
   away from the top. Panels that scroll inside themselves keep their own behaviour. */
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { overscroll-behavior: none; }
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: 450 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: hsl(var(--brand)); color: hsl(var(--background)); }
h1, h2, h3, p, pre, dl, dd, form, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1 { font-size: 20px; line-height: 28px; font-weight: 550; letter-spacing: -0.02em; }
h2 { font-size: 16px; line-height: 24px; font-weight: 550; letter-spacing: -0.02em; }
h3 { font-size: 14px; line-height: 20px; font-weight: 550; letter-spacing: -0.01em; }
code, pre { font-family: var(--mono); }
a { color: inherit; }
.muted { color: hsl(var(--muted-foreground)); }
.faint { color: hsl(var(--faint)); }
/* The negative margin keeps the hidden pixel from adding to what its page or panel can scroll. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Not display: none, which would also hide the gradient the Codex mark is filled with. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mark { flex-shrink: 0; fill: hsl(var(--foreground)); }
.logo { width: 16px; height: 16px; flex-shrink: 0; }
.logo.mono { fill: currentColor; }
.link { color: hsl(var(--foreground)); text-decoration: underline; text-decoration-color: hsl(var(--foreground) / 0.35); text-underline-offset: 4px; transition: text-decoration-color .15s; }
.link:hover { text-decoration-color: hsl(var(--foreground)); }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: none; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0;
  height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px;
  font: 550 14px/1 var(--sans); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.lg { height: 40px; }
.btn.block { width: 100%; }
.btn.primary { border-color: hsl(var(--foreground)); background: hsl(var(--foreground)); color: hsl(var(--background)); }
.btn.primary:hover { background: hsl(var(--foreground) / 0.9); }
.btn.outline { border-color: hsl(var(--input)); background: transparent; color: hsl(var(--foreground)); }
.btn.outline:hover { border-color: hsl(var(--foreground) / 0.4); background: hsl(var(--accent)); }
.btn.ghost { background: transparent; color: hsl(var(--foreground)); }
.btn.ghost:hover { background: hsl(var(--accent)); }
.btn.destructive { border-color: hsl(var(--destructive)); background: hsl(var(--destructive)); color: hsl(0 0% 98%); }
.btn.destructive:hover { background: hsl(var(--destructive) / 0.9); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }
.btn.primary .icon { color: inherit; }
.btn.copied .icon { color: hsl(var(--brand)); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 4px; color: hsl(var(--faint)); }
.btn:focus-visible, .icon-btn:focus-visible, .help button:focus-visible, .text-btn:focus-visible, .trigger:focus-visible,
.nav-item:focus-visible, .conn-pick:focus-visible, .link:focus-visible, .wordmark:focus-visible, .command:focus-visible, .chip-btn:focus-visible,
.site-nav a:focus-visible, .site-foot a:focus-visible { box-shadow: 0 0 0 1px hsl(var(--brand)); }
/* A quiet action under a form: Cancel, Back. */
.text-btn { display: inline-flex; padding: 2px 4px; border: 0; border-radius: 4px; background: none; color: hsl(var(--muted-foreground)); font: 450 13px/20px var(--sans); text-decoration: none; cursor: pointer; }
.text-btn:hover { color: hsl(var(--foreground)); }

/* Fields */
.input, .select select, .select .select-button {
  height: 36px; border: 1px solid hsl(var(--input)); border-radius: 6px; background: hsl(var(--background));
  color: inherit; font: 450 14px var(--sans); transition: border-color .15s;
}
.input { width: 100%; padding: 0 12px; }
.input::placeholder { color: hsl(var(--faint)); }
.input:focus-visible, .select select:focus-visible, .select .select-button:focus-visible { border-color: hsl(var(--brand)); box-shadow: 0 0 0 1px hsl(var(--brand)); }
.select { position: relative; display: flex; align-items: center; min-width: 0; }
.select select, .select .select-button { appearance: none; width: 100%; padding: 0 32px 0 12px; text-overflow: ellipsis; cursor: pointer; }
.select .icon { position: absolute; right: 10px; width: 14px; height: 14px; color: hsl(var(--faint)); pointer-events: none; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 550; }
.form { display: grid; gap: 16px; }
.field.left { text-align: left; }

/* Menus: an org switcher, the account. They open from a trigger, close on Esc or a click elsewhere. */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: var(--z-menu); min-width: 100%; padding: 4px;
  border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--popover));
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}
.menu.down { top: calc(100% + 4px); left: 0; }
.menu.up { bottom: calc(100% + 4px); left: 0; }
.menu-label { padding: 6px 8px 4px; font-size: 12px; color: hsl(var(--faint)); }
.menu-sep { height: 1px; margin: 4px -4px; background: hsl(var(--border)); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 6px 8px; border: 0; border-radius: 4px;
  background: none; color: hsl(var(--foreground)); font: 450 14px/20px var(--sans); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item .icon { width: 14px; height: 14px; color: hsl(var(--faint)); }
.menu-item .check { margin-left: auto; color: hsl(var(--foreground)); }
.menu-item:hover, .menu-item:focus-visible { background: hsl(var(--foreground) / 0.1); }
.menu-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Help: a heading's helper text, in a tooltip under the heading. */
.heading { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
.help { display: inline-flex; }
.help button { display: inline-flex; padding: 0; border: 0; border-radius: 50%; background: none; color: hsl(var(--faint)); cursor: help; }
.help button:hover, .help button:focus-visible { color: hsl(var(--foreground)); }
.help .icon { width: 14px; height: 14px; }
.tip {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: var(--z-tip);
  width: max-content; max-width: min(300px, 80vw); padding: 6px 10px;
  border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--popover));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  font: 450 13px/20px var(--sans); letter-spacing: 0; color: hsl(var(--foreground));
}
.help:hover .tip, .help button:focus-visible + .tip { display: block; }

/* Small parts */
.chip { display: inline-flex; align-items: center; flex-shrink: 0; height: 20px; padding: 0 6px; border-radius: 4px; background: hsl(var(--foreground) / 0.07); font-size: 12px; color: hsl(var(--muted-foreground)); }
/* An agent's own mark, and the agents in a row of chips. */
.agent-logo { width: 14px; height: 14px; flex-shrink: 0; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.agent-chips .chip { gap: 6px; height: 24px; padding: 0 8px; font-family: var(--mono); font-size: 12px; color: hsl(var(--foreground)); }
.org-letter { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; border-radius: 4px; background: hsl(var(--foreground) / 0.1); font-size: 11px; font-weight: 550; color: hsl(var(--foreground)); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px;
  border: 1px solid hsl(var(--input)); border-radius: 50%; background: hsl(var(--muted)); font-size: 11px; font-weight: 550; color: hsl(var(--foreground));
}
.avatar .icon { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.dot { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--input)); }
.st-working, .st-online { color: hsl(var(--foreground)); }
.st-working .dot, .st-online .dot { background: hsl(var(--brand)); }
.st-idle .dot { background: hsl(var(--faint)); }
.st-blocked { color: hsl(var(--warning)); }
.st-blocked .dot { background: hsl(var(--warning)); }
.st-offline, .st-unknown { color: hsl(var(--faint)); }
.code { padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--foreground) / 0.03); font-size: 12px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { padding: 12px; border: 1px solid; border-radius: 6px; font-size: 13px; line-height: 20px; }
.notice.error { border-color: hsl(var(--destructive) / 0.5); background: hsl(var(--destructive) / 0.1); }
.notice.warning { border-color: hsl(var(--warning) / 0.4); background: hsl(var(--warning) / 0.1); color: hsl(var(--warning)); }
.notice.quiet { border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.note { font-size: 12px; line-height: 18px; color: hsl(var(--faint)); }

/* A command or link you click to copy. */
.copy + .copy { margin-top: 12px; }
.copy .label { margin-bottom: 6px; font-size: 12px; color: hsl(var(--faint)); }
.command {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 12px 9px 14px;
  border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--foreground) / 0.025);
  color: hsl(var(--foreground)); font: 12.5px/20px var(--mono); text-align: left; cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.command:hover { border-color: hsl(var(--brand) / 0.45); background: hsl(var(--foreground) / 0.05); }
.command .prompt { flex-shrink: 0; color: hsl(var(--faint)); user-select: none; }
.command .text { flex: 1; min-width: 0; overflow-wrap: break-word; }
.command .piece { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.command .icon { flex-shrink: 0; width: 14px; height: 14px; margin-top: 3px; color: hsl(var(--faint)); transition: color .15s; }
.command:hover .icon { color: hsl(var(--foreground)); }
.command.copied { border-color: hsl(var(--brand) / 0.45); }
.command.copied .icon { color: hsl(var(--brand)); }
/* Numbered steps, each over its command. */
.steps-list { display: grid; gap: 16px; padding: 0; margin: 0; list-style: none; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; line-height: 20px; color: hsl(var(--muted-foreground)); }
.step-n { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; border: 1px solid hsl(var(--input)); border-radius: 50%; font-size: 11px; font-weight: 550; color: hsl(var(--foreground)); font-variant-numeric: tabular-nums; }

/* The wordmark: Dari's mark beside "context-drop" over "by dari.dev", both in mono. */
.wordmark { display: inline-flex; align-items: center; gap: 10px; min-width: 0; border-radius: 6px; color: hsl(var(--foreground)); text-decoration: none; white-space: nowrap; }
.wordmark .mark { width: 30px; height: 30px; }
.wordmark-name { display: grid; gap: 4px; font-family: var(--mono); line-height: 1; }
.wordmark-name strong { font-size: 15px; font-weight: 700; letter-spacing: 0.025em; }
.wordmark-name span { font-size: 11px; color: hsl(var(--muted-foreground)); }

/* ———— One-off screens: sign in, create an org, join one, approve a machine. A centred column, no card. ———— */
.solo { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; padding: 48px 24px 24px; }
.solo-in { width: 100%; max-width: 360px; margin: auto; padding-bottom: 24px; }
.solo-in > .wordmark { display: flex; justify-content: center; margin-bottom: 28px; }
.screen { display: grid; gap: 32px; text-align: center; }
.screen > h1 { overflow-wrap: anywhere; }
.screen-head { display: grid; gap: 8px; }
.screen-head p { font-size: 14px; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }
.screen .stack { display: grid; gap: 12px; text-align: left; }
.screen .after { display: flex; justify-content: center; margin-top: -16px; }
.screen .why { margin-top: -16px; font-size: 13px; line-height: 20px; color: hsl(var(--foreground)); }
.screen .notice { text-align: left; }
.screen .notice code { font-size: 12px; }
/* The code a machine shows: big and spaced, to check against the terminal at a glance. */
.otp { padding: 18px 12px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--foreground) / 0.03); font: 500 24px/32px var(--mono); letter-spacing: 0.16em; text-indent: 0.16em; }
.otp + .note { margin-top: 10px; }
/* Label-and-value rows: every row the same height whatever it holds. */
.rows { border-top: 1px solid hsl(var(--border)); text-align: left; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid hsl(var(--border)); }
.row > .faint { flex-shrink: 0; font-size: 13px; }
.row > strong { min-width: 0; font-weight: 550; overflow-wrap: anywhere; text-align: right; }
.row .select { width: min(200px, 60%); }
.who-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px; padding-top: 16px; font-size: 13px; color: hsl(var(--faint)); text-align: center; }
.who-line strong { font-weight: 450; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }

/* ———— The signed-in app: a sidebar beside the page. ———— */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; height: 100svh;
  border-right: 1px solid hsl(var(--border)); background: hsl(var(--background));
}
.sb-head { display: flex; align-items: center; height: 56px; flex-shrink: 0; padding: 0 16px; border-bottom: 1px solid hsl(var(--border)); }
.sb-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 8px; }
.sb-group + .sb-group { margin-top: 16px; }
.sb-label { display: flex; align-items: center; height: 32px; padding: 0 8px; font-size: 12px; font-weight: 550; color: hsl(var(--sage)); }
.sb-group ul { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px;
  color: hsl(var(--muted-foreground)); font-size: 14px; text-decoration: none; transition: background-color .15s, color .15s;
}
button.nav-item { width: 100%; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
.nav-item .icon { color: hsl(var(--faint)); }
.nav-item:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.nav-item:hover .icon { color: hsl(var(--foreground)); }
.nav-item[aria-current="page"] { background: hsl(var(--accent)); color: hsl(var(--foreground)); font-weight: 550; }
.nav-item[aria-current="page"] .icon { color: hsl(var(--brand)); }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 450; color: hsl(var(--faint)); font-variant-numeric: tabular-nums; }
.nav-item .out { margin-left: auto; width: 14px; height: 14px; opacity: 0; transition: opacity .15s; }
.nav-item:hover .out { opacity: 1; }
/* Triggers: the org switcher and the account. */
.trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 0 10px; border: 1px solid hsl(var(--input));
  border-radius: 6px; background: transparent; color: hsl(var(--foreground)); font: 450 14px var(--sans); text-align: left; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.trigger:hover, .trigger[aria-expanded="true"] { border-color: hsl(var(--foreground) / 0.4); background: hsl(var(--accent)); }
.trigger > .icon { width: 14px; height: 14px; margin-left: auto; color: hsl(var(--faint)); }
.trigger:disabled { cursor: default; }
.trigger:disabled:hover { border-color: hsl(var(--input)); background: transparent; }
.org-trigger { height: 36px; }
.sb-org { padding: 12px 12px 0; }
.sb-org .menu { right: 0; max-height: 60vh; overflow-y: auto; }
.sb-foot { flex-shrink: 0; padding: 12px; border-top: 1px solid hsl(var(--border)); }
.account { height: 48px; padding: 0 8px; border-color: transparent; }
.account:hover, .account[aria-expanded="true"] { border-color: transparent; }
.account-text { display: grid; min-width: 0; line-height: 18px; }
.account-text .name { font-size: 13px; font-weight: 550; }
.account-text .sub { font-size: 12px; color: hsl(var(--faint)); }
.sb-foot .menu { right: 0; }

.topbar { display: none; }
.scrim { display: none; }
.content { min-width: 0; }
.page { max-width: 1160px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; margin-bottom: 24px; }
.page-head h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; flex-shrink: 0; gap: 8px; }
/* Lined up with the page under it: 1096px wide, centred, never closer than 32px to the edges. */
.content > .notice { margin: 24px max(32px, calc((100% - 1096px) / 2)) 0; }

/* Stat tiles: one outer rule, hairlines between cells. */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: 24px; border: 1px solid hsl(var(--border)); background: hsl(var(--border)); }
.tile { min-width: 0; padding: 12px 16px 14px; background: hsl(var(--card)); }
.tile dt, .tile .detail { font-size: 12px; color: hsl(var(--muted-foreground)); }
.tile dd { margin-top: 6px; font-size: 24px; line-height: 32px; font-weight: 550; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile .detail { margin-top: 2px; min-height: 18px; }
.tile .detail.warn { color: hsl(var(--warning)); }

/* Panels and tables: square, ruled. */
.panel { border: 1px solid hsl(var(--border)); background: hsl(var(--card)); }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 12px; border-bottom: 1px solid hsl(var(--border)); text-align: left; font-size: 12px; font-weight: 550; color: hsl(var(--faint)); white-space: nowrap; }
td { height: 44px; padding: 6px 12px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td .chip { margin-left: 8px; }
td .btn.sm { height: 28px; margin: -4px 0; }
.name-cell { font-weight: 550; }
/* The name cell takes the width the other columns leave, and clips what does not fit. */
.person-td { width: 100%; max-width: 0; }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { min-width: 0; line-height: 18px; }
.person-line { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.person-line .chip { margin: 0; font-weight: 450; }
.person-email { font-size: 12px; color: hsl(var(--faint)); }

/* The messages row spans all five columns, so the widths of the columns shown must add up to 100%:
   a fixed-layout table hands any remainder to the hidden ones. The last column takes what is left. */
.agents-head .heading { flex-shrink: 0; }
.agent-filters { display: flex; flex: 1; flex-wrap: wrap; gap: 8px; min-width: 0; }
.agent-filter { flex: 1 1 100px; min-width: 0; }
.agent-filter.agent-search { flex: 2 1 148px; }
.agent-filter .input, .agent-filter select, .agent-filter .select-button { height: 32px; font-size: 13px; }
@media (max-width: 1050px) {
  .agents-head { flex-wrap: wrap; }
  .agents-head .agent-filters { order: 1; flex-basis: 100%; }
}
.agent-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0; min-height: 30px; color: hsl(var(--muted-foreground)); font-size: 12px; font-variant-numeric: tabular-nums; }
.agent-summary .btn { margin-left: auto; }
.agents { table-layout: fixed; }
.agents thead th:nth-child(1) { width: 34%; }
.agents thead th:nth-child(2) { width: 12%; }
.agents thead th:nth-child(3) { width: 8%; }
.agents thead th:nth-child(4) { width: 24%; }
.agents td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-groups { display: grid; gap: 16px; }
.agent-card { min-width: 0; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--card)); }
/* A group's first column heading is its machine: picture, name, and how many agents it runs. */
.agents th.agent-group-head { overflow: hidden; text-overflow: ellipsis; padding-left: 12px; }
.agent-group-head > span { vertical-align: middle; }
.agent-group-avatar { display: inline-flex; margin-inline-end: 10px; }
.agent-group-avatar .agent-group-photo { width: 22px; height: 22px; border-radius: 4px; }
.agent-group-avatar .icon.agent-group-photo { width: 18px; height: 18px; color: hsl(var(--muted-foreground)); }
.agent-group-name { margin-inline-end: 8px; color: hsl(var(--foreground)); font-size: 13px; font-weight: 600; }
.agent-group-detail { font-weight: 450; font-variant-numeric: tabular-nums; }
.agent-active { font-variant-numeric: tabular-nums; }
.agent-harness { display: inline-flex; flex: none; color: hsl(var(--muted-foreground)); }
tr.agent { cursor: pointer; }
tr.agent td { transition: background-color .15s; }
tr.agent:hover td, tr.agent.open td { background: hsl(var(--accent)); }
tr.agent td:first-child { padding-left: 8px; }
tr.agent.sub td:first-child { padding-left: 32px; }
.agent-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-id .chip { margin: 0; }
.agent-id .icon-btn .icon { transition: transform .15s; }
tr.agent.open .agent-id .icon-btn .icon { transform: rotate(90deg); color: hsl(var(--foreground)); }
.id { overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12px; }
.path { font-family: var(--mono); font-size: 12px; color: hsl(var(--muted-foreground)); }
/* An open agent's latest messages. */
/* An open agent's latest messages hang from a rail under its row's chevron: each entry is a small square on the
   rail, its kind and time above what it said. Prompts sit in a quiet box; tool calls read as code. */
tr.transcript td { height: auto; padding: 0; background: hsl(var(--background)); white-space: normal; }
.entries {
  /* --rail is where the line runs, and --to-text how far the text starts past it; the squares sit on the line. */
  --rail: 20px; --to-text: 20px; position: relative; display: grid; gap: 14px; max-height: 480px; overflow-y: auto;
  padding: 16px 24px 18px calc(var(--rail) + var(--to-text)); font-size: 13px; line-height: 20px;
  /* The rail is drawn as the box's own background, fixed to its content ("local"), so it runs the whole
     scrolled length of the transcript, not just the part first in view. */
  background: linear-gradient(hsl(var(--border)), hsl(var(--border))) calc(var(--rail) - 0.5px) 0 / 1px 100% no-repeat local;
}
.entry { position: relative; min-width: 0; }
.entry::before {
  content: ""; position: absolute; top: 6px; left: calc(-1 * var(--to-text) - 3px); width: 6px; height: 6px;
  background: hsl(var(--faint)); box-shadow: 0 0 0 3px hsl(var(--background));
}
.entry.user::before { background: hsl(var(--foreground)); }
.entry.error::before { background: hsl(var(--destructive)); }
.entry-meta { font-size: 12px; line-height: 18px; color: hsl(var(--faint)); }
.entry-body { max-width: 96ch; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; text-wrap: pretty; }
.entry.user .entry-body { width: fit-content; padding: 8px 12px; border-radius: 8px; background: hsl(var(--accent)); }
/* A run of tool calls: its last few, a line each, cut at the edge (the full line is the tooltip). */
.entry.tool .entry-body { display: grid; gap: 6px; max-width: none; font-family: var(--mono); font-size: 12px; white-space: normal; color: hsl(var(--muted-foreground)); }
.tool-more { color: hsl(var(--faint)); }
.tool-line { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
.tool-time { grid-row: span 2; color: hsl(var(--faint)); }
.tool-text { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-result { color: hsl(var(--faint)); }
.tool-result.failed { color: hsl(var(--destructive)); }
.entry.error .entry-body { color: hsl(var(--destructive)); }

/* Empty states: what to do next, with the command. */
.empty { padding: 20px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); }
.empty > p { margin-top: 4px; font-size: 13px; line-height: 20px; color: hsl(var(--muted-foreground)); }
.empty > .copies, .empty > .btn { margin-top: 16px; }
.empty > .agent-chips { margin-top: 14px; }
.empty .copies { max-width: 720px; }

/* A section under a page's main table, such as invites nobody has used. */
.section { margin-top: 32px; }
.section > .heading { margin-bottom: 12px; }
.more { display: flex; justify-content: center; margin-top: 16px; }

/* The activity log: when, what, and from where. */
.activity td { font-size: 13px; }
.activity td:first-child { width: 1%; white-space: nowrap; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.activity td:last-child { width: 1%; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: hsl(var(--faint)); }
.event { line-height: 20px; overflow-wrap: anywhere; }
.event .id { font-size: 12px; }
.event .chip { margin: 0 0 0 8px; }
.chip.refused { background: hsl(var(--warning) / 0.12); color: hsl(var(--warning)); }
/* A table too wide for a phone scrolls inside its panel, not the page. */
/* Positioned, so a visually hidden label inside the table (position: absolute) scrolls with it instead of
   widening the page. */
.panel.scroll { position: relative; overflow-x: auto; }
.panel.scroll td, .panel.scroll th { white-space: nowrap; }

/* Connections: every one in a list on the left, the open one on the right. */
.conns { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.conn-list { display: grid; align-content: start; gap: 2px; padding: 8px; border-right: 1px solid hsl(var(--border)); }
.conn-pick {
  display: flex; align-items: center; gap: 10px; min-width: 0; height: 40px; padding: 0 10px; border-radius: 6px;
  color: hsl(var(--muted-foreground)); text-decoration: none; transition: background-color .15s, color .15s;
}
.conn-pick:hover, .conn-pick[aria-current] { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.conn-pick[aria-current] { font-weight: 550; }
.conn-pick .dot { margin-left: auto; }
.conn-pick.on .dot { background: hsl(var(--brand)); }
.conn-logo { width: 18px; height: 18px; flex-shrink: 0; }
.conn-open { display: grid; align-content: start; gap: 20px; min-width: 0; padding: 24px; }
.conn-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.conn-mark { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--foreground) / 0.035); }
.conn-mark svg { width: 22px; height: 22px; }
.conn-name { display: grid; gap: 2px; flex: 1 1 200px; min-width: 0; }
.conn-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.conn-about { line-height: 22px; color: hsl(var(--muted-foreground)); }
.conn-line { font-size: 13px; line-height: 20px; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }
/* Something left to run on a connection that is on. */
.conn-next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--foreground) / 0.025); }
.conn-next p { flex: 1 1 240px; font-size: 13px; line-height: 20px; }
.conn-next .copy { flex: 1 1 100%; }
.conn-does { display: grid; gap: 8px; }
.conn-does li { display: flex; gap: 10px; font-size: 13px; line-height: 20px; color: hsl(var(--muted-foreground)); }
.conn-does .icon { margin-top: 2px; color: hsl(var(--brand)); }
.conn-block { display: grid; gap: 10px; min-width: 0; }
.conn-block .copy + .copy { margin-top: 0; }
.conn-label { font-size: 12px; line-height: 18px; font-weight: 550; letter-spacing: 0; color: hsl(var(--sage)); }
.conn-open .row { min-height: 44px; }
.conn-open .row > strong { font-size: 13px; }
/* The way out, apart from everything else. */
.conn-off { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; border-top: 1px solid hsl(var(--border)); }
.conn-off p { flex: 1 1 240px; font-size: 13px; line-height: 20px; color: hsl(var(--muted-foreground)); }

/* Dialog */
dialog { width: calc(100% - 32px); max-width: 520px; padding: 0; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--card)); color: inherit; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5); }
dialog:focus { outline: none; }
dialog::backdrop { background: rgb(0 0 0 / 0.6); backdrop-filter: blur(2px); }
.dialog-in { padding: 24px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-head .icon-btn { margin: -4px -8px -4px 0; }
.dialog-text { color: hsl(var(--muted-foreground)); }
.dialog-text code { font-size: 13px; white-space: nowrap; }
#dialog-body > .field { margin-top: 16px; }
/* A row's actions: icons that say what they do on hover or focus, the way out of the org in red. */
td.acts { padding-right: 6px; white-space: nowrap; }
td.acts .icon-btn { margin: -4px 0; vertical-align: middle; }
/* A role picked in its row: its text sits where a plain role's does. */
.select.sm { display: inline-flex; }
.select.sm select, .select.sm .select-button { width: 96px; height: 28px; padding: 0 26px 0 8px; font-size: 13px; }
.select.sm .icon { right: 8px; width: 12px; height: 12px; }
td .select.sm { margin: -4px 0 -4px -9px; vertical-align: middle; }
.icon-btn[data-tip] { position: relative; }
.icon-btn[data-tip]::after {
  content: attr(data-tip); display: none; position: absolute; right: 0; bottom: calc(100% + 6px); z-index: var(--z-tip);
  padding: 3px 8px; border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--popover));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4); font: 450 12px/18px var(--sans); color: hsl(var(--foreground));
  white-space: nowrap; pointer-events: none;
}
.icon-btn[data-tip]:focus-visible::after { display: block; }
@media (hover: hover) {
  .icon-btn[data-tip]:hover::after { display: block; }
  .icon-btn.danger:hover { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
  .btn.outline.danger:hover { border-color: hsl(var(--destructive) / 0.6); background: hsl(var(--destructive) / 0.08); color: hsl(var(--destructive)); }
}
#dialog-body > .note { margin-top: 12px; }
#dialog-body > .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
/* The intro: what the org's agents can do, two to a row where they fit. */
dialog.intro-dialog { max-width: 680px; }
.caps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 20px 0 0; padding: 0; list-style: none; }
.cap { display: flex; gap: 12px; min-width: 0; }
.cap-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border: 1px solid hsl(var(--border)); border-radius: 6px; color: hsl(var(--brand)); }
.cap-icon .icon { width: 14px; height: 14px; }
.cap-text { min-width: 0; }
.cap-text strong { display: block; font-size: 13px; font-weight: 550; line-height: 20px; }
.cap-text p { margin-top: 2px; font-size: 13px; line-height: 19px; color: hsl(var(--muted-foreground)); }
.cap-text code { display: block; margin-top: 6px; font-size: 11.5px; line-height: 16px; color: hsl(var(--faint)); overflow-wrap: anywhere; }
#dialog-body > .caps + .note { margin-top: 20px; }
@media (max-width: 600px) { .caps { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 1080px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .content > .notice { margin-left: 24px; margin-right: 24px; }
}

/* Phones and narrow windows: the sidebar becomes a drawer under a top bar. */
@media (max-width: 860px) {
  .shell { display: block; }
  .topbar {
    position: sticky; top: 0; z-index: var(--z-topbar); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: 56px; padding: 0 12px 0 16px; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background));
  }
  .topbar-org { min-width: 0; margin-right: auto; padding-left: 12px; border-left: 1px solid hsl(var(--border)); font-size: 14px; color: hsl(var(--muted-foreground)); }
  .sidebar { position: fixed; z-index: var(--z-drawer); top: 0; left: 0; bottom: 0; width: min(288px, 86vw); height: auto; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; }
  .shell.drawer .sidebar { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5); }
  .shell.drawer .scrim { display: block; position: fixed; z-index: var(--z-scrim); inset: 0; background: rgb(0 0 0 / 0.6); }
  .page { padding: 20px 16px 48px; }
  .content > .notice { margin: 16px 16px 0; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Under 16px, phones zoom the page when a field takes focus. */
  .input, .select select, .select .select-button { font-size: 16px; }
  .select.sm select, .select.sm .select-button { width: 112px; font-size: 16px; }
  .agents th:nth-child(3), .agents td:nth-child(3), .agents th:nth-child(5), .agents td:nth-child(5), .agent-id .chip { display: none; }
  .agents thead th:nth-child(1) { width: 46%; }
  .agents thead th:nth-child(2) { width: 22%; }
  .agents thead th:nth-child(4) { width: 32%; }
  .entries { --rail: 12px; --to-text: 14px; }
  /* The list of connections lies across the top. */
  .conns { grid-template-columns: minmax(0, 1fr); }
  .conn-list { grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); overflow-x: auto; border-right: 0; border-bottom: 1px solid hsl(var(--border)); }
  .conn-open { padding: 16px; }
}
@media (max-width: 560px) {
  .tile { padding: 10px 12px; }
  .tile dd { font-size: 20px; line-height: 28px; }
  .agents th:nth-child(4), .agents td:nth-child(4) { display: none; }
  .agents thead th:nth-child(1) { width: 68%; }
  .agents thead th:nth-child(2) { width: 32%; }
  tr.agent.sub td:first-child { padding-left: 20px; }
  .wide { display: none; }
  .page-head { flex-wrap: wrap; }
  .solo { padding-top: 32px; }
  .empty { padding: 16px; }
}
