/* Gateway tab — design system for the Gateway workspace.
   Hero, live status, endpoint list, quick start, provider cards,
   model catalog and leaderboard. Tokens come from styles.css. */

/* ============================================================ foundations */
#panel-gateway {
  --gw-radius: 12px;
  --gw-radius-sm: 8px;
  --gw-hair: color-mix(in oklab, var(--fg) 9%, transparent);
  --gw-hair-soft: color-mix(in oklab, var(--fg) 5%, transparent);
  --gw-raise: color-mix(in oklab, var(--fg) 4%, var(--card));
  --gw-sunken: color-mix(in oklab, var(--fg) 3%, var(--card));
  --gw-accent-wash: color-mix(in oklab, var(--accent) 11%, transparent);
  --gw-accent-line: color-mix(in oklab, var(--accent) 34%, transparent);
  /* model catalog columns: health · toggle · fav · provider · model · badges
     · context · max out · uptime · latency · actions */
  --gw-cols: 26px 34px 24px 88px minmax(0, 1fr) minmax(0, max-content) 66px 66px 60px 76px 152px;
}

.gw-ico {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* provider stat row: label left, value right (the live-status ribbon uses
   the shared .gw-stat pair, which shell.css owns) */
.gw-pstat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.gw-pstat-k {
  margin: 0;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gw-pstat-v {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gw-pstat.is-missing .gw-pstat-v {
  color: var(--muted);
  font-weight: var(--fw-regular);
}

/* ================================================================ section heads */
.gw-sec-head {
  margin: 44px 0 12px;
}
.gw-sec-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.gw-sec-head-hero {
  margin: 40px 0 12px;
}
.gw-sec-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
  color: var(--fg-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.gw-sec-note {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.gw-sec-note code {
  font-size: 0.92em;
  color: var(--fg-soft);
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair-soft);
  border-radius: 5px;
  padding: 1px 5px;
}
.gw-sec-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================================================== hero */
.gw-hero {
  margin-top: 0;
  padding-top: 30px;
}
.gw-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(304px, 366px);
  gap: 34px 44px;
  align-items: start;
}
.gw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
}
.gw-eyebrow-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}
.gw-title {
  margin: 0 0 18px;
  font-size: clamp(2.3rem, 5.4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: var(--fw-bold);
  color: var(--fg-strong);
}
.gw-title-accent {
  color: var(--fg);
}
.gw-title-key {
  color: var(--accent);
}
.gw-hero-sub {
  max-width: 56ch;
  color: var(--fg-soft);
  font-size: var(--fs-md);
  line-height: 1.62;
}
.gw-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
#panel-gateway .gw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}
#panel-gateway .gw-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: color-mix(in oklab, var(--accent) 70%, #000);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 20px -10px color-mix(in oklab, var(--accent) 70%, transparent);
}
#panel-gateway .gw-btn-primary:hover {
  background: color-mix(in oklab, var(--accent) 86%, #fff);
  border-color: color-mix(in oklab, var(--accent) 60%, #000);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 24px -10px color-mix(in oklab, var(--accent) 80%, transparent);
}
#panel-gateway .gw-btn-ghost {
  background: var(--gw-raise);
  color: var(--fg);
  border-color: var(--gw-hair);
}
#panel-gateway .gw-btn-ghost:hover {
  background: var(--card-2);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

/* ============================================================ status card */
/* The ribbon itself is styled by shell.css (it owns the shared read-out);
   the gateway module only owns the data it renders. */
#panel-gateway .gw-hero-side .gw-status-ribbon {
  margin: 0;
}

/* ========================================================== endpoint list */
.gw-ep-table {
  margin: 0;
  border-radius: var(--gw-radius);
  border: 1px solid var(--gw-hair);
  background: var(--gw-surface, var(--card));
  box-shadow: var(--glass-specular);
  overflow: hidden;
}
.gw-ep-table:hover {
  border-color: var(--line-strong);
}
.gw-ep-table tr {
  transition: background 120ms ease;
}
.gw-ep-table tr:hover {
  background: color-mix(in oklab, var(--fg) 3.5%, transparent);
}
.gw-ep-table tr + tr {
  border-top: 1px solid var(--gw-hair-soft);
}
.gw-ep-table tbody + tbody .gw-ep-group th {
  border-top: 1px solid var(--gw-hair);
}
.gw-ep-table .gw-ep-group th {
  width: auto;
  padding: 11px 16px 8px;
  background: var(--gw-sunken);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.gw-ep-table th {
  width: 92px;
  padding: 11px 16px;
  font-size: var(--fs-2xs);
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: var(--fw-semibold);
}
.gw-ep-table td {
  padding: 9px 8px;
}
.gw-ep-table code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 10px;
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair-soft);
  border-radius: 7px;
  font-size: var(--fs-xs);
  color: var(--fg);
}
.gw-ep-table td:last-child {
  width: 78px;
  padding-right: 14px;
  text-align: right;
}
.gw-ep-table .ghost.copy {
  min-height: 24px;
  padding: 2px 10px;
  font-size: var(--fs-2xs);
  border-radius: 6px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.gw-ep-table .ghost.copy:hover {
  color: var(--fg);
  background: var(--card-2);
  border-color: var(--gw-hair);
  box-shadow: none;
}

/* ============================================================ quick start */
.gw-sdk {
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border-radius: var(--gw-radius);
  border: 1px solid var(--gw-hair);
  background: var(--card);
}
.gw-sdk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gw-hair-soft);
}
.gw-sdk-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gw-sdk-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  color: var(--fg-strong);
}
.gw-sdk-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.gw-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair-soft);
}
#panel-gateway .gw-tab {
  min-height: 0;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-soft);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  box-shadow: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
#panel-gateway .gw-tab:hover {
  color: var(--fg);
  background: var(--card-2);
  box-shadow: none;
}
#panel-gateway .gw-tab.is-on {
  background: var(--card);
  color: var(--fg-strong);
  border-color: var(--gw-hair);
  box-shadow: var(--glass-specular);
}
.gw-code {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.gw-code-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  background: var(--gw-sunken);
  border-bottom: 1px solid var(--gw-hair-soft);
}
.gw-code-lang {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.gw-code-bar-fill { flex: 1; }
#panel-gateway .gw-code-copy {
  min-height: 0;
  padding: 3px 11px;
  font-size: var(--fs-2xs);
  font-family: "Geist Mono", ui-monospace, monospace;
  letter-spacing: 0.04em;
  border-radius: 6px;
  color: var(--fg-soft);
  background: transparent;
  border-color: var(--gw-hair);
  box-shadow: none;
}
#panel-gateway .gw-code-copy:hover {
  color: var(--fg);
  background: var(--card);
  border-color: var(--line-strong);
  box-shadow: none;
}
.gw-sdk-code {
  margin: 0;
  padding: 16px 18px;
  max-height: 340px;
  overflow: auto;
  font-size: var(--fs-xs);
  line-height: 1.7;
  white-space: pre;
  overscroll-behavior: contain;
  background: var(--code-bg);
  border: none;
  border-radius: 0;
  color: var(--fg);
  font-variant-ligatures: none;
  tab-size: 2;
}

/* ========================================================== provider cards */
.gw-pgrid {
  grid-template-columns: repeat(auto-fill, minmax(242px, 1fr));
  gap: 14px;
}
.gw-pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 15px 16px 13px;
  border-radius: var(--gw-radius);
  border: 1px solid var(--gw-hair);
  background: var(--card);
  box-shadow: var(--glass-specular);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.gw-pcard::before { content: none; }
.gw-pcard:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.gw-pcard.is-down {
  border-color: color-mix(in oklab, var(--down) 30%, var(--gw-hair));
}
.gw-pcard.is-unstable {
  border-color: color-mix(in oklab, var(--unstable) 26%, var(--gw-hair));
}
.gw-pcard.is-hidden {
  opacity: 0.55;
}
.gw-pcard-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.gw-pcard-mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair);
  color: var(--fg);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  user-select: none;
}
.gw-pcard-id {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.gw-pcard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.gw-pcard-name {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  min-height: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.012em;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
  transition: color 150ms ease;
}
.gw-pcard-name:hover {
  color: var(--accent);
  background: none;
  border: none;
  box-shadow: none;
}
.gw-pcard-slug {
  font-size: var(--fs-2xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gw-pcard-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--gw-hair);
  background: var(--gw-sunken);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--fg-soft);
  white-space: nowrap;
}
.gw-pcard-status.is-up {
  color: var(--up);
  border-color: color-mix(in oklab, var(--up) 30%, transparent);
  background: color-mix(in oklab, var(--up) 8%, transparent);
}
.gw-pcard-status.is-unstable {
  color: var(--unstable);
  border-color: color-mix(in oklab, var(--unstable) 30%, transparent);
  background: color-mix(in oklab, var(--unstable) 8%, transparent);
}
.gw-pcard-status.is-down {
  color: var(--down);
  border-color: color-mix(in oklab, var(--down) 30%, transparent);
  background: color-mix(in oklab, var(--down) 8%, transparent);
}
.gw-pcard-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 16px;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--gw-hair-soft);
}
.gw-pcard-stats .gw-pstat:last-child {
  grid-column: 1 / -1;
}
.gw-pcard-spark {
  height: 26px;
  margin: 12px 0 0;
  flex: none;
}
.gw-pcard-spark svg {
  display: block;
  width: 100%;
  height: 26px;
}
.gw-pcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--gw-hair-soft);
}
.gw-pcard-note {
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-family: "Geist Mono", ui-monospace, monospace;
}

/* ------------------------------------------------- provider card actions */
.pcard-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 0;
  transition: opacity 140ms ease;
}
#panel-gateway .pcard-actions .linkish {
  font-size: var(--fs-2xs);
  padding: 3px 9px;
  min-height: 0;
  border-radius: 6px;
  border: 1px solid var(--gw-hair);
  background: var(--card);
  color: var(--fg-soft);
  text-decoration: none;
  box-shadow: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
#panel-gateway .pcard-actions .linkish:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--card-2);
  box-shadow: none;
}
#panel-gateway .pcard-actions .linkish {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
#panel-gateway .pcard:hover .pcard-actions .linkish,
#panel-gateway .pcard:focus-within .pcard-actions .linkish {
  color: var(--fg-soft);
  border-color: var(--gw-hair);
}

/* ========================================================== model catalog */
.gw-explorer {
  position: static;
}
.gw-model-range {
  margin: 14px 0 8px;
  font-size: var(--fs-xs);
}
.gw-model-list {
  border-top: none;
}
.gw-list-head {
  position: sticky;
  top: 52px;
  z-index: 6;
  display: grid;
  grid-template-columns: var(--gw-cols);
  align-items: center;
  gap: 10px;
  height: 32px;
  margin: 0 0 2px;
  padding: 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 6px 12px -10px rgba(0, 0, 0, 0.5);
}
/* cover the sliver between the sticky app header and this bar */
.gw-list-head::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 12px;
  background: var(--bg);
}
.gw-th {
  background: none;
  border: none;
  padding: 2px 0;
  min-height: 0;
  font: inherit;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 140ms ease;
}
.gw-th:hover { color: var(--fg); background: none; box-shadow: none; }
.gw-th.is-active { color: var(--accent); }
.gw-th.is-active::after { content: " ↓"; }
.gw-th.muted { cursor: default; }
.gw-th-num { text-align: right; }
.gw-th-actions { text-align: right; }

#panel-gateway #model-list .model-row {
  grid-template-columns: var(--gw-cols);
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: inset 0 -1px 0 var(--gw-hair-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
#panel-gateway #model-list .model-row:hover {
  background: color-mix(in oklab, var(--fg) 4.5%, transparent);
  border-color: var(--gw-accent-line);
}
#panel-gateway #model-list .model-row:focus-within {
  background: var(--card-2);
  border-color: var(--gw-accent-line);
}
#panel-gateway #model-list .mrow .mid {
  font-size: var(--fs-sm);
  color: var(--fg);
}
#panel-gateway #model-list .mrow .pname {
  font-size: var(--fs-2xs);
  color: var(--fg-soft);
}
#panel-gateway #model-list .mrow .pname:hover {
  color: var(--accent);
}
#panel-gateway #model-list .ctx {
  font-size: var(--fs-xs);
  text-align: right;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#panel-gateway #model-list .ctx-uptime {
  color: var(--fg);
}
#panel-gateway #model-list .badges {
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow: hidden;
}
#panel-gateway #model-list .row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}
#panel-gateway #model-list .row-actions .linkish {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 0;
  min-width: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
#panel-gateway #model-list .row-actions .linkish:hover {
  background: var(--gw-raise);
  border-color: var(--gw-hair);
  color: var(--fg-strong);
  text-decoration: none;
}
#panel-gateway #model-list .row-actions .linkish.is-active {
  color: var(--accent);
  border-color: var(--gw-accent-line);
  background: var(--gw-accent-wash);
}
.gw-ico-check { display: none; }
.gw-act.is-active .gw-ico-compare { display: none; }
.gw-act.is-active .gw-ico-check { display: block; }

/* designed empty state — rides on the shared .empty-state panel */
#panel-gateway .gw-empty {
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 52px 20px;
}
.gw-empty-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair);
  color: var(--muted);
}
.gw-empty-mark .gw-ico { width: 20px; height: 20px; }
#panel-gateway .gw-empty .gw-empty-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--fg-strong);
  letter-spacing: -0.012em;
}
#panel-gateway .gw-empty .gw-empty-hint {
  margin: 0;
  max-width: 48ch;
}

/* =============================================================== leaderboard */
.gw-board-wrap { margin: 44px 0 12px; }
.gw-board-wrap h2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 4px; color: var(--fg-strong); }
.gw-board-tabs { display: inline-flex; gap: 6px; }
.gw-board-note { margin: 0 0 12px; font-size: var(--fs-xs); }
.gw-board {
  padding: 4px 14px 8px;
  display: flex;
  flex-direction: column;
  border-radius: var(--gw-radius);
  border: 1px solid var(--gw-hair);
  background: var(--card);
}
.gw-board-row {
  display: grid;
  grid-template-columns: 26px 22px minmax(0, 1fr) minmax(80px, 150px) 42px 132px auto;
  align-items: center;
  gap: 14px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--gw-hair-soft);
  transition: background 140ms ease;
}
.gw-board-row:last-child { border-bottom: none; }
.gw-board-row:hover { background: color-mix(in oklab, var(--fg) 3.5%, transparent); }
.gw-board-rank {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gw-board-row.is-top .gw-board-rank {
  color: var(--fg-strong);
  background: var(--gw-raise);
  border: 1px solid var(--gw-hair);
}
.gw-board-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gw-board-key {
  font-size: var(--fs-sm);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gw-board-sub {
  font-size: var(--fs-2xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gw-board-score {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--gw-sunken);
  box-shadow: inset 0 0 0 1px var(--gw-hair-soft);
  overflow: hidden;
}
.gw-board-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 62%, transparent), var(--accent));
  transition: width 300ms ease;
}
.gw-board-points {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--fg);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gw-board-meta {
  font-size: var(--fs-2xs);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#panel-gateway .gw-board-chat {
  flex: none;
  font-size: var(--fs-2xs);
  padding: 4px 11px;
  min-height: 0;
  border-radius: 7px;
  border: 1px solid var(--gw-hair);
  background: transparent;
  color: var(--fg-soft);
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
#panel-gateway .gw-board-chat:hover {
  color: var(--accent);
  border-color: var(--gw-accent-line);
  background: var(--gw-accent-wash);
}

/* ---------------------------------------------------- new models strip */
.gw-newmodels-wrap { margin: 26px 0 6px; }
.gw-newmodels-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.gw-newmodels-note { font-size: var(--fs-xs); font-weight: var(--fw-regular); }
.gw-newmodels { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.gw-newmodel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  min-height: 0;
  font-size: var(--fs-xs);
}
.gw-newmodel-id { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-newmodel-when { font-size: var(--fs-2xs); }

/* ------------------------------------------------------ search highlight */
#model-list mark {
  background: color-mix(in oklab, var(--accent) 28%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
#search.is-regex {
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 18%, transparent);
}

/* ------------------------------------------------------ provider sort */
.prov-sort {
  width: auto;
  margin-left: 0;
  font-size: var(--fs-xs);
  padding: 5px 10px;
  min-height: 32px;
  border-radius: 8px;
  vertical-align: middle;
}

/* --------------------------------------------------- leaderboard refresh */
.gw-board-refresh { padding: 3px 7px; min-height: 0; margin-left: 2px; }
.gw-board-refresh .pg-ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ------------------------------------------------------ keyboard row nav */
.model-row:focus-within { background: var(--card-2); }
.model-row .dotbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --------------------------------------------------------- model drawer */
.gw-drawer-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.gw-drawer-table th {
  text-align: left;
  font-weight: var(--fw-medium);
  color: var(--muted);
  padding: 5px 12px 5px 0;
  white-space: nowrap;
  vertical-align: top;
  width: 1%;
}
.gw-drawer-table td { padding: 5px 0; word-break: break-word; }
.gw-drawer-table tr + tr th, .gw-drawer-table tr + tr td { border-top: 1px solid color-mix(in oklab, var(--line) 55%, transparent); }
.gw-drawer-body .bars { margin: 6px 0 10px; }

/* ------------------------------------------------- 24h latency histogram */
.gw-lat-chart { margin: 4px 0 10px; }
.gw-lat-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  align-items: end;
  height: 56px;
}
.gw-lat-col { display: flex; align-items: flex-end; height: 100%; }
.gw-lat-bar {
  width: 100%;
  border-radius: 2px;
  background: var(--up);
  min-height: 2px;
}
.gw-lat-bar.warn { background: var(--unstable); }
.gw-lat-bar.none { background: var(--line-strong); opacity: 0.5; }

/* --- floating compare bar ----------------------------------------------- */
.gw-compare-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--glass-bg-elevated);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--glass-specular-elevated), var(--shadow);
  font-size: 13px;
  animation: gw-bar-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gw-bar-in {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.gw-compare-bar-label { font-weight: 500; }
.gw-compare-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: 0;
  cursor: pointer;
}
.gw-compare-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.gw-compare-clear:hover { color: var(--fg); }

/* --- model comparison matrix table -------------------------------------- */
.gw-comp-wrap { overflow-x: auto; max-width: 100%; margin: 8px 0; }
.gw-comp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-comp-table th, .gw-comp-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.gw-comp-table th { background: var(--card-2); color: var(--fg-soft); font-weight: 600; }
.gw-comp-table tr:hover td { background: color-mix(in oklab, var(--accent) 5%, transparent); }

/* --- quick-test slide-over drawer --------------------------------------- */
.gw-test-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  height: 100dvh;
  z-index: 75;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg-elevated);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border-left: 1px solid var(--glass-border);
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.45);
  padding: 20px;
  animation: gw-drawer-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gw-drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.gw-test-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.gw-test-title { margin: 0; font-size: 1.1rem; }
.gw-test-close { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px; }
.gw-test-close:hover { color: var(--fg); }
.gw-test-model-name { font-size: 12px; margin-bottom: 12px; color: var(--accent); }
.gw-test-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.gw-test-actions { display: flex; gap: 8px; margin: 10px 0; }
.gw-test-send {
  padding: 7px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}
.gw-test-play {
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--card-2);
  color: var(--fg-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}
.gw-test-play:hover { color: var(--fg); border-color: var(--fg-soft); }
.gw-test-out-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.gw-test-meta { font-size: 11px; margin-top: 6px; color: var(--muted); }

/* --- status badges card ------------------------------------------------- */
.gw-badges-card {
  margin: 40px 0 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: var(--gw-radius);
  border: 1px solid var(--gw-hair);
  background: var(--card);
}
.gw-badges-h { margin: 0; font-size: var(--fs-md); color: var(--fg-strong); }
.gw-badge-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.gw-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--gw-sunken);
  border: 1px solid var(--gw-hair-soft);
  border-radius: 10px;
  flex-wrap: wrap;
}
.gw-badge-preview { display: flex; align-items: center; min-width: 0; max-width: 100%; }
.gw-badge-preview img { display: block; max-width: 100%; height: 20px; width: auto; }
.gw-badge-code {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--gw-hair-soft);
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(450px, 100%);
  min-width: 0;
  flex: 1 1 160px;
}
.gw-badge-copy {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--gw-hair-soft);
  cursor: pointer;
  color: var(--fg);
}
.gw-badge-copy:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 480px) {
  .gw-badge-row { gap: 8px; padding: 9px 10px; }
  .gw-badge-code { flex-basis: 100%; max-width: 100%; }
}

/* --- context window range filter chips ---------------------------------- */
.gw-ctx-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin: 4px 0 8px;
}
.gw-ctx-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--fg-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}
.gw-ctx-chip:hover { border-color: var(--fg-soft); color: var(--fg); }
.gw-ctx-chip.on {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 45%, transparent);
  color: var(--accent);
  font-weight: 500;
}

/* ------------------------------------------------- large-list rendering */
#model-list .mrow { content-visibility: auto; contain-intrinsic-size: auto 46px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  #panel-gateway {
    /* badges fold away first so the numeric columns stay legible */
    --gw-cols: 26px 34px 24px 76px minmax(0, 1fr) 70px 66px 56px 70px 132px;
  }
  #panel-gateway #model-list .badges { display: none; }
  #panel-gateway .gw-th-badges { display: none; }
  .gw-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); }
}
@media (max-width: 980px) {
  .gw-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
  .gw-hero-side { max-width: 520px; }
}
@media (max-width: 860px) {
  #panel-gateway {
    --gw-cols: 26px 34px 24px minmax(0, 1fr) auto;
  }
  #panel-gateway .gw-th-prov,
  #panel-gateway .gw-th-badges,
  #panel-gateway .gw-th-num { display: none; }
  #panel-gateway #model-list .model-row {
    grid-template-columns: var(--gw-cols);
  }
  .gw-list-head {
    top: 48px;
  }
}
@media (max-width: 700px) {
  /* The legacy .ep-table rules wrap endpoint URLs mid-token on phones, which
     splits "…:8787" across two lines. The new rows truncate instead. */
  .gw-ep-table td code { white-space: nowrap; overflow-wrap: normal; }
}
@media (max-width: 600px) {
  .gw-board-chat { display: none; }
  .gw-board-row {
    grid-template-columns: 24px 20px minmax(0, 1fr) 40px auto;
    gap: 10px;
  }
  .gw-board-score { display: none; }
  .gw-board-meta { display: none; }
  .gw-sdk-head { flex-direction: column; align-items: flex-start; }
  .gw-tabs { width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .gw-board-bar { transition: none; }
}
