/* EzRouter dashboard — page-specific styles.
   Tokens + shared nav live in ../shared/tokens.css */

/* ─── Layout shell ──────────────────────────────────────────────────────── */
html,
body {
  height: 100%;
  overflow: hidden;
}

#app {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.site-nav {
  flex: 0 0 var(--nav-height);
}

.app-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.app-sidebar {
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
}
.app-sidebar__section {
  margin: var(--space-4) 0 var(--space-1);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.app-sidebar__section:first-child { margin-top: 0; }
.app-sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.app-sidebar__link:hover { background: var(--accents-1); color: var(--text); }
.app-sidebar__link.is-active { background: var(--accents-2); color: var(--text); font-weight: 500; }
.app-sidebar__link-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.app-sidebar__spacer { display: none; }
.app-sidebar__docs {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.app-mobile-nav {
  display: none;
  position: relative;
}
.app-mobile-nav__button {
  width: auto;
  min-width: 108px;
  max-width: 148px;
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.app-mobile-nav__button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand);
}
.app-mobile-nav__label {
  min-width: 0;
  display: block;
  text-align: left;
}
.app-mobile-nav__label small {
  display: none;
}
.app-mobile-nav__label strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-mobile-nav__chevron {
  width: 8px;
  height: 8px;
  margin: -3px 1px 0 0;
  flex: 0 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.app-mobile-nav.is-open .app-mobile-nav__chevron {
  transform: rotate(-135deg);
}
.app-mobile-nav__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 90;
  width: min(276px, calc(100vw - var(--space-8)));
  max-height: min(420px, calc(100vh - var(--nav-height) - 96px));
  overflow-y: auto;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.app-mobile-nav__section {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.app-mobile-nav__item {
  min-height: 40px;
  margin-top: 2px;
}

.site-nav__action-link[href="/doc/"],
.app-sidebar__docs,
.quickstart__text a[href="/doc/"],
.site-footer__links a[href="/doc/"] {
  display: none !important;
}

.app-main {
  padding: var(--space-8) var(--space-8) var(--space-8);
  max-width: var(--container-wide);
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  min-height: 0;
  overflow-y: auto;
}

.site-footer {
  flex: 0 0 auto;
  margin-top: 0;
  padding: var(--space-5) 0;
}

.site-nav__profile {
  position: relative;
  display: flex;
  align-items: center;
}
.site-nav__profile-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-2) 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.site-nav__profile-button:hover,
.site-nav__profile.is-open .site-nav__profile-button {
  border-color: var(--border-strong);
  background: var(--accents-1);
}
.site-nav__profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.site-nav__profile-name {
  max-width: 136px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
.site-nav__profile-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 80;
  min-width: 168px;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.site-nav__profile-menu-name {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-nav__profile-menu-item {
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.site-nav__profile-menu-item:hover {
  background: var(--accents-1);
}

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.flash--toast {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-3));
  right: var(--space-5);
  z-index: 120;
  width: min(420px, calc(100vw - var(--space-8)));
  margin: 0;
  animation: toastIn 0.18s ease-out;
}
.flash--inline {
  position: static;
  max-width: none;
  margin: 0;
  box-shadow: none;
}
.flash--success {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.25);
  color: #166534;
}
.flash--error {
  background: rgba(255, 26, 26, 0.08);
  border-color: rgba(255, 26, 26, 0.2);
  color: #b42318;
}
.flash--info {
  background: rgba(0, 112, 243, 0.08);
  border-color: rgba(0, 112, 243, 0.2);
  color: #0050b3;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-banner {
  max-width: var(--container-wide);
  margin: var(--space-4) auto 0;
  padding: 0 var(--space-6);
  color: var(--text-muted);
  font-size: 14px;
}

.panel-stack {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.card__body--flush {
  padding: 0;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.info-list__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}
.info-list__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.subtle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}
.empty-state h3 {
  font-size: 18px;
}
.empty-state p {
  color: var(--text-muted);
  max-width: 56ch;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.table-wrap--tokens {
  overflow-x: auto;
}

.modal__footer--split {
  justify-content: space-between;
  align-items: center;
}

.billing-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: var(--space-4);
  align-items: end;
}

.filter-card {
  margin-bottom: var(--space-5);
}
.filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: var(--space-4);
  align-items: end;
}
.filter-grid--logs {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}
.filter-actions {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  align-self: end;
}
.filter-actions .btn {
  height: 47px;
  border-radius: var(--radius);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.pager__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.payment-summary {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accents-1);
  margin-bottom: var(--space-4);
}
.payment-summary__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: 13px;
}
.payment-summary__line span {
  color: var(--text-muted);
}

.payment-summary--checkout {
  background: #f7f8fa;
  border-color: var(--border);
  color: var(--text);
  margin: 0;
}
.payment-summary--checkout .payment-summary__line {
  padding: 2px 0;
}
.payment-summary--checkout .payment-summary__line span {
  color: var(--text-muted);
}
.payment-summary--checkout .payment-summary__line strong {
  color: var(--text);
}

/* ─── Page head ────────────────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}
.page-head__text h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
  margin: 0;
}
.page-head__text p {
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
  max-width: 60ch;
}
.page-head__action { flex-shrink: 0; }

/* ─── KPI row ──────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  min-width: 0;
  margin-bottom: var(--space-6);
}
.kpi {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.kpi__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.kpi__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi__delta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.kpi__delta--up { color: #16a34a; }
.kpi__delta--down { color: var(--danger); }
.kpi__delta-label { color: var(--text-faint); margin-left: 4px; }

/* ─── Overview two-column grid ─────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-4);
  min-width: 0;
  margin-bottom: var(--space-6);
}

/* ─── Generic card ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}
.card__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.card__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.card__body { padding: var(--space-5); }

/* ─── Segmented control ────────────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.segmented button {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── Chart ───────────────────────────────────────────────────────────── */
.chart {
  width: 100%;
  height: 260px;
  display: block;
}
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__area { fill: var(--brand-soft); }
.chart__line { fill: none; stroke: var(--brand); stroke-width: 1.75; }
.chart__axis {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-faint);
  letter-spacing: 0.04em;
}

/* ─── Top models ──────────────────────────────────────────────────────── */
.top-models { display: flex; flex-direction: column; gap: var(--space-3); }
.top-model {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: center;
}
.top-model__name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.top-model__share {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.top-model__bar {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--accents-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.top-model__bar span {
  display: block;
  height: 100%;
  background: var(--text);
  border-radius: 999px;
}
.top-model:first-child .top-model__bar span { background: var(--brand); }

/* ─── Recent activity ─────────────────────────────────────────────────── */
.recent { font-family: var(--font-mono); font-size: 12px; }
.recent__row {
  display: grid;
  grid-template-columns: 66px 1fr auto;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  border-top: 1px solid var(--border);
  color: var(--text);
  align-items: center;
}
.recent__row:first-child { border-top: none; }
.recent__time { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.recent__model { color: var(--text); }
.recent__model small { color: var(--text-faint); margin-left: 4px; font-weight: 400; }
.recent__cost {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
}

/* ─── Quick start ─────────────────────────────────────────────────────── */
.quickstart {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: center;
  min-width: 0;
  max-width: 100%;
}
.quickstart__text,
.quickstart__snippet {
  min-width: 0;
}
.quickstart__text h3 {
  font-size: 18px;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}
.quickstart__text p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 var(--space-4);
  max-width: 44ch;
}
.quickstart__snippet {
  position: relative;
  max-width: 100%;
  background: #0a0a0a;
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
}
.quickstart__snippet pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #e8e8e8;
  white-space: pre;
}
.quickstart__snippet .tk-prompt { color: var(--brand); user-select: none; }
.quickstart__snippet .tk-flag { color: #ffaa66; }
.quickstart__snippet .tk-str { color: #a6e3a1; }

/* ─── Data table (shared with API keys) ───────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.data-table tbody td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--accents-1); }
.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.data-table .cell-muted { color: var(--text-muted); }
.data-table .cell-actions { text-align: right; }
.data-table .cell-actions button {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.data-table .cell-actions button:hover { color: var(--danger); background: var(--accents-1); }
.data-table--tokens {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.data-table--tokens .tokens-col-name { width: 13%; }
.data-table--tokens .tokens-col-key { width: 33%; }
.data-table--tokens .tokens-col-status { width: 8%; }
.data-table--tokens .tokens-col-policy { width: 14%; }
.data-table--tokens .tokens-col-quota { width: 8%; }
.data-table--tokens .tokens-col-actions { width: 24%; }

/* ─── Model catalog ───────────────────────────────────────────────────── */
.model-catalog-card .card__body {
  padding: 0;
}
.models-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: var(--space-3);
  align-items: end;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.models-search {
  display: grid;
  gap: var(--space-2);
}
.models-search span,
.models-count {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.models-count {
  align-self: center;
  white-space: nowrap;
}
.models-table-wrap {
  overflow-x: auto;
}
.models-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.models-table th:nth-child(1),
.models-table td:nth-child(1) { width: 300px; }
.models-table th:nth-child(2),
.models-table td:nth-child(2),
.models-table th:nth-child(3),
.models-table td:nth-child(3),
.models-table th:nth-child(4),
.models-table td:nth-child(4),
.models-table th:nth-child(5),
.models-table td:nth-child(5) { width: 100px; }
.models-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--accents-1);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.models-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.models-table tbody tr:hover td {
  background: var(--accents-1);
}
.model-name-cell {
  min-width: 280px;
}
.model-name-cell__main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.model-name-cell small,
.price-cell small {
  display: block;
}
.model-name-cell strong {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.model-copy-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.model-copy-button svg {
  width: 15px;
  height: 15px;
}
.model-copy-button:hover,
.model-copy-button:focus-visible {
  border-color: var(--border-strong);
  background: var(--accents-1);
  color: var(--text);
  outline: none;
}
.model-name-cell small,
.price-cell small {
  margin-top: 3px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.price-cell {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.price-cell--strong {
  color: var(--text);
  font-weight: 600;
}
.model-meta-pill,
.model-source-badge {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.model-source-badge--site {
  border-color: rgba(22, 163, 74, 0.26);
  background: rgba(22, 163, 74, 0.08);
  color: #166534;
}
.model-source-badge--configured,
.model-source-badge--modelpackage,
.model-source-badge--model_package {
  border-color: rgba(0, 112, 243, 0.22);
  background: rgba(0, 112, 243, 0.08);
  color: #0050b3;
}
.model-source-badge--unset {
  border-color: rgba(180, 35, 24, 0.18);
  background: rgba(255, 26, 26, 0.06);
  color: #b42318;
}

/* ─── Playground ─────────────────────────────────────────────────────── */
.playground-shell {
  height: min(920px, calc(100vh - var(--nav-height) - 128px));
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  grid-template-areas:
    "toolbar toolbar"
    "transcript config"
    "composer composer";
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.playground-toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  background: #fbfbfb;
}
.playground-model-select-wrap {
  min-width: min(460px, 100%);
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.playground-model-select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.playground-toolbar__spacer {
  flex: 1;
}
.playground-toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.playground-toolbar-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.playground-toolbar-button:hover {
  background: var(--accents-1);
  color: var(--text);
}
.playground-toolbar-button.is-active {
  background: var(--text);
  color: var(--surface);
}
.playground-toolbar-button.is-active:hover {
  background: #333;
  color: var(--surface);
}
.playground-toolbar-button svg {
  width: 18px;
  height: 18px;
}
.playground-icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
}
.playground-icon-button:hover {
  background: var(--accents-1);
  color: var(--text);
}
.playground-icon-button svg,
.playground-send svg {
  width: 20px;
  height: 20px;
}
.playground-transcript {
  grid-area: transcript;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-8);
  background: linear-gradient(#fff, #fff) padding-box;
}
.playground-empty-stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}
.playground-model-card {
  width: min(860px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.playground-model-card__body {
  padding: var(--space-8);
}
.playground-model-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 20px;
  color: var(--text-muted);
}
.playground-model-card__title strong {
  color: var(--text);
}
.playground-model-card p {
  margin-top: var(--space-5);
  max-width: 68ch;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.55;
}
.playground-model-card__stats {
  margin: var(--space-8) 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.playground-model-card__stats div {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.playground-model-card__stats dt,
.playground-model-card__stats dd {
  margin: 0;
}
.playground-model-card__stats dt {
  color: var(--text);
  font-weight: 600;
}
.playground-model-card__stats dd {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.playground-model-card__footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-8);
  border-top: 1px solid var(--border);
  background: #f7f7f8;
}
.playground-model-card__footer button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0;
}
.playground-model-card__footer button:hover {
  color: var(--text);
}
.playground-config {
  grid-area: config;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  padding: var(--space-5);
  border-left: 1px solid var(--border);
  background: #fbfbfb;
  overflow-y: auto;
}
.playground-parameters {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.playground-parameters__head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.playground-parameters__head span {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.playground-parameters__head small {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.playground-parameters__head:hover small {
  color: var(--text);
}
.playground-parameters__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.playground-system-field textarea {
  min-height: 112px;
}
.playground-parameter-field.is-disabled {
  opacity: 0.54;
}
.playground-parameter-head,
.playground-stream-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.playground-parameter-toggle {
  position: relative;
  width: 28px;
  height: 16px;
  display: inline-flex;
  cursor: pointer;
}
.playground-parameter-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.playground-parameter-toggle span,
.playground-stream-toggle input {
  transition: background-color 0.16s ease, border-color 0.16s ease;
}
.playground-parameter-toggle span {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #e6e8eb;
}
.playground-parameter-toggle span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  transition: transform 0.16s ease;
}
.playground-parameter-toggle input:checked + span {
  border-color: var(--text);
  background: var(--text);
}
.playground-parameter-toggle input:checked + span::after {
  transform: translateX(12px);
}
.playground-parameter-toggle input:disabled + span {
  cursor: default;
  opacity: 0.5;
}
.playground-stream-toggle {
  padding: var(--space-2) 0;
}
.playground-stream-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--text);
}
.playground-request-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding-top: var(--space-1);
}
.playground-request-preview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.playground-request-preview__head span {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.playground-request-preview pre {
  max-height: 190px;
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f4f5f6;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}
.playground-request-preview__status {
  color: #166534;
  font-size: 12px;
}
.playground-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: var(--space-3);
  align-items: center;
}
.playground-range-row span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
}
.playground-range {
  width: 100%;
  accent-color: var(--text);
}
.playground-message {
  max-width: 780px;
  margin: 0 auto var(--space-5);
}
.playground-message--user {
  margin-left: auto;
  margin-right: 0;
  max-width: min(680px, 86%);
}
.playground-message--assistant {
  margin-left: 0;
  margin-right: auto;
}
.playground-message__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: space-between;
  margin-bottom: var(--space-2);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.playground-message__actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.playground-message__action {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  padding: 0;
}
.playground-message__action:hover:not(:disabled) {
  background: var(--accents-1);
  color: var(--text);
}
.playground-message__action:disabled {
  opacity: 0.45;
  cursor: default;
}
.playground-message__action svg {
  width: 15px;
  height: 15px;
}
.playground-thinking {
  margin-bottom: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f6f7f8;
  color: var(--text-muted);
  overflow: hidden;
}
.playground-thinking__head {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: left;
}
.playground-thinking__head span {
  color: var(--text);
  font-weight: 600;
}
.playground-thinking__head small {
  color: var(--text-faint);
  font-size: 11px;
}
.playground-thinking__content {
  max-height: 260px;
  margin: 0;
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  background: #fbfbfb;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
}
.playground-message__bubble {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.playground-message--user .playground-message__bubble {
  background: #eef0f2;
  border-color: #d8dde3;
  color: var(--text);
}
.playground-message.is-error .playground-message__bubble {
  border-color: rgba(255, 26, 26, 0.24);
  background: rgba(255, 26, 26, 0.06);
  color: #b42318;
}
.playground-markdown {
  display: flow-root;
}
.playground-markdown > :first-child {
  margin-top: 0;
}
.playground-markdown > :last-child {
  margin-bottom: 0;
}
.playground-markdown p {
  margin: 0 0 0.85em;
}
.playground-markdown h1,
.playground-markdown h2,
.playground-markdown h3,
.playground-markdown h4,
.playground-markdown h5,
.playground-markdown h6 {
  margin: 1.15em 0 0.45em;
  color: var(--text);
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: 0;
}
.playground-markdown h1 { font-size: 22px; }
.playground-markdown h2 { font-size: 19px; }
.playground-markdown h3 { font-size: 17px; }
.playground-markdown h4,
.playground-markdown h5,
.playground-markdown h6 { font-size: 15px; }
.playground-markdown a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.playground-markdown ul,
.playground-markdown ol {
  margin: 0 0 0.85em;
  padding-left: 1.35em;
}
.playground-markdown li {
  margin: 0.18em 0;
  padding-left: 0.2em;
}
.playground-markdown li input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0 6px 0 -2px;
  vertical-align: -2px;
  accent-color: var(--text);
}
.playground-markdown blockquote {
  margin: 0 0 0.9em;
  padding: 0.1em 0 0.1em var(--space-4);
  border-left: 3px solid #d8dde3;
  color: var(--text-muted);
}
.playground-markdown hr {
  height: 1px;
  margin: var(--space-5) 0;
  border: 0;
  background: var(--border);
}
.playground-markdown code {
  padding: 0.12em 0.34em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f4f5f6;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.playground-markdown__code {
  margin: 0 0 0.95em;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f6f7f8;
}
.playground-markdown__code-label {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.playground-markdown__code pre {
  margin: 0;
  padding: var(--space-4);
  overflow-x: auto;
}
.playground-markdown__code code {
  display: block;
  min-width: max-content;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre;
}
.playground-markdown__table {
  max-width: 100%;
  margin: 0 0 0.95em;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.playground-markdown table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 13px;
}
.playground-markdown th,
.playground-markdown td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.playground-markdown th:last-child,
.playground-markdown td:last-child {
  border-right: 0;
}
.playground-markdown tbody tr:last-child td {
  border-bottom: 0;
}
.playground-markdown th {
  background: #f7f8fa;
  color: var(--text);
  font-weight: 600;
}
.playground-markdown img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.playground-message__empty {
  color: var(--text-faint);
}
.playground-message__billing {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8f9fa;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
}
.playground-message__billing strong {
  color: var(--text);
  font-weight: 600;
}
.playground-message__billing-link {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 0 2px;
}
.playground-message__billing-link:hover {
  text-decoration: underline;
}
.playground-typing::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  text-align: left;
  animation: playgroundDots 1s steps(3, end) infinite;
}
@keyframes playgroundDots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}
.playground-composer {
  grid-area: composer;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.playground-error {
  margin-bottom: var(--space-3);
  color: #b42318;
  font-size: 13px;
}
.playground-composer__box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: var(--space-3);
  align-items: end;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.playground-composer__box:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.playground-input {
  min-height: 40px;
  max-height: 160px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
.playground-input::placeholder {
  color: #aaa;
}
.playground-send {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
}
.playground-send:hover:not(:disabled) {
  background: var(--accents-1);
  color: var(--text);
}
.playground-send:disabled {
  cursor: default;
  opacity: 0.38;
}

.data-table--tokens thead th,
.data-table--tokens tbody td {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}
.data-table--tokens .token-key-cell {
  min-width: 0;
}
.token-key-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  max-width: 100%;
  vertical-align: middle;
}
.data-table--tokens .token-status-cell,
.data-table--tokens .token-policy-cell,
.data-table--tokens .token-quota-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.token-key-scroll {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  line-height: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.token-key-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
.token-key-copy svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}
.token-key-copy:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.token-key-copy:disabled {
  cursor: default;
  opacity: 0.7;
}
.data-table--tokens .cell-actions {
  white-space: normal;
  text-align: left;
}
.token-actions-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.data-table--tokens .cell-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-weight: 600;
}
.data-table--tokens .cell-actions button:hover:not(:disabled) {
  border-color: #000;
  background: #000;
  color: #fff;
}
.data-table--tokens .cell-actions button[data-action="delete-token"] {
  border-color: rgba(255, 26, 26, 0.28);
  background: rgba(255, 26, 26, 0.04);
  color: var(--danger);
}
.data-table--tokens .cell-actions button[data-action="delete-token"]:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.data-table--tokens .cell-actions button:disabled {
  cursor: default;
  opacity: 0.62;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--accents-1);
  border: 1px solid var(--border);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-pill.is-active { color: #16a34a; border-color: rgba(22, 163, 74, 0.25); background: rgba(22, 163, 74, 0.08); }
.status-pill.is-active::before { background: #16a34a; }
.status-pill.is-revoked { color: var(--text-faint); }

/* ─── Modal ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: modalFadeIn 0.15s ease-out;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--wide {
  max-width: 680px;
}
@keyframes modalSlideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal__title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal__sub {
  margin-top: 4px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.modal__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.modal__close:hover { color: var(--text); background: var(--accents-1); }
.modal__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
  min-height: 0;
}
.modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  background: var(--bg);
}
.modal-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}
.twofa-modal-state {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.twofa-modal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
.twofa-qr-panel {
  display: flex;
  justify-content: center;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.twofa-qr-image {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
}
.twofa-qr-fallback {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}
.twofa-setup-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.twofa-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.twofa-backup-grid code {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  text-align: center;
}
.twofa-code-input {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
@media (max-width: 700px) {
  .twofa-modal-grid {
    grid-template-columns: 1fr;
  }
  .twofa-qr-panel {
    padding: var(--space-3);
  }
}
.playground-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.playground-history-item {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.playground-history-item.is-active {
  background: #f4f5f6;
}
.playground-history-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.playground-history-item__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.playground-history-delete {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-faint);
}
.playground-history-delete:hover {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(255, 26, 26, 0.06);
  color: #b42318;
}
.playground-history-delete svg {
  width: 15px;
  height: 15px;
}
.playground-history-item__head strong,
.playground-history-item__head small {
  display: block;
}
.playground-history-item__head strong {
  font-size: 14px;
  line-height: 1.35;
}
.playground-history-item__head small,
.playground-history-item__count {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.playground-history-item__count {
  margin-top: var(--space-3);
}
.playground-history-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.form-field { display: flex; flex-direction: column; gap: var(--space-2); }
.form-field[hidden],
.token-model-default[hidden],
.token-model-restricted[hidden] {
  display: none !important;
}
.form-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.form-input, .form-select {
  font-family: inherit;
  font-size: 14px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-input[readonly] {
  background: var(--accents-1);
  color: var(--text-muted);
}
textarea.form-input {
  min-height: 84px;
  resize: vertical;
}

.token-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.token-policy-section {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.token-policy-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.token-policy-section__head h3 {
  margin: 0;
  font-size: 14px;
}
.token-policy-section__head span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.token-policy-default {
  padding: var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
}
.money-input {
  position: relative;
}
.money-input span {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  pointer-events: none;
}
.money-input .form-input {
  padding-left: 28px;
}
.token-advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.token-advanced summary {
  cursor: pointer;
  padding: var(--space-3);
  color: var(--text);
  font-weight: 600;
  list-style-position: inside;
}
.token-advanced__body {
  display: grid;
  gap: var(--space-3);
  padding: 0 var(--space-3) var(--space-3);
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  width: fit-content;
}
.segmented__item {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
}
.segmented__item:hover {
  color: var(--text);
  background: var(--accents-1);
}
.segmented__item.is-active {
  color: var(--text);
  background: var(--accents-2);
}
.model-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-height: 154px;
  overflow: auto;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.model-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
.model-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.model-chip.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.check-row input {
  margin-top: 2px;
}
.check-row strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}
.check-row small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Reveal-once key card ────────────────────────────────────────────── */
.reveal-key {
  padding: var(--space-3) var(--space-4);
  background: #0a0a0a;
  color: #e8e8e8;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  word-break: break-all;
}
.reveal-key button {
  flex-shrink: 0;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.reveal-key button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.reveal-key button:disabled {
  cursor: default;
  opacity: 0.75;
}
.reveal-key--large {
  padding: var(--space-4);
  font-size: 15px;
}
.created-token-result {
  display: grid;
  gap: var(--space-3);
}
.created-token-result__label {
  font-weight: 600;
  color: var(--text);
}
.created-token-result__policy {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.created-token-result__policy span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--accents-1);
  color: var(--text-muted);
  font-size: 12px;
}
.reveal-warn {
  padding: var(--space-3) var(--space-4);
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius);
  font-size: 13px;
  color: #8a5a00;
  line-height: 1.5;
}

/* ─── Filter bar / pills ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.filter-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  cursor: pointer;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}
.filter-pill:hover { border-color: var(--border-strong); color: var(--text); }
.filter-pill.is-active { background: var(--accents-2); border-color: var(--border-strong); color: var(--text); }

/* ─── Channels expanded row ───────────────────────────────────────────── */
.data-table tbody tr.is-expanded td { background: var(--accents-1); }
.data-table tbody tr.channel-detail-row:hover td { background: var(--bg); cursor: default; }
.channel-detail { padding: var(--space-5) var(--space-5) var(--space-6); background: var(--bg); border-top: 1px dashed var(--border); }
.channel-detail__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: var(--space-8);
}
.channel-detail__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}
.channel-detail__spark {
  width: 100%;
  height: 60px;
  display: block;
}
.channel-detail__models {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.channel-detail__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.status-pill.is-warn {
  color: #8a5a00;
  background: rgba(245, 166, 35, 0.1);
  border-color: rgba(245, 166, 35, 0.3);
}
.status-pill.is-warn::before { background: var(--warn); }

/* ─── Usage cards ─────────────────────────────────────────────────────── */
.usage-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.usage-card {
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: var(--space-6);
  align-items: center;
}
.usage-card__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.usage-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.usage-card__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.usage-card__delta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
}
.usage-card__value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.usage-card__spark {
  width: 100%;
  height: 70px;
  display: block;
}

/* ─── Logs ─────────────────────────────────────────────────────────────── */
.logs-list { font-family: var(--font-mono); font-size: 12.5px; }
.logs-head,
.log-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1.4fr) 70px 60px 70px minmax(0, 2fr);
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  align-items: baseline;
}
.logs-head {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.log-row {
  border-top: 1px solid var(--border);
  cursor: pointer;
  padding: var(--space-2) var(--space-5);
}
.logs-head + .log-row,
.log-row:first-of-type { border-top: none; }
.log-row:hover,
.log-row.is-expanded { background: var(--accents-1); }
.log-time { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.log-model {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-model small { color: var(--text-faint); margin-left: 4px; }
.log-latency { color: var(--text); font-variant-numeric: tabular-nums; }
.log-status--success { color: #16a34a; }
.log-status--warn    { color: #8a5a00; }
.log-status--error   { color: var(--danger); }
.log-cost { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.log-preview {
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-detail {
  padding: var(--space-4) var(--space-5);
  background: var(--bg);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
}
.log-detail__meta { color: var(--text-muted); }
.log-detail__json {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: #0a0a0a;
  color: #e8e8e8;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
}

/* ─── Billing ─────────────────────────────────────────────────────────── */
.billing-summary-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
  gap: var(--space-5);
  align-items: stretch;
  margin-bottom: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.billing-summary-card__main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
  min-width: 0;
}
.billing-eyebrow {
  width: max-content;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text-muted);
}
.billing-summary-card h2 {
  font-family: var(--font-mono);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}
.billing-summary-card__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  min-width: 0;
}
.billing-summary-card__stats div {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.billing-summary-card__stats span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}
.billing-summary-card__stats strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.stripe-checkout-card {
  margin-bottom: var(--space-5);
}
.stripe-recharge-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  min-height: 0;
}
.stripe-recharge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.stripe-recharge-head h3 {
  font-size: 22px;
  letter-spacing: 0;
}
.stripe-recharge-head span {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 13px;
}
.topup-amounts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
}
.topup-amounts--stripe {
  gap: var(--space-3);
}
.topup-amount {
  min-height: 76px;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  color: var(--text);
}
.topup-amount:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.topup-amount.is-active {
  border-color: #635bff;
  background: #f3f1ff;
  color: #24166f;
}
.topup-amount__value {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 600;
}
.topup-amount__sub {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.topup-amount.is-active .topup-amount__sub {
  color: #635bff;
}
.custom-topup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.custom-topup-row__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.custom-topup-row__text span {
  font-size: 14px;
  font-weight: 600;
}
.custom-topup-row__text small {
  color: var(--text-muted);
  font-size: 12px;
}
.custom-topup-row__input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.custom-topup-row__input span {
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.custom-topup-row__input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}
.custom-topup-row__input:focus-within {
  border-color: #635bff;
  box-shadow: 0 0 0 2px rgba(99, 91, 255, 0.1);
}
.billing-checkout-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: flex-start;
}
.billing-checkout-button {
  min-width: 190px;
}
.invite-card {
  margin-bottom: var(--space-5);
}
.invite-card__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: var(--space-4);
  align-items: stretch;
}
.invite-card__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.invite-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}
.invite-link-input {
  font-family: var(--font-mono);
  font-size: 12px;
}
.invite-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.invite-code-row span {
  color: var(--text-muted);
  font-size: 12px;
}
.invite-code-row strong {
  font-family: var(--font-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.invite-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}
.invite-card__stats div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 86px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.invite-card__stats span {
  color: var(--text-muted);
  font-size: 12px;
}
.invite-card__stats strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.invite-transfer-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  gap: var(--space-3);
  align-items: end;
  margin-top: var(--space-4);
}
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: var(--space-5);
  align-items: start;
}
.invitee-list {
  display: grid;
  gap: var(--space-3);
}
.invitee-row {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.invitee-row__main,
.invitee-row__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.invitee-row__main strong,
.invitee-row__main span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.invitee-row__main span,
.invitee-row__meta {
  color: var(--text-muted);
  font-size: 12px;
}
.invitee-row__bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accents-2);
}
.invitee-row__bar span {
  display: block;
  height: 100%;
  min-width: 2px;
  max-width: 100%;
  border-radius: inherit;
  background: #111;
}
/* ─── Account settings ───────────────────────────────────────────────── */
.account-summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}
.account-summary__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}
.account-summary__name {
  font-size: 18px;
  font-weight: 600;
}
.account-summary__meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 13px;
}
.account-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.account-security-note {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
.security-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.security-card > .btn {
  margin-top: auto;
  min-height: 40px;
}
.security-card > .inline-actions {
  margin-top: auto;
}
.twofa-setup {
  display: grid;
  gap: var(--space-3);
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-4);
}
.account-radio-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--space-2);
}

/* ─── Settings sections + radio cards + toggle ───────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.settings-section__head {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.settings-section__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.settings-section__sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
  max-width: 62ch;
}
.settings-section__body {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.radio-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.radio-card {
  text-align: left;
  padding: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
  color: var(--text);
}
.radio-card:hover { border-color: var(--border-strong); }
.radio-card.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.radio-card__title { font-size: 14px; font-weight: 500; }
.radio-card__desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  text-wrap: pretty;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.toggle-row__label { font-size: 14px; color: var(--text); }
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--accents-2);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.toggle.is-on { background: var(--brand); }
.toggle.is-on::after { transform: translateX(16px); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.setting-row__title { font-size: 14px; font-weight: 500; color: var(--text); }
.setting-row__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 50ch;
}

/* ─── Role select (Team tab) ─────────────────────────────────────────── */
.role-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 26px 4px 10px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23999' stroke-width='1.5'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.role-select:disabled {
  cursor: default;
  background-image: none;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ─── Danger zone ─────────────────────────────────────────────────────── */
.danger-zone { border-color: rgba(255, 26, 26, 0.3); }
.danger-zone .settings-section__title { color: var(--danger); }
.danger-confirm-row {
  align-items: flex-end;
}
.danger-confirm-row .form-field {
  min-width: min(320px, 100%);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #cc0000; color: #fff; }
.btn:disabled {
  cursor: default;
  opacity: 0.58;
}

/* ─── Responsive adjustments ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .channel-detail__grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .usage-card { grid-template-columns: 1fr; }
  .radio-cards { grid-template-columns: 1fr; }
  .account-form-grid, .settings-grid { grid-template-columns: 1fr; }
  .billing-summary-card { grid-template-columns: 1fr; }
  .invite-card__grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .topup-amounts { grid-template-columns: repeat(2, 1fr); }
  .filter-grid, .filter-grid--logs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .security-grid { grid-template-columns: 1fr; }
  .models-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .playground-shell {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr) auto auto;
    grid-template-areas:
      "toolbar"
      "transcript"
      "config"
      "composer";
  }
  .playground-config {
    border-left: 0;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .playground-parameters {
    grid-column: 1 / -1;
  }
  .playground-parameters__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .playground-system-field {
    grid-column: 1 / -1;
  }
  .playground-request-preview {
    grid-column: 1 / -1;
  }
  .playground-model-card__stats {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 860px) {
  .logs-head, .log-row { grid-template-columns: 90px 1fr 60px 60px; }
  .logs-head > :nth-child(n+5),
  .log-row  > :nth-child(n+5) { display: none; }
  .billing-summary-card__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invite-card__stats { grid-template-columns: 1fr; }
  .invite-transfer-row { grid-template-columns: 1fr; align-items: stretch; }
  .pager { flex-direction: column; align-items: flex-start; }
  .playground-toolbar {
    flex-wrap: wrap;
    height: auto;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }
  .playground-model-select-wrap {
    flex: 1 1 100%;
  }
  .playground-toolbar__actions {
    flex: 1 1 100%;
    overflow-x: auto;
    padding-bottom: 1px;
  }
  .playground-toolbar__spacer {
    display: none;
  }
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .quickstart { grid-template-columns: 1fr; }
  .billing-form__grid { grid-template-columns: 1fr; }
  .history-toolbar { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
  .app-sidebar {
    display: none;
  }
  .app-mobile-nav { display: block; }
  .app-main { padding: var(--space-2) 6px var(--space-3); }
  .site-nav__profile-name { display: none; }
  .site-nav__profile-button { padding-right: 4px; }
}
@media (max-width: 600px) {
  .site-nav__inner {
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }
  .site-nav__actions { gap: var(--space-1); }
  .site-nav__action-link { padding: 0 4px; }
  .app-main {
    padding: 6px 5px 10px;
  }
  .page-head {
    gap: 6px;
    margin-bottom: var(--space-2);
  }
  .page-head__text h1 {
    font-size: 26px;
  }
  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    margin-bottom: 6px;
  }
  .kpi {
    padding: 6px;
    gap: var(--space-1);
  }
  .kpi__value {
    font-size: 22px;
  }
  .overview-grid {
    gap: 6px;
    margin-bottom: 6px;
  }
  .panel-stack {
    gap: 6px;
  }
  .card__head,
  .card__body {
    padding: 6px;
  }
  .card__body.card__body--flush {
    padding: 0;
  }
  .recent__row {
    grid-template-columns: 58px 1fr auto;
    gap: var(--space-1);
    padding: var(--space-1) 6px;
  }
  .quickstart {
    gap: 6px;
    padding: 6px;
  }
  .quickstart__text p {
    margin-bottom: 6px;
  }
  .quickstart__snippet {
    padding: 6px;
  }
  .data-table thead th {
    padding: var(--space-1) 6px;
  }
  .data-table tbody td {
    padding: 6px;
  }
  .billing-summary-card { padding: 6px; }
  .billing-summary-card h2 { font-size: 28px; }
  .billing-summary-card__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invite-link-row { grid-template-columns: 1fr; }
  .invite-card__stats div { min-height: 64px; }
  .topup-amounts { grid-template-columns: repeat(2, 1fr); }
  .custom-topup-row { grid-template-columns: 1fr; }
  .billing-checkout-button { width: 100%; }
  .filter-grid, .filter-grid--logs, .token-form-grid { grid-template-columns: 1fr; }
  .playground-transcript {
    padding: var(--space-4);
  }
  .playground-empty-stage {
    padding: var(--space-2);
  }
  .playground-model-card__body {
    padding: var(--space-5);
  }
  .playground-model-card__footer {
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
  }
  .playground-config {
    grid-template-columns: 1fr;
  }
  .playground-parameters__body {
    grid-template-columns: 1fr;
  }
  .playground-message,
  .playground-message--user,
  .playground-message--assistant {
    max-width: 100%;
  }
  .playground-composer {
    padding: var(--space-3);
  }
  .danger-confirm-row { align-items: stretch; flex-direction: column; }
  .flash--toast {
    top: calc(var(--nav-height) + var(--space-2));
    right: var(--space-4);
    left: var(--space-4);
    width: auto;
  }
}
