/* The console's look: a neutral palette with one accent, the system font, an 8 px grid, light and dark. */

:root {
  color-scheme: light dark;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #fafafb;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --surface-3: #ececf0;
  --border: #e5e5ea;
  --border-strong: #d2d2d9;
  --text: #17171c;
  --text-2: #50505a;
  --text-3: #85858f;
  --accent: #5b5bd6;
  --accent-hover: #4b4bc4;
  --accent-soft: #efeffd;
  --accent-text: #4545bd;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(16, 16, 24, 0.04), 0 1px 1px rgba(16, 16, 24, 0.02);
  --shadow-lg: 0 16px 48px rgba(16, 16, 24, 0.16), 0 2px 8px rgba(16, 16, 24, 0.08);

  --green: #1a9a4b; --green-soft: #e8f6ed; --green-text: #157a3c;
  --amber: #d97a06; --amber-soft: #fdf2e0; --amber-text: #a85b04;
  --red: #d93636; --red-soft: #fdeded; --red-text: #b42323;
  --blue: #2f6fe0; --blue-soft: #e9f0fd; --blue-text: #2257b8;
  --gray: #8a8a94; --gray-soft: #f0f0f3; --gray-text: #5c5c66;

  --series-1: #5b5bd6;
  --series-2: #12a594;
  --series-3: #e5932a;
  --series-4: #d6409f;
  --series-5: #3e8ce0;
  --series-6: #8e9b2c;

  --radius: 10px;
  --radius-sm: 6px;
  --header: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0e;
    --surface: #141417;
    --surface-2: #1b1b1f;
    --surface-3: #232328;
    --border: #26262c;
    --border-strong: #36363e;
    --text: #ececf0;
    --text-2: #a9a9b3;
    --text-3: #75757f;
    --accent: #7272ec;
    --accent-hover: #8585f2;
    --accent-soft: rgba(114, 114, 236, 0.15);
    --accent-text: #a6a6ff;
    --shadow: none;
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);

    --green: #3cc56d; --green-soft: rgba(60, 197, 109, 0.13); --green-text: #5fd88b;
    --amber: #f0a33a; --amber-soft: rgba(240, 163, 58, 0.14); --amber-text: #f4b55e;
    --red: #f26161; --red-soft: rgba(242, 97, 97, 0.14); --red-text: #ff8585;
    --blue: #5b98f5; --blue-soft: rgba(91, 152, 245, 0.15); --blue-text: #85b2fa;
    --gray: #75757f; --gray-soft: rgba(255, 255, 255, 0.06); --gray-text: #a9a9b3;

    --series-1: #7c7cf0;
    --series-2: #1fbfa9;
    --series-3: #f0a54a;
    --series-4: #e163b5;
    --series-5: #5fa2f0;
    --series-6: #a7b545;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: 15px; line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 14px; font-weight: 600; }
h1:focus { outline: none; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; }

.muted { color: var(--text-3); }
.small { font-size: 12px; line-height: 1.5; }
.text-red { color: var(--red-text); }
.text-amber { color: var(--amber-text); }
.key-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.label { font-size: 12px; font-weight: 550; color: var(--text-2); letter-spacing: 0.01em; }
.sr-only, .offscreen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: 8px; z-index: 100; padding: 8px 16px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); transform: translateY(-200%); }
.skip:not(:focus) { opacity: 0; pointer-events: none; }
.skip:focus { transform: none; }
.noscript { padding: 32px; text-align: center; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 32px; }
.grid-2 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }

/* ----------------------------------------------------------------------------------------------- header */

.header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { max-width: 1240px; margin: 0 auto; height: var(--header); padding: 0 24px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--on-accent); flex: none; }
.brand-mark svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark.lg svg { width: 44px; height: 44px; }
.tag { font-size: 11px; font-weight: 550; padding: 1px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber-text); }
.nav { display: flex; gap: 4px; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-name { display: grid; line-height: 1.25; min-width: 0; }
.who-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.who-name .muted { font-size: 11px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--accent-soft); color: var(--accent-text); flex: none; }

.main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; }
.main:focus { outline: none; }
.page { display: grid; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { display: grid; gap: 4px; min-width: 0; }
.page-head .muted { max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.updated { font-size: 12px; margin-right: 4px; white-space: nowrap; }

/* ---------------------------------------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 550; white-space: nowrap; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow); transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 5px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-icon { width: 32px; padding: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 88%, black); }
.btn-danger-ghost { color: var(--red-text); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, var(--border-strong)); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.copied { color: var(--green-text); }
.btn-primary.copied { color: var(--on-accent); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) transparent; animation: spin 0.8s linear infinite;
}
.btn-primary.busy::after, .btn-danger.busy::after { border-color: #fff transparent #fff transparent; }
.link-button { background: none; border: 0; padding: 0; color: var(--text); font-weight: 550; cursor: pointer; text-align: left; }
.link-button:hover { color: var(--accent-text); }

.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 550; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border); }

.input {
  height: 32px; width: 100%; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--red); }
.input::placeholder { color: var(--text-3); }
.select { width: auto; min-width: 180px; padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 30px; width: 260px; }

/* ------------------------------------------------------------------------------------------- pills etc. */

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px;
  border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--tone-soft); color: var(--tone-text);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); position: relative; }
.pill.pulse .dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: var(--tone); opacity: 0.5; animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite; }
.tone-green { --tone: var(--green); --tone-soft: var(--green-soft); --tone-text: var(--green-text); }
.tone-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); --tone-text: var(--amber-text); }
.tone-red { --tone: var(--red); --tone-soft: var(--red-soft); --tone-text: var(--red-text); }
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); --tone-text: var(--blue-text); }
.tone-gray { --tone: var(--gray); --tone-soft: var(--gray-soft); --tone-text: var(--gray-text); }

.model { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; display: inline-block; }
.code-badge { font-family: var(--mono); font-size: 11px; font-weight: 550; padding: 1px 6px; border-radius: 4px; background: var(--red-soft); color: var(--red-text); white-space: nowrap; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.id-row { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.id-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* ------------------------------------------------------------------------------------------------ cards */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.card-head p { font-size: 12px; margin-top: 2px; }
.card-note { margin-top: 12px; }

.banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--tone-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); }
.banner > .icon { color: var(--tone-text); margin-top: 2px; }
.banner-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.banner .btn { flex: none; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 8px; background: var(--tone-soft); }
.callout > .icon { color: var(--tone-text); margin-top: 2px; }
.empty { display: grid; justify-items: center; gap: 4px; padding: 40px 16px; text-align: center; color: var(--text-3); }
.empty.compact { padding: 24px 16px; }
.empty .btn { margin-top: 12px; }
.empty-title { color: var(--text); font-weight: 600; }
.ok-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft); color: var(--green-text); margin-bottom: 4px; }

.skeleton-group { display: grid; gap: 8px; }
.skeleton {
  border-radius: var(--radius); min-height: 16px;
  background: linear-gradient(90deg, var(--surface-2) 0, var(--surface-3) 50%, var(--surface-2) 100%) var(--surface-2);
  background-size: 800px 100%; animation: shimmer 1.4s linear infinite;
}

/* ------------------------------------------------------------------------------------------------ pools */

.pool-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.pool { display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; }
.pool::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--gray); opacity: 0.6; }
.pool-running::before { background: var(--green); }
.pool-starting::before { background: linear-gradient(90deg, transparent, var(--amber), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: sweep 2s ease-in-out infinite; opacity: 1; }
@keyframes sweep { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.pool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pool-head h3 { font-size: 16px; font-weight: 650; }
.pool-head h3 .muted { font-weight: 450; }
.pool-message { color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 24px; }
.facts > div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.facts dd { overflow-wrap: anywhere; }
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts .wide { grid-column: 1 / -1; }
.facts-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 24px; }
.facts-inline { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.workers { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.workers ul { display: grid; gap: 8px; }
.workers li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; min-height: 24px; }
.worker-state { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.pool-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }

.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 12px; color: var(--text-3); }
.stepper li { display: grid; gap: 6px; }
.step-dot { height: 4px; border-radius: 2px; background: var(--surface-3); }
.stepper .done { color: var(--text-2); }
.stepper .done .step-dot { background: var(--amber); opacity: 0.55; }
.stepper .current { color: var(--amber-text); font-weight: 600; }
.stepper .current .step-dot { background: var(--amber); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------------------------------------------- KPIs */

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 4px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-warn .kpi-value { color: var(--amber-text); }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi-mini { padding: 12px; box-shadow: none; background: var(--surface-2); }
.kpi-mini .kpi-value { font-size: 18px; }

/* ------------------------------------------------------------------------------------------------ chart */

.chart { min-height: 260px; }
.chart-plot { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-dasharray: 2 3; }
.chart .axis { stroke: var(--border-strong); }
.chart .tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .bar { cursor: default; outline: none; }
.chart .bar.active .hit, .chart .bar:focus-visible .hit { fill: var(--surface-2); }
.chart .bar:focus-visible .hit { stroke: var(--accent); stroke-width: 2px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 168px; padding: 8px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12px; display: grid; gap: 2px;
}
.tooltip[hidden] { display: none; }
.tooltip-total { color: var(--text-3); margin-bottom: 4px; }
.tooltip-row { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; }
.tooltip-row .num { font-variant-numeric: tabular-nums; font-weight: 550; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }

/* ----------------------------------------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card:not(.flush) > .table-wrap { margin: 0 -20px; }
.dialog .table th:first-child, .dialog .table td:first-child { padding-left: 0; }
.dialog .table th:last-child, .dialog .table td:last-child { padding-right: 0; }
.card:not(.flush) > .table-wrap .table th:first-child, .card:not(.flush) > .table-wrap .table td:first-child { padding-left: 20px; }
.card:not(.flush) > .table-wrap .table th:last-child, .card:not(.flush) > .table-wrap .table td:last-child { padding-right: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.card.flush .table th { background: var(--surface-2); padding-top: 10px; padding-bottom: 10px; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 20px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 20px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.linked { cursor: pointer; }
.table tr.dim td:not(.mobile-cell) { color: var(--text-3); }
.table tbody tr { transition: background 0.1s; }
.table tr.linked:hover td { background: var(--surface-2); }
.table time, .nowrap { white-space: nowrap; }
.table-wrap.scrolls td { white-space: nowrap; }
.row-link { color: var(--text); }
.cell-title { display: grid; line-height: 1.35; }
.cell-title .muted { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .note { max-width: 260px; min-width: 160px; color: var(--text-2); }
.table .prompt { max-width: 340px; color: var(--text-2); }
.table .mobile-cell { display: none; }
.sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.table th.sticky { z-index: 2; }

div.mobile-card { cursor: default; }
.dialog .mobile-card { padding-left: 0; padding-right: 0; }
.mobile-card { display: grid; gap: 4px; width: 100%; padding: 14px 16px; text-align: left; color: var(--text); background: none; border: 0; cursor: pointer; font-size: 13px; }
a.mobile-card:hover { text-decoration: none; }
.mobile-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mobile-meta { margin-top: 2px; }

.load-more { display: flex; justify-content: center; }
.load-more .banner { width: 100%; }

/* ------------------------------------------------------------------------------------------- failures */

.failures { display: grid; margin: -8px -12px; }
.failure { display: grid; gap: 4px; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.failure:hover { background: var(--surface-2); text-decoration: none; }
.failure-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.failure-meta { margin-left: auto; white-space: nowrap; }
.failure-message { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------------------------------------- dialogs */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 64px); padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
  flex-direction: column;
}
.dialog[open] { display: flex; animation: rise 0.16s ease-out; }
.dialog-sm { width: min(460px, calc(100vw - 32px)); }
.dialog-md { width: min(640px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 10, 16, 0.45); backdrop-filter: blur(2px); animation: fade 0.16s ease-out; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 20px 0; }
.dialog-head h2 { font-size: 16px; }
.dialog-head p { margin-top: 4px; font-size: 13px; }
.dialog-head .btn-icon { margin: -6px -8px 0 0; }
.dialog-body { padding: 16px 20px 20px; overflow-y: auto; color: var(--text-2); }
.dialog-body p + p { margin-top: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dialog-error:not(:empty) { margin-top: 12px; }
.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); border-radius: 0; border-width: 0 0 0 1px; }
.drawer[open] { animation: slide 0.2s ease-out; }
.drawer .dialog-body { flex: 1; }
.drawer-state { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.drawer-state a { display: inline-flex; align-items: center; gap: 6px; }
.note-block { padding: 12px; border-radius: 8px; background: var(--surface-2); color: var(--text); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 550; color: var(--text); }
.hint { font-size: 12px; color: var(--text-3); }

.secret { display: grid; gap: 12px; padding: 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); }
.secret-head { display: flex; align-items: center; gap: 8px; color: var(--accent-text); }
.secret-row { display: flex; align-items: center; gap: 8px; }
.secret-value { flex: 1; min-width: 0; font-size: 13px; padding: 8px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere; user-select: all; }
.secret-warning { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--amber-text); }
.secret-warning .icon { margin-top: 2px; }
.secret-warning span { color: var(--text-2); }
.secret-warning strong { color: var(--amber-text); }

/* ------------------------------------------------------------------------------------------- code blocks */

.code { position: relative; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); min-width: 0; }
.code-label { font-size: 11px; font-weight: 550; color: var(--text-3); padding: 12px 92px 0 12px; }
/* Long commands wrap rather than scroll: what's copied is the original text */
.code pre { margin: 0; padding: 12px 92px 12px 12px; font-size: 12.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.code-label + pre { padding: 4px 12px 12px; }
.code-copy { position: absolute; top: 6px; right: 6px; }
.dialog .code pre { max-height: 260px; overflow-y: auto; }

/* ------------------------------------------------------------------------------------------------ jobs */

.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.job-head { display: flex; justify-content: space-between; gap: 16px; }
.job-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-prompt { font-size: 15px; color: var(--text); max-width: 80ch; }
.job-message { color: var(--text-2); }
.facts .model { white-space: normal; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s; }
.error-box p + p { margin-top: 6px; }
.error-message { color: var(--text); font-weight: 500; }
.outputs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.output { display: grid; gap: 16px; }
.output-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.output audio { width: 100%; height: 40px; }
.outputs-wide { grid-template-columns: minmax(0, 1fr); }
.output-warn { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.output-foot { display: grid; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.warning-box { border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.warnings { list-style: disc; padding-left: 18px; display: grid; gap: 4px; color: var(--text-2); }
.check { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
blockquote { margin: 0; }
.heard { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text); }
.fold { border-top: 1px solid var(--border); padding-top: 12px; }
.fold summary { cursor: pointer; list-style-position: outside; margin-left: 16px; }
.fold summary::marker { color: var(--text-3); }
.fold[open] summary { margin-bottom: 8px; }
.table-wrap.inner .table th { background: transparent; }
.table-wrap.inner .table th:first-child, .table-wrap.inner .table td:first-child { padding-left: 0; }
.table-wrap.inner .table th:last-child, .table-wrap.inner .table td:last-child { padding-right: 0; }
.table-wrap.narrow { max-width: 560px; }
.table .said { min-width: 240px; color: var(--text); }
.table td.nowrap { white-space: nowrap; vertical-align: top; }
.table-wrap.inner td { vertical-align: top; }
.speaker { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; white-space: nowrap; }
.swatch.round { border-radius: 50%; }
.script { display: grid; gap: 10px; }
.script li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.script p { color: var(--text-2); }
.table-wrap.inner .mobile-card { padding-left: 0; padding-right: 0; }
.status-warn { display: inline-flex; align-items: center; gap: 6px; }
.warn-mark { display: inline-grid; place-items: center; color: var(--amber-text); }

/* ---------------------------------------------------------------------------------------------- voices */

.voice-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); align-items: start; }
.voice { display: grid; gap: 12px; }
.voice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.voice-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voice-title h3 { font-size: 15px; }
.voice-meta { display: block; }
.voice-id { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -6px; }
.voice audio { width: 100%; height: 40px; }
.voice-deleted { background: var(--surface-2); box-shadow: none; }
.voice-deleted h3 { color: var(--text-2); }
.kind { font-size: 11px; font-weight: 550; padding: 1px 8px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-text); }
.consent { display: grid; gap: 8px; padding: 12px; border-radius: 8px; background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.consent-head { display: flex; align-items: center; gap: 8px; color: var(--blue-text); }
.consent blockquote { font-size: 13px; color: var(--text); }
.consent .facts-inline { gap: 8px 20px; }

/* ---------------------------------------------------------------------------------------------- agents */

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; padding: 28px; background:
  radial-gradient(600px 240px at 0% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.hero-text { display: grid; gap: 12px; align-content: start; }
.hero-text h2 { font-size: 20px; letter-spacing: -0.01em; }
.hero-text p { color: var(--text-2); max-width: 56ch; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.link-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); color: var(--text); transition: border-color 0.12s; }
.link-card:hover { border-color: var(--border-strong); text-decoration: none; background: var(--surface-2); }
.link-icon { grid-row: span 2; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); }
.link-text { display: grid; gap: 2px; }
.link-text strong { display: inline-flex; align-items: center; gap: 6px; }
.link-text strong .icon { color: var(--text-3); }
.link-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.points li { display: flex; gap: 12px; align-items: flex-start; }
.point-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); flex: none; }

/* --------------------------------------------------------------------------------------- whole screens */

.splash, .screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.splash { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--text-3); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.screen-card { width: min(440px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; padding: 40px 32px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.screen-card h1 { margin-top: 8px; font-size: 20px; }
.screen-card .muted { color: var(--text-2); overflow-wrap: anywhere; }
.screen-card strong { color: var(--text); font-weight: 600; }
.screen-actions { margin-top: 12px; display: flex; gap: 8px; }

.toaster { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); animation: rise 0.16s ease-out; transition: opacity 0.3s; }
.toast.leaving { opacity: 0; }

/* ---------------------------------------------------------------------------------------------- narrow */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .header-inner { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 0 16px; }
  .brand { height: 52px; }
  .nav { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .who-name { display: none; }
}

@media (max-width: 640px) {
  .main { padding: 20px 16px 48px; }
  .stack-lg { gap: 24px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .search, .page-actions .search .input { flex: 1; width: 100%; }
  .page-actions .select { flex: 1; }
  .updated { margin-right: auto; }
  .hide-sm { display: none; }
  .card { padding: 16px; }
  .card:not(.flush) > .table-wrap { margin: 0 -16px; }
  .card:not(.flush) > .table-wrap .table th:first-child, .card:not(.flush) > .table-wrap .table td:first-child { padding-left: 16px; }
  .card:not(.flush) > .table-wrap .table th:last-child, .card:not(.flush) > .table-wrap .table td:last-child { padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 20px; }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .facts-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper { font-size: 11px; }
  .pool-foot { flex-wrap: wrap; }
  .failure-meta { margin-left: 0; width: 100%; }
  .table-wrap.has-mobile thead { display: none; }
  .table-wrap.has-mobile td { display: none; }
  .table-wrap.has-mobile td.mobile-cell { display: block; padding: 0 !important; }
  .table-wrap.has-mobile tr.linked:hover td { background: none; }
  .table-wrap.has-mobile tr:active td.mobile-cell { background: var(--surface-2); }
  .job-head { flex-direction: column; }
  .script li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .table-wrap.has-mobile.inner td.mobile-cell { border-bottom: 1px solid var(--border); }
  .dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border-width: 1px 0 0; }
  .dialog-sm, .dialog-md { width: 100%; }
  .drawer { height: 92dvh; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .dialog-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dialog-foot .btn { flex: 1; }
  .secret-row { flex-direction: column; align-items: stretch; }
  .hero { padding: 20px; gap: 24px; }
  .hero-actions .btn { flex: 1; }
  .code:not(:has(.code-label)) pre { padding: 40px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
