/* keera-agents panel.
   One stylesheet, no build step. Tokens first, then layout, then components.
   The colours and components are shared with the Keera Gateway control panel
   and Keera Chat; change them in all three. What only this panel has, the
   board, the log and the task timeline, comes last. */

/* Space Grotesk is for titles and big figures; it is too wide for dense
   tables. The CSP allows fonts only from this origin. */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* For native parts the tokens cannot reach, like scrollbars. */
  color-scheme: light;
  /* Cool greys, to sit with the docs' white pages and the blue-black dark
     theme. */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #eff1f4;
  /* Translucent, so lines stay soft on glass as well as on a card. */
  --border: rgb(16 24 40 / 10%);
  --border-strong: rgb(16 24 40 / 18%);
  --text: #15171c;
  --muted: #636975;
  --faint: #8b919c;
  --accent: #1657c8;
  --accent-soft: #e7eefb;
  --accent-fg: #ffffff;
  --good: #1c7a4d;
  --good-soft: #e6f4ec;
  --warn: #9a5b00;
  --warn-soft: #fbf0dd;
  --bad: #a92a20;
  --bad-soft: #fbeae8;
  --s1: #1657c8;
  --s2: #1c7a4d;
  --s3: #9a5b00;
  --s4: #7b3fa0;
  --s5: #0e6d7c;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px -12px rgb(16 24 40 / 18%);
  --shadow-lg:
    0 1px 2px rgb(16 24 40 / 8%), 0 18px 48px -12px rgb(16 24 40 / 28%);
  /* Frosted glass, as in the docs' theme: what floats over the page lets it
     show through, blurred. */
  --glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --glass-bg: color-mix(in srgb, var(--bg) 72%, transparent);
  --veil: color-mix(in srgb, var(--bg) 55%, transparent);
  --blur: blur(8px) saturate(160%);
  --radius: 12px;
  --radius-sm: 8px;
  /* Scales the whole panel; viewport-height rules below divide by it. */
  --ui-scale: 1.1;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    /* The docs' dark ground: near-black with a touch of blue. */
    --bg: #0b0e13;
    --surface: #161a22;
    --surface-2: #1a1e27;
    --surface-3: #222731;
    --border: rgb(220 228 255 / 12%);
    --border-strong: rgb(220 228 255 / 20%);
    --text: #f8f9fb;
    --muted: #b6bcc6;
    --faint: #8b919e;
    --accent: #6ea8ff;
    --accent-soft: #172440;
    --accent-fg: #0b1220;
    --good: #57cb90;
    --good-soft: #13271e;
    --warn: #dfa445;
    --warn-soft: #29200f;
    --bad: #ef7b70;
    --bad-soft: #2b1818;
    --s1: #6ea8ff;
    --s2: #57cb90;
    --s3: #dfa445;
    --s4: #c193da;
    --s5: #58c2d2;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px -14px rgb(0 0 0 / 70%);
    --shadow-lg: 0 1px 2px rgb(0 0 0 / 50%), 0 24px 60px -12px rgb(0 0 0 / 80%);
  }
}

/* The same tokens, for dark chosen in the panel. One rule cannot match both a
   media query and a selector, and the CSP allows no inline script to set it
   before the first paint. */
:root[data-theme="dark"] {
  color-scheme: dark;
  /* The docs' dark ground: near-black with a touch of blue. */
  --bg: #0b0e13;
  --surface: #161a22;
  --surface-2: #1a1e27;
  --surface-3: #222731;
  --border: rgb(220 228 255 / 12%);
  --border-strong: rgb(220 228 255 / 20%);
  --text: #f8f9fb;
  --muted: #b6bcc6;
  --faint: #8b919e;
  --accent: #6ea8ff;
  --accent-soft: #172440;
  --accent-fg: #0b1220;
  --good: #57cb90;
  --good-soft: #13271e;
  --warn: #dfa445;
  --warn-soft: #29200f;
  --bad: #ef7b70;
  --bad-soft: #2b1818;
  --s1: #6ea8ff;
  --s2: #57cb90;
  --s3: #dfa445;
  --s4: #c193da;
  --s5: #58c2d2;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px -14px rgb(0 0 0 / 70%);
  --shadow-lg: 0 1px 2px rgb(0 0 0 / 50%), 0 24px 60px -12px rgb(0 0 0 / 80%);
}

* {
  box-sizing: border-box;
}

/* Components set their own display, which outranks the browser's rule for
   [hidden]. */
[hidden] {
  display: none !important;
}

html {
  zoom: var(--ui-scale);
}
html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.011em;
}
h1,
h2 {
  font-family: var(--display);
}
h1 {
  font-size: 19px;
}
/* A mark before a screen's title, such as an agent's icon. */
#page-title .avatar {
  display: inline-grid;
  vertical-align: middle;
  margin: -4px 8px 0 0;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 13px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.boot {
  display: grid;
  place-items: center;
  height: 100%;
}

.boot-mark {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-mark {
    animation-duration: 2s;
  }
  * {
    transition: none !important;
  }
}

/* Exactly the viewport height, not min-height, so a pane inside scrolls by
   itself instead of stretching the page. */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh / var(--ui-scale));
  transition: grid-template-columns 0.14s ease;
}

/* Floats beside the page, as the docs' navigation does. */
.sidebar {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin: 8px 0 8px 8px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: calc(100vh / var(--ui-scale) - 16px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* The space below is a margin, not padding, so the hover pill stays even. */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px;
  margin-bottom: 13px;
  border-radius: var(--radius-sm);
  font-family: var(--display);
  font-weight: 620;
  letter-spacing: -0.02em;
  font-size: 15px;
  color: inherit;
  transition:
    background 0.12s,
    color 0.12s;
}

.brand:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  text-decoration: none;
}

.brand-mark {
  display: block;
  border-radius: 6px;
  flex: none;
}

/* Shown only in the narrow layout, at the end of this file. Two classes to win
   over .btn, which comes later. */
.btn.nav-toggle,
.nav-scrim {
  display: none;
}

/* The sidebar's gap falls between groups, so a group sets it again between
   its items. */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: none;
  font: inherit;
  font-family: var(--display);
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition:
    background 0.12s,
    color 0.12s;
}
.nav-item:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
  text-decoration: none;
}
.nav-item[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.nav-highlight {
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.nav-collapse {
  padding: 5px 10px;
  color: var(--faint);
  font-size: 12.5px;
}
/* The margin keeps the smaller icon centred under the others. */
.nav-collapse svg {
  width: 14px;
  height: 14px;
  margin: 0 1px;
  transition: transform 0.14s ease;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
}
/* Sets the account apart from the navigation, as in Keera Chat. */
.sidebar-rule {
  margin: 8px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.account:hover,
.account[aria-expanded="true"] {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.account-more svg {
  display: block;
  width: 16px;
  height: 16px;
  color: var(--faint);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font: 600 12px var(--display);
  letter-spacing: 0.02em;
}
.avatar svg {
  width: 15px;
  height: 15px;
}
.account-id {
  flex: 1;
  min-width: 0;
  display: grid;
}
.account-name,
.account-org {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-name {
  font-size: 13.5px;
  font-weight: 550;
}
.account-org {
  font-size: 12px;
  color: var(--muted);
}

/* Every view scrolls here, under the topbar, so the sidebar stays put and
   the topbar's glass has something to blur. */
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Out of the layout, so the topbar sticks to the scrolling .main. */
.topbar-host {
  display: contents;
}

/* The page's own colour and no edge, as in Keera Chat: a band would end
   oddly beside the floating sidebar. The edge shows once content scrolls
   under it. */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid transparent;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  position: sticky;
  top: 0;
  z-index: 20;
}
@supports (animation-timeline: scroll()) {
  .topbar {
    animation: topbar-edge linear both;
    animation-timeline: scroll(nearest block);
    animation-range: 0 24px;
  }
}
@keyframes topbar-edge {
  to {
    border-bottom-color: var(--border);
  }
}
/* A list's buttons, moved here on a wide screen. */
.topbar-actions {
  display: contents;
}
.page-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.content {
  padding: 24px 28px 64px;
  width: 100%;
  flex: 1 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s,
    border-color 0.12s,
    opacity 0.12s;
}
.btn:hover:not(:disabled) {
  background: var(--surface-3);
  /* For a link styled as a button. */
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  filter: brightness(1.08);
}
.btn-danger {
  color: var(--bad);
  border-color: var(--border-strong);
}
.btn-danger:hover:not(:disabled) {
  background: var(--bad-soft);
  border-color: var(--bad);
}
/* Danger in a dialog footer that has a primary button too. */
.btn-delete {
  color: var(--bad);
}
.btn-delete:hover:not(:disabled) {
  background: var(--bad-soft);
  border-color: var(--bad);
}
.btn-quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
}
.btn-quiet:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text);
}
.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}
/* A switch outside a segmented control, such as Live. */
.btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
/* Sized like the range picker beside it. */
.btn-live {
  padding: 5px 11px;
  font-size: 12.5px;
}
.btn svg {
  width: 15px;
  height: 15px;
}

.input,
.select {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  width: 100%;
  min-width: 0;
}
.input:focus,
.select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
/* After .input, whose font would win. */
.input.mono {
  font-family: var(--mono);
}
.input::placeholder {
  color: var(--faint);
}
/* The browser's arrow differs per platform and ignores the theme. */
.select {
  cursor: pointer;
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* Where the browser allows it, the open list matches the panel. */
@supports (appearance: base-select) {
  .select,
  .select::picker(select) {
    appearance: base-select;
  }
  /* The arrow above stays; this one is heavier and points sideways while open. */
  .select::picker-icon {
    display: none;
  }
  .select::picker(select) {
    margin-block: 4px;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    color: var(--text);
    box-shadow: var(--shadow);
  }
  .select option {
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
  }
  .select option:hover,
  .select option:focus-visible {
    background: var(--surface-3);
    outline: none;
  }
  .select option:checked {
    color: var(--accent);
  }
  .select option::checkmark {
    color: var(--accent);
  }
  .select option:disabled {
    color: var(--faint);
    cursor: not-allowed;
  }
}

/* Being disabled is the form's only explanation, so it must look it. */
.input:disabled,
.select:disabled {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.field:has(> .input:disabled) > label,
.field:has(> .select:disabled) > label,
.field label.row-tight:has(> input:disabled) {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 5px;
  /* Otherwise, in a .field-row, a wrapping hint makes one input taller than
     the one beside it. */
  align-content: start;
  margin-bottom: 14px;
}
.field label {
  font-size: 12.5px;
  font-weight: 550;
}

.hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  /* So the field with less below it is not stretched. */
  align-items: start;
}

/* A part of a form that starts closed, such as Advanced. */
.fold {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.fold > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
}
.fold[open] > summary {
  margin-bottom: 12px;
}
.fold > :last-child {
  margin-bottom: 0;
}
.fold .field:last-child,
.fold .field-row:last-child .field {
  margin-bottom: 0;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  cursor: pointer;
  color: var(--muted);
  border-right: 1px solid var(--border);
}
.seg button:last-child {
  border-right: 0;
}
.seg button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.seg-icons button {
  display: grid;
  place-items: center;
  padding: 5px 8px;
}
.seg-icons svg {
  width: 15px;
  height: 15px;
}

/* A choice made before the form, for modes whose fields differ and that need
   a logo or sentence an <option> cannot hold. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  /* Every row as tall as the tallest, so a wrapped last row is not shorter. */
  grid-auto-rows: 1fr;
  gap: 8px;
}
.tile {
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.tile:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.tile[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tile-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--accent);
}
/* Avoids a second accent wash on the chosen tile. */
.tile[aria-pressed="true"] .tile-mark {
  background: var(--surface);
}
.tile-mark svg {
  width: 16px;
  height: 16px;
}
/* A logo keeps its proportions, so a wide wordmark is not squared off. */
.tile-mark .provider-mark {
  width: 18px;
  height: 18px;
}
/* Beside a name in a table row. */
.tile-mark-sm {
  flex: none;
  margin-bottom: 0;
}

/* An API connector's tools, in its form. */
.tool-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tool-list li .pill {
  margin-left: 6px;
}
.tile-name {
  font-size: 13px;
  font-weight: 600;
}
.tile-what {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* The choice once made: one row, with a way back. */
.tile-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tile-chosen > svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-body {
  padding: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}
/* .grid spaces by its gap, so no margin of its own. */
.grid > .detail-head {
  margin-bottom: 0;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat-value {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin-top: 6px;
  line-height: 1.15;
}
.stat-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Looks like plain text until hovered. */
.row-link {
  color: var(--text);
  font-weight: 600;
}
.row-link:hover {
  color: var(--accent);
}

.detail-head {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
/* A list's head without an intro, once its buttons moved to the topbar. */
.detail-head:empty {
  display: none;
}

/* The only thing on a detail screen that names its list. */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  width: fit-content;
}
.crumb:hover {
  color: var(--text);
  text-decoration: none;
}
.crumb svg {
  width: 14px;
  height: 14px;
}

/* A heading outside a card, above a table. */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

/* Something switched off: dimmed, not hidden, so it can be switched on. */
.row-faint td {
  opacity: 0.55;
}

.facts {
  display: grid;
  gap: 11px;
}
.fact {
  display: grid;
  grid-template-columns: minmax(0, 110px) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
/* A row that opens or acts on a click anywhere in it. */
tr.row-opens,
.table-tiles > .row-opens {
  cursor: pointer;
}
tr.row-opens:hover td {
  background: var(--surface-2);
}
.table-tiles > .row-opens:hover {
  border-color: var(--accent);
}
td.num,
th.num {
  text-align: right;
}
td.shrink,
th.shrink {
  width: 1%;
  white-space: nowrap;
}
/* Buttons line up on the right, even when another row has more. */
td.actions {
  text-align: right;
}
td.actions > .row,
td.actions > .row-tight {
  justify-content: flex-end;
}

/* A sortable header is a real button, so the keyboard reaches it. */
th .th-sort {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
th .th-sort:hover {
  color: var(--text);
}
th[aria-sort] .th-sort {
  color: var(--text);
}
/* The arrow goes left, so it stays next to the number. */
th.num .th-sort {
  flex-direction: row-reverse;
  align-items: baseline;
}
.sort-arrow {
  font-size: 10px;
  line-height: 1;
}

/* Replaces the rows when a search leaves none: an empty table under a search
   box looks like a list that lost its contents. */
.table-none {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.toolbar-search {
  width: auto;
  flex: 0 1 260px;
}
.toolbar-select {
  width: auto;
}
.toolbar-end {
  margin-left: auto;
}
.btn-sort {
  align-self: stretch;
  justify-content: center;
  padding: 0 10px;
}

/* At most five tiles in a row, as more are hard to read across. The minimum
   is a fifth of the row, less the gaps. */
.table-tiles {
  --tile-gap: 10px;
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(260px, (100% - 4 * var(--tile-gap)) / 5), 1fr)
  );
  gap: var(--tile-gap);
}
.table-tiles > .table-none {
  grid-column: 1 / -1;
}

.model-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.model-tile-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.model-tile-head .tile-mark {
  flex: none;
  width: 36px;
  height: 36px;
  margin-bottom: 0;
}
.model-tile-head .tile-mark svg {
  width: 20px;
  height: 20px;
}
.model-tile-head .tile-mark .provider-mark {
  width: 24px;
  height: 24px;
}
.model-tile-name {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.model-tile-what {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}
/* At the bottom, so the numbers line up across a row of tiles. */
.model-tile-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.model-tile-facts dt {
  font-size: 11px;
  color: var(--faint);
}
.model-tile-facts dd {
  margin: 2px 0 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}
.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.pill-good {
  background: var(--good-soft);
  color: var(--good);
}
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Marks differ in proportion, so they share the text's height. */
.provider-mark {
  height: 1em;
  width: auto;
  flex: none;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill-button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.pill-button:hover {
  filter: brightness(1.06);
}
a.pill-button:hover {
  text-decoration: none;
}

/* Prose an administrator wrote, so it keeps their line breaks. */
.prompt-text {
  white-space: pre-wrap;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.5;
}

/* Two lines in a table cell, enough to tell filters apart. */
.clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
}

/* Waiting on something other than a chat token, such as a model check. */
.blip {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.1s ease-in-out infinite;
}

/* The dot on the Live switch, so a stopped stream does not look like no
   traffic. */
.blip[data-state="live"] {
  animation: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.blip[data-state="connecting"] {
  background: var(--warn);
}
.blip[data-state="paused"] {
  background: var(--faint);
  animation: none;
}
.blip[data-state="stopped"] {
  background: var(--bad);
  animation: none;
}

.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 11.5px;
}
.spacer {
  flex: 1;
}
.nowrap {
  white-space: nowrap;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-tight {
  display: flex;
  align-items: center;
  gap: 5px;
}
.stack {
  display: grid;
  gap: 3px;
}
.wrap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.key-value {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  word-break: break-all;
  user-select: all;
}

/* Charts, drawn as SVG by chart.js. A part of Keera Gateway's: this panel
   draws no series or legend. */
.chart {
  width: 100%;
  display: block;
}
.chart .grid-line {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .axis-text {
  fill: var(--faint);
  font-size: 10px;
}
.chart .area {
  fill: var(--accent);
  opacity: 0.11;
}
.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .err-bar {
  fill: var(--bad);
  opacity: 0.75;
}
.chart .hit {
  fill: transparent;
  cursor: crosshair;
}
.chart .hit:hover {
  fill: var(--text);
  opacity: 0.04;
}
.chart .cursor-line {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 5;
}
.chart-tip .t {
  font-weight: 600;
  margin-bottom: 3px;
}
.chart-holder {
  position: relative;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .blip {
    animation: none;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--veil);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 0.12s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: min(520px, 100%);
  max-height: calc(88vh / var(--ui-scale));
  display: flex;
  flex-direction: column;
}
.modal-wide {
  width: min(680px, 100%);
}
.modal-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.modal-body {
  padding: 18px;
  overflow-y: auto;
}
/* No extra space above the footer's border. */
.modal-body > :last-child,
.modal-body > form > :last-child,
.modal-body > .stack > :last-child {
  margin-bottom: 0;
}
/* modal()'s hidden submit button. Browsers submit on Enter only if it is
   rendered, so it is shrunk to nothing, not hidden. */
.submit-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.modal-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

.toasts {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 200;
  display: grid;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 13px;
  font-size: 13px;
  animation: rise 0.15s ease-out;
}
.toast.bad {
  border-left-color: var(--bad);
}
.toast.good {
  border-left-color: var(--good);
}
.toast.warn {
  border-left-color: var(--warn);
}

.menu {
  position: fixed;
  z-index: 150;
  width: 240px;
  max-width: calc(100vw / var(--ui-scale) - 16px);
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg);
  animation: rise 0.1s ease-out;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  outline: none;
  text-decoration: none;
}
.menu-item > svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.menu-label {
  flex: 1;
  min-width: 0;
  display: grid;
}
.menu-hint {
  font-size: 12px;
  color: var(--muted);
}
.menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--border);
}
.menu-who {
  display: grid;
  padding: 7px 9px;
}
.menu-who strong,
.menu-who span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-who span {
  font-size: 12.5px;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.signin {
  min-height: calc(100vh / var(--ui-scale));
  display: grid;
  place-items: center;
  padding: 24px;
}
.signin-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px;
}
.signin-card .btn {
  width: 100%;
  justify-content: center;
}
.signin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.signin-providers {
  display: grid;
  gap: 10px;
}
.signin-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.55;
}
.banner {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.banner-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.banner-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.banner-info {
  background: var(--accent-soft);
  color: var(--accent);
}
.banner-good {
  background: var(--good-soft);
  color: var(--good);
}

/* Numbered steps, worked down once. */
.steps {
  display: grid;
  gap: 14px;
}

.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.step-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  flex: none;
}

/* The first-run checklist adds two states: done, and next. */
.step-done {
  opacity: 0.62;
}
.step-done .step-n {
  background: var(--good-soft);
  color: var(--good);
}
.step-done .step-n svg {
  width: 13px;
  height: 13px;
}
.step-now {
  border-color: var(--accent);
}

/* A large icon, with the number or tick as a badge in its corner. */
.step-icon {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  justify-self: start;
}
.step-icon > svg {
  width: 30px;
  height: 30px;
}
.step-icon .step-n {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 22px;
  height: 22px;
  font-size: 11px;
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 0 0 2px var(--surface);
}
.step-done .step-icon {
  background: var(--good-soft);
  color: var(--good);
}
.step-done .step-icon .step-n {
  background: var(--good);
  color: var(--surface);
}

.step-body {
  min-width: 0;
}
.step-body p {
  margin: 0 0 10px;
}
.step-body p:last-child {
  margin-bottom: 0;
}
.step-body code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Above the getting started guide: where work comes from, the agent and
   where it works, joined by lines drawn from the lists' rows to its edges.
   The class names are Keera Gateway's, where the middle is the gateway. */
.flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px auto 56px minmax(0, 1fr);
  row-gap: 10px;
  margin: 0 0 28px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.flow-head {
  grid-row: 1;
  grid-column: 1;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.flow-head-end {
  grid-column: 5;
}
/* Equal rows with no gap: the lines end at fixed fractions of the list's
   height, so each must meet the middle of a row. */
.flow-list {
  grid-row: 2;
  display: grid;
  grid-auto-rows: 1fr;
}
.flow-tools {
  grid-column: 1;
}
.flow-models {
  grid-column: 5;
}
.flow-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 4px 0;
  padding: 8px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.flow-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-item > svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.flow-item > .provider-mark {
  width: auto;
  height: 16px;
}
.flow-item > .provider-mark-wide {
  height: 11px;
}
.flow-item > .brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}
.flow-lines {
  grid-row: 2;
  display: block;
  align-self: stretch;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
}
.flow-gateway {
  grid-row: 2;
  grid-column: 3;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.flow-gateway > strong {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.flow-gateway ul {
  display: grid;
  gap: 5px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.flow-gateway li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.flow-gateway li svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}
.flow figcaption {
  grid-row: 3;
  grid-column: 1 / -1;
  margin-top: 6px;
  text-align: center;
}

/* Too narrow for three columns: the parts stack, without lines. */
@media (max-width: 616px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }
  .flow > * {
    grid-row: auto;
    grid-column: 1;
  }
  .flow-lines {
    display: none;
  }
  .flow-head {
    order: 1;
  }
  .flow-tools {
    order: 2;
  }
  .flow-gateway {
    order: 3;
    align-self: stretch;
  }
  .flow-head-end {
    order: 4;
  }
  .flow-models {
    order: 5;
  }
  .flow figcaption {
    order: 6;
  }
  .flow-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .flow-item {
    margin: 0;
  }
}

@media (min-width: 991px) {
  .shell.nav-collapsed {
    grid-template-columns: 68px 1fr;
  }
  .nav-collapsed .sidebar {
    padding: 16px 10px;
  }
  .nav-collapsed .nav-text {
    display: none;
  }
  /* Collapsed, there is no room for headings, so a rule shows the groups. */
  .nav-collapsed .nav-label {
    display: none;
  }
  .nav-collapsed .nav-group + .nav-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .nav-collapsed .brand {
    justify-content: center;
    padding: 5px 0;
    gap: 0;
  }
  .nav-collapsed .nav-item {
    justify-content: center;
    padding: 8px 0;
  }
  .nav-collapsed .nav-collapse {
    padding: 6px 0;
  }
  .nav-collapsed .nav-collapse svg {
    transform: rotate(180deg);
  }
  .nav-collapsed .account {
    justify-content: center;
    padding: 5px 0;
  }
}

@media (max-width: 990px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
  /* The drawer, off the left edge until opened. Its height is set like the
     sidebar's, as the page is zoomed by --ui-scale and a viewport
     unit is not. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(264px, 82vw);
    height: calc(100vh / var(--ui-scale) - 16px);
    box-shadow: var(--shadow-lg);
    transform: translateX(calc(-100% - 16px));
    /* So the keyboard cannot tab into a closed drawer. */
    visibility: hidden;
    transition:
      transform 0.18s ease,
      visibility 0.18s;
  }
  .nav-open .sidebar {
    transform: none;
    visibility: visible;
  }
  .nav-scrim {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: calc(100vw / var(--ui-scale));
    height: calc(100vh / var(--ui-scale));
    background: var(--veil);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .btn.nav-toggle {
    display: inline-flex;
    flex: none;
  }
  /* Collapsing would save nothing: the drawer covers the page either way. */
  .nav-collapse {
    display: none;
  }
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 616px) {
  /* The topbar now holds the menu button too, so it truncates the title
     instead of pushing the other controls off the row. */
  .topbar {
    gap: 8px;
    padding: 12px 16px;
  }
  .topbar .stack {
    min-width: 0;
  }
  #page-title {
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .select {
    max-width: 36vw;
  }
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .fact {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .step {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .toolbar-search {
    flex: 1 1 100%;
  }
}

/* ---------------------------------------------- What only this panel has */

/* Sign-in, as Keera Chat draws it. */
.signin-title {
  font: 600 24px var(--display);
  letter-spacing: -0.02em;
}
.signin-lead {
  margin: 6px 0 22px;
  color: var(--muted);
}
.btn-signin {
  padding: 10px 14px;
  font-size: 14px;
}
.btn-signin svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

/* Task results and comments are Markdown, rendered as Keera Chat renders replies. */
.md {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p {
  margin: 0 0 0.85em;
}
.md-h {
  margin: 1.3em 0 0.5em;
  font-family: var(--display);
  letter-spacing: -0.015em;
  line-height: 1.3;
}
h2.md-h {
  font-size: 1.3em;
}
h3.md-h {
  font-size: 1.12em;
}
h5.md-h,
h6.md-h {
  font-size: 1em;
}
.md ul,
.md ol {
  margin: 0 0 0.85em;
  padding-left: 1.6em;
}
.md li {
  margin: 0.25em 0;
}
.md li > p {
  margin: 0 0 0.5em;
}
.md blockquote > :last-child,
.md li > :last-child {
  margin-bottom: 0;
}
.md li > ul,
.md li > ol {
  margin: 0.25em 0;
}
.md li::marker {
  color: var(--muted);
}
.md blockquote {
  margin: 0 0 0.85em;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.md hr {
  margin: 1.4em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.md a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}
.md code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--surface-3);
  font-size: 0.88em;
}
.md-table {
  margin: 0 0 0.85em;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.md th,
.md td {
  padding: 7px 12px;
  vertical-align: top;
}
.md th {
  background: var(--surface-2);
}
.codeblock {
  margin: 0 0 0.85em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
  font: 12px var(--mono);
  color: var(--muted);
}
.codeblock-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font: 12px var(--sans);
  cursor: pointer;
}
.codeblock-copy:hover {
  background: var(--surface);
  color: var(--text);
}
.codeblock-copy svg {
  width: 13px;
  height: 13px;
}
.codeblock pre {
  margin: 0;
  padding: 11px 13px;
  overflow-x: auto;
  tab-size: 4;
}
.md .codeblock code {
  padding: 0;
  background: none;
  font-size: 12.5px;
  line-height: 1.55;
}

/* Tabs on a detail screen: the segmented control, a little larger. */
.tabs {
  justify-self: start;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  padding: 6px 13px;
  font-size: 13px;
  white-space: nowrap;
}
.tab-count {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
}
.tabs [aria-selected="true"] .tab-count {
  color: inherit;
}

/* A checkbox with a line on what it does, such as a built-in tool. */
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
/* Outranks .field label, which would make the hint bold too. */
.field label.check-row,
label.check-row {
  font-size: 13px;
  font-weight: 400;
}
.check-row input {
  margin: 3px 0 0;
}
.check-row:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.check-name {
  font-weight: 550;
}

/* Someone, or an agent, with a small round mark. */
.avatar-sm {
  width: 20px;
  height: 20px;
  font-size: 9px;
}
.avatar-sm svg {
  width: 12px;
  height: 12px;
}
.avatar-agent {
  background: var(--accent-soft);
  color: var(--accent);
}
/* An agent's icon beside its name in the form, and the grid to choose one. */
.icon-pick {
  flex: none;
  padding: 0 5px;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.icon-grid button {
  display: grid;
  place-items: center;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-grid button:hover {
  background: var(--surface);
  color: var(--text);
}
.icon-grid button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.icon-grid svg {
  width: 18px;
  height: 18px;
}

/* .source is where a task came from: a chat, a schedule, a card, a folder or
   a person. */
.who,
.source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.who > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source > svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
}

/* A short list inside a card, such as the dashboard's recent tasks. */
.mini-list {
  display: grid;
}
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.mini-row:last-child {
  border-bottom: 0;
}
a.mini-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.mini-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}

/* The kanban board. Columns scroll sideways rather than squeeze. */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  align-items: start;
}
.kanban-col {
  --status: var(--faint);
  display: flex;
  flex-direction: column;
  min-height: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    border-color 0.12s,
    background 0.12s;
}
.kanban-col[data-status="todo"] {
  --status: var(--s1);
}
.kanban-col[data-status="in_progress"] {
  --status: var(--s3);
}
.kanban-col[data-status="review"] {
  --status: var(--s4);
}
.kanban-col[data-status="done"] {
  --status: var(--s2);
}
.kanban-col.drop-target {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
}
.kanban-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 8px 14px;
}
.kanban-head h2 {
  font-size: 13.5px;
}
.kanban-head .dot {
  width: 8px;
  height: 8px;
  color: var(--status);
}
.kanban-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
}
.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 60px;
  padding: 2px 8px 10px;
}
.kanban-card {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
  cursor: grab;
}
.kanban-card:hover {
  border-color: var(--border-strong);
}
.kanban-card:focus-visible {
  outline-offset: 1px;
}
.kanban-card.dragging {
  opacity: 0.4;
}
.kanban-card.saving {
  opacity: 0.7;
}
.kanban-title {
  padding-right: 24px;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.kanban-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.kanban-meta .pill {
  font-size: 11px;
  padding: 1px 7px;
}
.kanban-meta svg {
  width: 12px;
  height: 12px;
}
.kanban-menu {
  position: absolute;
  top: 5px;
  right: 5px;
  opacity: 0;
}
.kanban-card:hover .kanban-menu,
.kanban-card:focus-within .kanban-menu,
.kanban-menu[aria-expanded="true"] {
  opacity: 1;
}
/* No hover on a touch screen, so the menu always shows. */
@media (hover: none) {
  .kanban-menu {
    opacity: 1;
  }
}
/* Where a dragged card will land. */
.kanban-drop {
  height: 3px;
  margin: -2.5px 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* An agent's container output, as it arrives. */
.log-pane {
  margin: 0;
  height: calc(62vh / var(--ui-scale));
  min-height: 240px;
  overflow: auto;
  padding: 12px 14px;
  background: var(--surface-2);
  font: 12px/1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}

/* A task's steps, oldest first. */
.timeline {
  display: grid;
}
.tl-item {
  --kind: var(--muted);
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.tl-item:last-child {
  border-bottom: 0;
}
.tl-message {
  --kind: var(--accent);
}
.tl-tool_call {
  --kind: var(--s4);
}
.tl-tool_result {
  --kind: var(--s5);
}
.tl-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--kind) 14%, transparent);
  color: var(--kind);
}
.tl-icon svg {
  width: 12px;
  height: 12px;
}
.tl-body {
  min-width: 0;
  font-size: 13px;
}
.tl-logline {
  font: 12px/1.55 var(--mono);
  color: var(--muted);
}
.tl-at {
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}
.tl-details > summary {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12.5px;
}
.tl-details > summary strong {
  color: var(--text);
  font-weight: 550;
}
.tl-details pre {
  max-height: 320px;
  margin: 6px 0 0;
  padding: 8px 10px;
  overflow: auto;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A card's comments. */
.comments {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.comment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
}
.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}
.comment-body {
  margin-top: 2px;
  font-size: 13px;
}

/* A folder picker over a connector's files. */
.folder-list {
  display: grid;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.folder-item:last-child {
  border-bottom: 0;
}
.folder-item:hover,
.folder-item:focus-visible {
  background: var(--surface-2);
}
.folder-item svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--muted);
}

/* When a schedule runs, checked as it is chosen. */
.preview {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px;
}
.preview ol {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted);
}
.preview-bad {
  border-color: transparent;
  background: var(--bad-soft);
  color: var(--bad);
}

@media (max-width: 616px) {
  /* One column and a bit of the next, so it is clear the board scrolls. */
  .kanban {
    grid-auto-columns: minmax(230px, 84%);
    scroll-snap-type: x mandatory;
  }
  .kanban-col {
    scroll-snap-align: start;
  }
  .check-grid {
    grid-template-columns: 1fr;
  }
  .tl-item {
    grid-template-columns: 22px minmax(0, 1fr);
  }
  .tl-at {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}
