* { box-sizing: border-box; }

html { background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--text); }

h1, h2, h3 { margin: 0; }
h2 { font: 600 18px/1.25 var(--head); letter-spacing: -0.02em; }
h3 { font-size: 13px; font-weight: 500; margin-bottom: 6px; }

code { font: 13px var(--mono); overflow-wrap: anywhere; }

.num { text-align: right; }
.lead { font-size: 16px; margin: 0; }


/* Layout: a fixed sidebar beside the page (app/nav.py, _sidebar.html), or a slim header on
   pages outside the app. */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 12px; }
.skip:focus { left: 8px; }
.brand { display: inline-flex; align-items: baseline; color: var(--text); font: 700 19px/1 var(--logo); letter-spacing: -0.04em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.layout-sidebar { padding-left: 232px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 232px; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 12px; background: var(--ground); border-right: 1px solid var(--border); overflow-y: auto; }
.side-top { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 16px; margin-bottom: 10px; border-bottom: 1px solid var(--divider); }
.side-org { font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-link { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; min-height: 34px; padding: 6px 8px; color: var(--muted); font: 14px var(--sans); text-align: left; background: transparent; border: 0; cursor: pointer; }
.side-link:hover { color: var(--text); background: var(--hover); }
.side-link[aria-current="page"] { color: var(--text); background: var(--accent-wash); box-shadow: inset 2px 0 0 var(--accent); }
.side-link[aria-current="page"] .side-icon { color: var(--accent-text); }
.side-icon { flex: none; }
.side-sub { padding-left: 33px; font-size: 13.5px; min-height: 32px; }
.side-group > summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary .side-link { flex: 1; min-width: 0; }
.side-group[data-current] > summary .side-link { color: var(--text); }
.side-group .chev { display: grid; place-items: center; width: 28px; height: 34px; color: var(--muted); }
.side-group .chev:hover { color: var(--text); }
.side-group .chev svg { width: 12px; height: 12px; transition: transform 0.15s; }
.side-group[open] .chev svg { transform: rotate(90deg); }
.side-me { position: relative; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--divider); }
.side-me > summary, .account-menu > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 6px 8px; cursor: pointer; color: var(--text); }
.side-me > summary::-webkit-details-marker, .account-menu > summary::-webkit-details-marker { display: none; }
.side-me > summary:hover, .side-me[open] > summary { background: var(--hover); }
.side-me-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side-me-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me-role { font-size: 12px; color: var(--muted); }
.avatar { flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--border); color: var(--text); font: 500 11px var(--mono); }
.menu-panel { position: absolute; z-index: 40; width: 240px; display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 12px 32px var(--shadow); }
.side-me .menu-panel { left: 0; bottom: calc(100% + 6px); width: 100%; box-sizing: border-box; }
.account-menu { position: relative; }
.account-menu .menu-panel { right: 0; top: calc(100% + 6px); }
.menu-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--divider); overflow-wrap: anywhere; }
.menu-full { font-weight: 500; }
.menu-panel form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--divider); }
.menu-panel .menu-logout { display: block; width: 100%; min-height: 34px; padding: 8px; text-align: left; font-size: 14px; color: var(--error-text); background: transparent; border: 0; cursor: pointer; }
.menu-panel .menu-logout:hover { background: var(--error-bg); }
.chrome-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1120px; margin: 0 auto; padding: 18px 32px; box-sizing: border-box; }
.theme-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--border); cursor: pointer; }
.theme-button:hover { color: var(--text); border-color: var(--border-strong); }
.mobile-bar, .side-backdrop { display: none; }

/* Buttons and forms */
button { font: inherit; cursor: pointer; }
.btn-outline {
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0 14px;
  min-height: 36px;
  font-weight: 500;
  transition: border-color .15s ease;
}
.btn-outline:hover { border-color: var(--border-strong); color: var(--text); }
/* The one action to take on a page: signal yellow with ink text, as on maglev.sh. */
.btn-primary {
  background: var(--signal);
  color: var(--on-signal);
  border: 1px solid var(--signal);
  padding: 0 20px;
  min-height: 42px;
  font-weight: 500;
  transition: filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.06); color: var(--on-signal); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a.btn-primary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.narrow { max-width: 480px; margin: 0 auto; padding: 88px 24px; display: flex; flex-direction: column; gap: 24px; }
.form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-actions > button { flex: 1 1 180px; }
.connect-scope { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
/* One style for every input and select: the same height, border, radius and padding. */
.field input, .field select, .filter input, .filter select, .row-form select {
  font: 14px var(--sans);
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--input-border);
  background-color: var(--surface);
  color: var(--text);
  width: 100%;
  min-width: 0;
}
.field select, .filter select, .row-form select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238B8B93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.narrow .field input { font-size: 15px; height: 48px; padding: 0 14px; }
.field input:focus, .field select:focus, .filter input:focus, .filter select:focus, .row-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.error-message { color: var(--error-text); margin: 0; overflow-wrap: anywhere; }

/* Page */
.page { max-width: 1120px; margin: 0 auto; padding: 32px 32px 72px; box-sizing: border-box; display: flex; flex-direction: column; gap: 24px; }
.display { font: 600 28px/1.1 var(--head); letter-spacing: -0.03em; }
.narrow .display { font-size: 36px; line-height: 1.05; letter-spacing: -0.035em; }
.title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; }
.session-title { font: 600 26px/1.15 var(--head); letter-spacing: -0.03em; overflow-wrap: anywhere; }
.back { font-size: 14px; align-self: flex-start; }

/* Live indicator */
.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 13px var(--mono);
  color: var(--neutral-text);
  background: var(--neutral-bg);
  padding: 6px 12px;
}
.live-pill .dot { width: 8px; height: 8px; background: var(--faint); }
.live-pill.on { color: var(--accent-text); background: var(--accent-wash); }
.live-pill.on .dot { background: var(--accent); }

/* Cards and tiles */
.card { background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.card.flush { overflow: hidden; }
.card-head {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 12px;
  border-bottom: 1px solid var(--divider);
}
.card-head.column { flex-direction: column; align-items: flex-start; }
.empty { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.empty p { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.tile-label { font: 400 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tile-value { font: 500 28px/1.2 var(--mono); letter-spacing: -0.04em; }
.tile-value.small-value { font-size: 22px; }
.tile-note { font-size: 13px; color: var(--muted); }
.bar { height: 6px; background: var(--row-line); }
.bar-fill { height: 6px; background: var(--text); }
.bar-fill.bar-full { background: var(--error-text); }

/* Budgets */
.budget { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.budget-text { color: var(--muted); white-space: nowrap; }
.budget-cell { width: 240px; }
.budget-card { padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.budget-card > .stack-xs { flex: 1 1 280px; max-width: 480px; }
.row-muted td { color: var(--muted); }
.table-budgets { min-width: 640px; }
.budget-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.budget-input { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--input-border); padding: 0 10px; background: var(--surface); }
.budget-input:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.budget-input span { color: var(--muted); font: 13px var(--mono); }
.budget-input input { border: 0; outline: 0; width: 90px; padding: 7px 0; font: 14px var(--mono); background: transparent; color: var(--text); }
.budget-form + .error-message { margin-top: 6px; font-size: 13px; }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 12px var(--mono);
  padding: 3px 10px;
  white-space: nowrap;
}
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }
.chip-error { background: var(--error-bg); color: var(--error-text); }
.chip-running { background: var(--accent-wash); color: var(--accent-text); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.is-open, .side-group .chev svg { transition: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.25; } }
}

/* Tables */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 14px; }
.table th {
  text-align: left;
  font: 400 11px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 20px;
  white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 11px 20px; border-top: 1px solid var(--row-line); vertical-align: middle; }
.table td.mono { font-size: 13px; }
.table tr.row-error td { background: var(--error-row); }
.sid {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.tool-link { color: var(--text); font-size: 13px; }
/* Takes the leftover width and cuts long arguments with an ellipsis. */
.tool-cell { max-width: 0; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-recent { min-width: 560px; }
.nowrap { white-space: nowrap; }
.args { overflow-wrap: anywhere; }

.look-empty { margin: 0; padding: 16px 20px; }

/* Session timeline */
.call-head, .call-row {
  display: grid;
  grid-template-columns: 32px 92px minmax(0, 1fr) 80px 72px 64px 150px;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}
.call-head {
  font: 500 12px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.calls { margin: 0; padding: 0; list-style: none; }
.call { border-top: 1px solid var(--row-line); }
.call.error { background: var(--error-row); border-top-color: var(--error-line); }
.call-row { cursor: pointer; list-style: none; font-size: 14px; }
.call-row::-webkit-details-marker { display: none; }
.call-row:hover { background: var(--hover); }
details[open] > .call-row { background: var(--neutral-bg); }
.call-n { color: var(--faint); font-size: 12px; }
.call-time { color: var(--muted); font-size: 13px; }
.call-tool { min-width: 0; overflow-wrap: anywhere; }
.call-tool .mono { font-size: 13px; font-weight: 500; }
.call-tool .args { color: var(--faint); font-size: 13px; }
.call-latency, .call-results, .call-cost { font-size: 13px; color: var(--muted); }
.call-error { grid-column: 3 / -1; color: var(--error-text); font-size: 13px; overflow-wrap: anywhere; }
.call-body {
  padding: 4px 20px 20px 156px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.call-body section { min-width: 0; }
.code {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  padding: 14px 16px;
  font: 12.5px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
}
.empty pre { margin: 0; border: 1px solid var(--border); background: var(--code-bg); color: var(--code-text); padding: 14px 16px; font: 13px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Phone widths */
@media (max-width: 720px) {
  .layout-sidebar { padding-left: 0; }
  .mobile-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--ground); border-bottom: 1px solid var(--border); }
  .side-open { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--text); background: transparent; border: 1px solid var(--border); }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform 0.15s, visibility 0s 0.15s; }
  .sidebar.is-open, .sidebar:target { transform: none; visibility: visible; transition: transform 0.15s; box-shadow: 0 0 48px var(--shadow); }
  .side-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 25; background: var(--backdrop); }
  .chrome-bar { padding: 14px 16px; }
  .page { padding: 24px 16px 56px; }
  .narrow { padding: 48px 16px; }
  .display { font-size: 24px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 24px; }
  .call-head { display: none; }
  .call-row {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "tool tool tool status" "time latency cost ." "error error error error";
    gap: 4px 12px;
    padding: 12px 16px;
  }
  .call-n, .call-results { display: none; }
  .call-tool { grid-area: tool; }
  .call-status { grid-area: status; }
  .call-time { grid-area: time; }
  .call-latency { grid-area: latency; text-align: left; }
  .call-cost { grid-area: cost; text-align: left; }
  .call-error { grid-area: error; }
  .call-body { padding: 4px 16px 16px; grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 14px 16px; }
  .table th, .table td { padding-left: 16px; padding-right: 16px; }
  /* Budgets: agent and spend on one line, the form below, so Save stays in view. */
  .table-budgets { min-width: 0; }
  .table-budgets thead { display: none; }
  .table-budgets tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 16px; border-top: 1px solid var(--row-line); }
  .table-budgets tr:first-child { border-top: 0; }
  .table-budgets td { padding: 0; border: 0; }
  .table-budgets td:nth-child(1) { grid-area: 1 / 1; }
  .table-budgets td:nth-child(2) { grid-area: 2 / 1 / 3 / 3; }
  .table-budgets td:nth-child(3), .table-budgets td:nth-child(4) { display: none; }
  .table-budgets td:nth-child(5) { grid-area: 1 / 2; }
  .table-budgets td:nth-child(5)::after { content: " spent"; color: var(--muted); font-family: var(--sans); }
  /* An agent's sessions: id and status, then the budget bar; started and calls are on the session page. */
  .table-agent-sessions { min-width: 0; }
  .table-agent-sessions thead { display: none; }
  .table-agent-sessions tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--row-line); }
  .table-agent-sessions tr:first-child { border-top: 0; }
  .table-agent-sessions td { padding: 0; border: 0; }
  .table-agent-sessions td:nth-child(1) { grid-area: 1 / 1; min-width: 0; }
  .table-agent-sessions td:nth-child(1) .sid { max-width: 100%; }
  .table-agent-sessions td:nth-child(2) { grid-area: 1 / 2; }
  .table-agent-sessions td:nth-child(6) { grid-area: 1 / 3; }
  .table-agent-sessions td:nth-child(3), .table-agent-sessions td:nth-child(4) { display: none; }
  .table-agent-sessions td:nth-child(5) { grid-area: 2 / 1 / 3 / 4; width: auto; }
}

/* Phase 4: balance, ledger, tool health, all calls */
.balance-card { padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.chip-check { background: var(--error-bg); color: var(--error-text); }
.table-ledger { min-width: 560px; }
.table-health { min-width: 960px; }
.table-health td, .table-health th { white-space: nowrap; }
.table-all-calls { min-width: 760px; }
/* One filter bar: a grid of equal-width fields, the button in the last cell on the field baseline. */
.filters { padding: 16px 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px 16px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.filter-actions { display: flex; align-items: center; gap: 12px; min-height: 38px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 14px 20px; border-top: 1px solid var(--row-line); font-size: 14px; }
@media (max-width: 720px) {
  .filters { padding: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .filters-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.filters .btn-primary, .inline-form .btn-primary { min-height: 38px; padding: 0 16px; }

/* Tools */
.tool-about { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--divider); }
.tool-about p { margin: 0; }
/* A 2-column definition grid (Provider | REST, MCP | Usage); one column on a phone. */
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 40px; }
.facts div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.facts dt { font: 400 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.facts .endpoint { display: block; width: fit-content; margin-bottom: 6px; max-width: 100%; background: var(--neutral-bg); padding: 3px 8px; overflow-wrap: anywhere; }
.table-inputs { min-width: 640px; }
.table-providers { min-width: 720px; }
.table-providers td { vertical-align: top; }
.input-default { white-space: nowrap; }
@media (max-width: 720px) {
  .tool-about { padding: 14px 16px 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  /* A tool's inputs: name, type and required or default on one line, the description below. */
  .table-inputs { min-width: 0; }
  .table-inputs thead { display: none; }
  .table-inputs tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 12px 16px; border-top: 1px solid var(--row-line); }
  .table-inputs tr:first-child { border-top: 0; }
  .table-inputs td { padding: 0; border: 0; }
  .table-inputs td.input-default { white-space: normal; overflow-wrap: anywhere; }
  .table-inputs td:nth-child(4) { grid-column: 1 / -1; }
}

/* Phase 7 alignment pass */
.page > * { min-width: 0; max-width: 100%; }

/* Stat tiles: five across when there is room, 3 + 2 on a tablet, 2 + 2 + 1 on a phone. */
.tile-value { overflow-wrap: anywhere; }
.tiles-5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tiles-5 > * { grid-column: span 2; }
.tiles-5 > :nth-child(n + 4) { grid-column: span 3; }
@media (min-width: 1112px) {
  .tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tiles-5 > *, .tiles-5 > :nth-child(n + 4) { grid-column: auto; }
}
@media (max-width: 720px) {
  .tiles-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles-5 > *, .tiles-5 > :nth-child(n + 4) { grid-column: auto; }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Cells: names with a badge stay on one line; long values cut with an ellipsis (and a title). */
.name-cell { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.suffix { color: var(--muted); font-size: 13px; }
.trunc { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.trunc-lg { max-width: 420px; }
.table th.actions, .table td.actions { text-align: right; white-space: nowrap; }
.table-keys { min-width: 980px; }
.table-keys td.label { min-width: 140px; }
.table-members { min-width: 760px; }

/* Forms that sit on one row on a desktop and stack on a phone, like the filter bars. */
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0; }
.inline-form .field { flex: 1 1 220px; max-width: 420px; min-width: 0; }
.inline-form .field.narrow-field { flex: 0 1 160px; }
.inline-form > p { flex-basis: 100%; margin: 0; }
.inline-form > button { min-height: 38px; }
@media (max-width: 720px) {
  .inline-form .field, .inline-form .field.narrow-field { flex: 1 1 100%; max-width: none; }
  .inline-form > button { width: 100%; }
}
.card.form > .stack-sm, .card.form > form { min-width: 0; }

/* A table row's actions: the role select and its button, and Remove, on one line. */
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.row-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.row-form select { height: 36px; width: auto; min-width: 110px; }
.btn-danger { color: var(--error-text); border-color: var(--error-line); }
.btn-danger:hover { border-color: var(--error-text); background: var(--error-bg); }

}

/* Fix round 1 */
.filters-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters-five .filter-actions { grid-column: 1 / -1; }
@media (min-width: 860px) {
  .filters-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .filters-five .filter-actions { grid-column: auto; }
}
time { white-space: nowrap; }
/* The actions column stays in view at the right edge of a scrolling table. */
.table th.actions, .table td.actions { position: sticky; right: 0; background: var(--surface); border-left: 1px solid var(--divider); }
.table tr.row-error td.actions { background: var(--error-row); }

/* The Keys page's tool picker. */
.tool-picker { border: 1px solid var(--border); margin: 0; padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tool-picker legend { font-size: 14px; font-weight: 500; padding: 0 6px; }
.tool-mode { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; }
.tool-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 24px; }
.tool-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-group label, .tool-mode label { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.tool-group input, .tool-mode input { accent-color: var(--accent); margin: 0; }

/* Overview: the balance card, onboarding for a fresh organization, and a card per agent. */
.overview-balance { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.balance-facts { display: flex; flex-wrap: wrap; gap: 6px 28px; color: var(--muted); font-size: 14px; }
.balance-facts strong { color: var(--text); font-weight: 500; }
.balance-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.balance-actions a { display: inline-flex; align-items: center; color: var(--text); }
.balance-warning { margin: 0; color: var(--error-text); background: var(--error-bg); padding: 8px 12px; font-size: 14px; }
.onboarding { min-width: 0; }
.onboarding .get-started { padding-top: 8px; }
.get-started { width: 100%; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.get-started h2 { font-size: 18px; font-weight: 500; margin: 0; }
.get-started h2.muted { font-size: 16px; }
.get-started p { margin: 0; }
.get-started-fast { display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--surface); border: 1px solid var(--accent-line); min-width: 0; }
.get-started-fast .setup-prompt { font-size: 14px; padding: 14px 16px; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); overflow-wrap: anywhere; }
.get-started-fast .btn-primary { align-self: flex-start; min-height: 46px; padding: 0 22px; font-size: 15px; }
.agent-tabs { background: var(--surface); border: 1px solid var(--border); overflow: hidden; min-width: 0; }
.agent-tabs .client-picker { display: flex; width: auto; gap: 4px; padding: 8px; background: none; border-bottom: 1px solid var(--border); }
.agent-tabs .client-picker label { min-height: 44px; padding: 0 16px; }
.agent-tabs .client-picker label:has(input:checked) { background: var(--accent-wash); color: var(--accent-text); box-shadow: inset 0 -2px 0 var(--accent); }
.agent-tabs .client-panel { padding: 24px; }
.agent-tabs .client-panel > p { margin: 0 0 14px; }
.copy-row { display: flex; flex-wrap: wrap; gap: 10px; }
.copy-row code { flex: 1 1 300px; min-width: 0; font: 14px var(--mono); padding: 12px 14px; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); overflow-wrap: anywhere; }
.copy-row .btn-outline { min-height: 48px; padding: 0 20px; color: var(--text); }
.sign-in-status { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px dashed var(--input-border); color: var(--muted); font-size: 14px; }
.sign-in-status .status-dot { flex: none; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--accent); }
.sign-in-status.is-connected { color: var(--text); border-style: solid; border-color: var(--accent-line); }
.sign-in-status.is-connected .status-dot { background: var(--accent); }
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.agent-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.agent-card p { margin: 0; }
.agent-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
.agent-name { font: 500 15px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agent-stats div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agent-stats dt { font: 400 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.agent-stats dd { margin: 0; font: 500 17px var(--mono); }
.tool-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-tags li { font-size: 12px; background: var(--neutral-bg); color: var(--neutral-text); padding: 3px 8px; }
.agent-card-link { font-weight: 500; font-size: 14px; margin-top: auto; }
@media (max-width: 720px) {
  .overview-balance { padding: 18px; }
  .agent-card { padding: 18px; }
}

/* Sub-views inside a tab, such as Observability's Calls and Health. */

/* Sign-in: one card, centred in the space under the top bar. */
.signin { min-height: calc(100vh - 73px); box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding: 48px 16px 96px; }
.signin-card { width: 100%; max-width: 400px; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.signin-card p { margin: 0; }
.signin-title { font: 600 28px/1.1 var(--head); letter-spacing: -0.03em; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; background: var(--text); color: var(--on-light); font-weight: 500; font-size: 15px; }
.btn-google:hover { background: var(--inverse-hover); color: var(--on-light); }
.btn-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.signin-note { font-size: 13px; color: var(--muted); padding-top: 20px; border-top: 1px solid var(--divider); }
@media (max-width: 720px) {
  .signin { align-items: flex-start; min-height: 0; padding-top: 40px; }
  .signin-card { padding: 24px; }
}

/* Early access: unlimited credits and free tools. */
.credits-line .tile-value { font-family: var(--sans); font-weight: 500; letter-spacing: -0.03em; }
.credits-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* Onboarding: the agent picker, copyable commands and example prompts. */
.step-body { flex: 1 1 auto; min-width: 0; }
.client-panel { display: none; }
:is(.get-started, .connect):has(input[value="claude-code"]:checked) .client-panel[data-client="claude-code"],
:is(.get-started, .connect):has(input[value="cursor"]:checked) .client-panel[data-client="cursor"],
:is(.get-started, .connect):has(input[value="claude-desktop"]:checked) .client-panel[data-client="claude-desktop"],
:is(.get-started, .connect):has(input[value="codex"]:checked) .client-panel[data-client="codex"],
:is(.get-started, .connect):has(input[value="antigravity"]:checked) .client-panel[data-client="antigravity"],
:is(.get-started, .connect):has(input[value="other"]:checked) .client-panel[data-client="other"] { display: block; }

.client-panel > p { margin: 0 0 8px; }
.copy-block { display: flex; align-items: center; gap: 12px; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); padding: 12px 12px 12px 16px; min-width: 0; }
.copy-block pre, .copy-block p { flex: 1 1 auto; min-width: 0; margin: 0; }
.copy-block pre { font: 13px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--code-text); }
.copy-btn { flex: none; min-height: 30px; padding: 0 12px; font-size: 13px; }
/* Code blocks stay dark in both themes, so their Copy button keeps light text. */
.copy-block:not(.prompt) .copy-btn { color: var(--code-text); border-color: rgba(255, 255, 255, 0.24); }
.copy-block:not(.prompt) .copy-btn:hover { color: var(--code-text); border-color: rgba(255, 255, 255, 0.45); }
.setup-prompt p { font-size: 14px; }
.prompts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prompt { background: transparent; color: var(--text); align-items: center; }
.prompt p { font-size: 14px; }

/* Keys: the tool picker sits under Advanced on the create form. */
.advanced { border: 1px solid var(--border); min-width: 0; }
.advanced > summary { cursor: pointer; padding: 12px 16px; font-size: 14px; font-weight: 500; color: var(--muted); }
.advanced > summary:hover, .advanced[open] > summary { color: var(--text); }
.advanced > .tool-picker { border: 0; border-top: 1px solid var(--divider); }

/* A group's status: running, ok and failed counts side by side. */
.chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* A new key: the Copy button with its note, then the note that replaces it. */
.copy-key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.copied-note { margin: 0; color: var(--ok-text); }
