:root {
  color-scheme: light;
  --canvas: #fff;
  --subtle: #f6f9fc;
  --surface: #fff;
  --raised: #eef1f6;
  --line: #e5eaf2;
  --outline: #d5dbe7;
  --ink: #0d1b3d;
  --muted: #4f5b76;
  --quiet: #6b7a99;
  --accent: #5546f0;
  --action: #5546f0;
  --on-action: #fff;
  --selected: #eef0ff;
  --on-selected: #3d34c4;
  --mint: #0b6b36;
  --ok-bg: #e6f6ec;
  --warn: #8a5300;
  --warn-bg: #fff8ec;
  --error: #a02549;
  --error-bg: #fff1f5;
  --navy: #0d1b3d;
  --chart-main: #6a5bf2;
  --chart-secondary: #ac5719;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0a0f22;
  --subtle: #0d1329;
  --surface: #121933;
  --raised: #1a2340;
  --line: #1f2947;
  --outline: #2e3960;
  --ink: #f2f5ff;
  --muted: #a9b4d0;
  --quiet: #8795b8;
  --accent: #a99cff;
  --selected: #1e2556;
  --on-selected: #c3c9ff;
  --mint: #5fd08f;
  --ok-bg: #12301f;
  --warn: #ffc98f;
  --warn-bg: #2a201d;
  --error: #ffc0d4;
  --error-bg: #421c33;
  --navy: #060a18;
  --chart-main: #a99cff;
  --chart-secondary: #ffae76;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 var(--sans); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Wrap a native single-choice select in .select-control. */
.select-control {
  position: relative;
  display: inline-block;
  min-inline-size: 0;
  max-inline-size: 100%;
}
.select-control > select {
  appearance: none;
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 40px;
  padding-block: 6px;
  padding-inline: 13px 36px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--canvas);
  cursor: pointer;
  text-overflow: ellipsis;
}
.select-control::after {
  content: '';
  position: absolute;
  inset-inline-end: 15px;
  inset-block-start: calc(50% - 5px);
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  pointer-events: none;
}
.select-control > select:enabled:hover { border-color: var(--accent); }
.select-control:has(> select:disabled) { color: var(--muted); }
.select-control > select:disabled { cursor: default; }
@media (forced-colors: active) {
  .select-control::after { display: none; }
  .select-control > select { appearance: auto; padding-inline-end: 13px; }
}

/* Requests and conversations in both workspaces. */
.activity-list {
  container: activity-list / inline-size;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: clip;
}
.activity-list > .table-wrap,
.activity-list > .table-scroll { border: 0; border-radius: 0; overflow: visible; }
.activity-list > .table-tools {
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.activity-list table { width: 100%; table-layout: fixed; white-space: normal; }
.activity-list th { background: var(--subtle); color: var(--muted); font: 620 12px/1.3 var(--sans); letter-spacing: 0; }
.activity-list th, .activity-list td { padding: 13px 16px; vertical-align: top; }
.activity-list td { min-width: 0; overflow-wrap: anywhere; }
.activity-list .activity-name, .activity-list .activity-id { display: block; }
.activity-list .activity-name { color: var(--ink); font-weight: 640; }
.activity-list .activity-id { font-size: 12px; }
.activity-list .activity-secondary { color: var(--muted); font-size: 12px; }
.activity-list .activity-number, .activity-list time { font-variant-numeric: tabular-nums; }
.activity-list .activity-label { display: none; }
.activity-list th.activity-state { width: 110px; }
.activity-list th.activity-time { width: 125px; }
.activity-list th.activity-duration, .activity-list th.activity-revision { width: 86px; }
.activity-list th.activity-usage { width: 23%; }
.activity-list th.activity-owner { width: 20%; }
.activity-list th.activity-action { width: 170px; }
.activity-list .activity-state .pill, .activity-list .activity-badge {
  display: inline-flex;
  margin: 0;
  padding: 3px 8px;
  background: var(--raised);
  color: var(--ink);
  border-radius: 999px;
  font: 630 11px/1.5 var(--sans);
  white-space: nowrap;
}
.activity-list .activity-state .pill.green, .activity-list .activity-badge.success { background: var(--ok-bg); color: var(--mint); }
.activity-list .activity-state .pill.red, .activity-list .activity-badge.error { background: var(--error-bg); color: var(--error); }
.activity-list .activity-state .pill.amber, .activity-list .activity-badge.warning { background: var(--warn-bg); color: var(--warn); }
.activity-list .activity-token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin: 0;
}
.activity-list .activity-token-grid dt { color: var(--muted); font-size: 11px; }
.activity-list .activity-token-grid dd { margin: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.activity-list .activity-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.activity-list .activity-pagination > div { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.activity-list nav.activity-pagination button[type="button"],
.activity-list td.activity-action button.activity-read {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--outline);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 610;
}
.activity-list nav.activity-pagination button[type="button"]:hover:enabled,
.activity-list td.activity-action button.activity-read:hover { border-color: var(--accent); color: var(--accent); }
.activity-list > .empty { border: 0; border-radius: 0; padding: 32px 18px; }
@container activity-list (max-width: 720px) {
  .activity-list table, .activity-list tbody { display: block; }
  .activity-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .activity-list tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
    align-items: start;
    gap: 10px 16px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .activity-list tbody tr:last-child { border-bottom: 0; }
  .activity-list td { padding: 0; border: 0; }
  .activity-list .activity-state, .activity-list .activity-time, .activity-list .activity-action { justify-self: end; text-align: right; }
  .activity-list .activity-usage, .activity-list .activity-owner { grid-column: 1 / -1; }
  .activity-list .activity-action { grid-column: 2; }
  .activity-list .table-search-empty td { grid-column: 1 / -1; }
  .activity-list .activity-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 620; }
  .activity-list .activity-token-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
  .activity-list nav.activity-pagination button[type="button"],
  .activity-list td.activity-action button.activity-read { min-height: 44px; }
}
@container activity-list (max-width: 400px) {
  .activity-list .activity-token-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
h1, h2, h3, p { margin: 0; }
code, pre { font-family: var(--mono); }
pre { overflow: auto; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--outline); border-radius: 8px; }
dialog::backdrop { background: #0709119c; backdrop-filter: blur(3px); }
.toast {
  --toast-inset: clamp(12px, 2.2vw, 24px);
  position: fixed;
  z-index: 20;
  inset: calc(env(safe-area-inset-top, 0px) + var(--toast-inset))
    calc(env(safe-area-inset-right, 0px) + var(--toast-inset)) auto auto;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(360px, calc(100% - var(--toast-inset) * 2 - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  margin: 0;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 28px #07091125;
  font: 620 13px/1.4 var(--sans);
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
  transform-origin: top right;
}
.toast:popover-open { display: flex; }
.toast:not([popover]) { display: flex; }
.toast.visible { opacity: 1; animation: toast-enter 280ms cubic-bezier(.16, 1, .3, 1) both; }
.toast.leaving { animation: toast-leave 180ms ease-in both; }
.toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--selected);
  color: var(--on-selected);
}
.toast-icon::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.toast[data-tone="success"] .toast-icon { background: var(--ok-bg); color: var(--mint); }
.toast[data-tone="success"] .toast-icon::before {
  width: 5px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  border-radius: 0;
  background: none;
  transform: translateY(-1px) rotate(45deg);
}
.toast[data-tone="error"] .toast-icon { background: var(--error-bg); color: var(--error); }
.toast[data-tone="error"] .toast-icon::before { content: '!'; width: auto; height: auto; background: none; }
@keyframes toast-enter {
  from { opacity: 0; transform: translate(6px, -12px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-leave {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translate(4px, -8px) scale(.985); }
}
@media (prefers-reduced-motion: reduce) { .toast.visible, .toast.leaving { animation: none; } }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--outline);
  border-radius: 6px;
  background: var(--surface);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  margin-bottom: 8px;
}
.panel > .table-tools { border: 0; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.table-tools label { display: grid; gap: 4px; font-size: 12px; margin: 0; }
.table-tools input { max-width: 100%; padding: 7px 10px; border: 1px solid var(--outline); border-radius: 6px; background: var(--canvas); }
.table-tools output { color: var(--muted); font-size: 12px; }
.metric-link:hover, a.stat-detail:hover { background: var(--selected); }
.refresh-meta { color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
