:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-muted: #f3f4f8;
  --surface-raised: #fafbff;
  --border: #e4e7ee;
  --border-strong: #cfd5e1;
  --text: #14151d;
  --muted: #646978;
  --muted-strong: #4f5566;
  --accent: #6467f2;
  --accent-strong: #4f52de;
  --accent-soft: #eef0ff;
  --danger: #c23535;
  --success: #147a4a;
  --warning: #9f6407;
  --shadow: 0 16px 36px rgba(18, 23, 38, 0.08);
  --shadow-soft: 0 1px 2px rgba(18, 23, 38, 0.04);
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  font-family: var(--font-body);
}

/* Display face for headings — pairs a grotesk with personality against the
   Inter body, the single biggest lever away from the one-font template look. */
h1,
h2,
h3,
.public-hero-copy h1,
.page-head h2,
.modal-head h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(100, 103, 242, 0.24);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.app-root {
  min-height: 100dvh;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  display: block;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button,
.icon-button,
.search-box,
.workspace-picker,
.sidebar-nav button,
.credit-pack {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(100, 103, 242, 0.18);
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-secondary:hover,
.icon-button:hover,
.search-box:hover,
.credit-pack:hover {
  border-color: var(--border-strong);
  background: var(--surface-muted);
}

.button-google {
  width: 100%;
  border-color: var(--border-strong);
}

.button-google span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--accent);
}

.button-github {
  width: 100%;
  gap: 10px;
  margin-top: 10px;
  border-color: #24292f;
  background: #24292f;
  color: #ffffff;
}

.button-github:hover {
  background: #1b1f24;
  border-color: #1b1f24;
}

.button-github svg {
  flex: none;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.public-home {
  position: relative;
  min-height: 100dvh;
  background: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
}

/* Soft, lightly-blurred grid behind the content. Its own layer so the blur
   never touches the text above it. */
.public-home::before,
.legal-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(228, 231, 238, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 231, 238, 0.5) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  filter: blur(0.8px);
  opacity: 0.5;
}

.public-home > *,
.legal-page > * {
  position: relative;
  z-index: 1;
}

.public-topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(228, 231, 238, 0.9);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px clamp(18px, 4vw, 64px);
  backdrop-filter: blur(16px);
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.public-nav a:not(.button) {
  color: var(--muted-strong);
  font-weight: 700;
  text-decoration: none;
}

.public-nav a:not(.button):hover {
  color: var(--text);
}

/* Mobile menu toggle — hidden on desktop, shown (and drives .public-nav) below. */
.public-nav-toggle {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.public-hero {
  display: grid;
  width: min(100%, 1280px);
  min-height: calc(100dvh - 72px);
  grid-template-columns: minmax(0, 0.94fr) minmax(360px, 1.06fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  margin: 0 auto;
  padding: clamp(36px, 6vw, 78px) clamp(18px, 4vw, 64px) clamp(28px, 5vw, 58px);
}

.public-hero-copy h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(42px, 6.4vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero-announcement {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 7px 14px 7px 8px;
  border-radius: 999px;
  border: 1px solid rgba(100, 103, 242, 0.34);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.hero-announcement:hover,
.hero-announcement:focus-visible {
  border-color: var(--accent);
  background: #e5e8ff;
}

.hero-announcement-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hero-announcement-arrow {
  flex-shrink: 0;
}

.hero-accent {
  color: var(--accent);
}

.public-lede {
  max-width: 54ch;
  margin: 22px 0 0;
  color: var(--muted-strong);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.6;
}

.hero-fineprint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.hero-fineprint code,
.pricing-points code,
.pricing-tiers-foot code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 5px;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.public-metric-strip {
  display: grid;
  max-width: 620px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 34px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
  box-shadow: var(--shadow-soft);
}

.public-metric-strip div {
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
}

.public-metric-strip dt,
.public-endpoint-card span,
.public-signal-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.public-metric-strip dd {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.public-metric-strip .metric-note {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.public-route-visual {
  /* Explicit display so the loaded stylesheet overrides the inline
     pre-stylesheet fallback (which hides this heavy visual during FOUC). */
  display: block;
  position: relative;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(rgba(228, 231, 238, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 231, 238, 0.34) 1px, transparent 1px),
    rgba(255, 255, 255, 0.94);
  background-size: 48px 48px;
  box-shadow: var(--shadow);
  transform: translateY(calc(var(--scroll-progress, 0) * -12px));
  transform-style: preserve-3d;
  transition: transform 180ms ease;
}

.public-route-visual canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.route-core,
.route-node {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(18, 23, 38, 0.1);
}

.route-core {
  top: 50%;
  left: 50%;
  width: min(44%, 230px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%) translateZ(34px);
}

.route-core span {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* The wordmark must breathe inside the circle, not fill it edge to edge. */
.route-core strong {
  align-self: start;
  font-size: clamp(20px, 1.8vw, 27px);
  line-height: 1;
}

.route-node {
  min-width: 124px;
  min-height: 56px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 800;
  transform: translateZ(48px);
}

.node-credit {
  top: 18%;
  left: 15%;
}

.node-key {
  right: 14%;
  bottom: 22%;
}

.node-model {
  top: 25%;
  right: 16%;
}

.node-support {
  bottom: 20%;
  left: 18%;
}

.public-section {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 72px clamp(18px, 4vw, 64px);
  /* Keep anchor targets clear of the sticky topbar when reached via nav links. */
  scroll-margin-top: 88px;
}

.public-section-head {
  display: grid;
  max-width: 720px;
  gap: 10px;
}

.public-section-head h2 {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.public-section-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted-strong);
  font-size: 17px;
  line-height: 1.6;
}

.public-endpoint-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.public-endpoint-card span {
  grid-column: 1 / -1;
}

.public-endpoint-card code {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.public-signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.public-signal-grid div {
  display: grid;
  gap: 8px;
  min-height: 142px;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.public-signal-grid strong {
  font-size: 24px;
  line-height: 1.1;
}

.public-signal-grid small {
  color: var(--muted-strong);
}

.public-routing {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--border);
}

/* ---- Models section ---------------------------------------------------- */

.model-family-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 36px;
}

.model-family-card {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.model-family-card header {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.model-family-kind {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.model-family-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.model-family-count strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-strong);
}

.model-family-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.model-family-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.model-family-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.model-family-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.model-family-more {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.model-family-foot {
  margin: 24px 0 0;
  color: var(--muted-strong);
  font-size: 15px;
}

.model-family-foot strong {
  color: var(--text);
}

/* ---- Pricing ----------------------------------------------------------- */

.pricing-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  margin-top: 36px;
  align-items: stretch;
}

.pricing-primary {
  display: grid;
  align-content: start;
  gap: 10px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(100, 103, 242, 0.22);
}

.pricing-primary-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.pricing-primary-amount {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.pricing-primary-note {
  margin: 4px 0 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.55;
}

.pricing-points {
  display: grid;
  gap: 9px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.pricing-points li {
  position: relative;
  padding-left: 28px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.95);
}

/* Functional check marker drawn as a rotated border (no icon font / emoji). */
.pricing-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 7px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}

.pricing-points code {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.pricing-primary .button-primary {
  margin-top: 6px;
  border-color: #fff;
  background: #fff;
  color: var(--accent-strong);
  box-shadow: none;
}

.pricing-primary .button-primary:hover {
  background: rgba(255, 255, 255, 0.9);
}

.pricing-tiers-card {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-raised);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.pricing-tiers-title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pricing-tiers-sub {
  margin: -6px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

/* Shared elevated "credit tile" system — used on the home pricing tiers and,
   via the .credit-pack rules below, on the workspace Credits page so both
   read as one designed set. */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tier-card {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px 16px 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.tier-bonus {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
}

.tier-flow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.tier-pay {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-strong);
}

.tier-arrow {
  color: var(--accent);
  font-weight: 700;
}

.tier-get {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tier-caption {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Recommended tile: accent border, soft tint, elevation, and a ribbon so the
   eye lands on the best-value pack first. */
.tier-card.is-best {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), #fff 70%);
  box-shadow: 0 14px 30px rgba(100, 103, 242, 0.18);
}

.tier-card.is-best .tier-get,
.tier-card.is-best .tier-bonus {
  color: var(--accent-strong);
}

.tier-ribbon,
.credit-pack-ribbon {
  position: absolute;
  top: -10px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* accent-strong keeps the small ribbon label above AA (4.5:1) on white text */
  color: #fff;
  background: var(--accent-strong);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: 0 4px 10px rgba(100, 103, 242, 0.3);
}

.pricing-tiers-foot {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

/* "How you're charged" — a prominent, scannable billing block. */
.charge-block {
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  padding: clamp(22px, 3vw, 36px);
}

.charge-head {
  max-width: 56ch;
  margin-bottom: 22px;
}

.charge-head .eyebrow {
  color: var(--accent);
}

.charge-head h3 {
  margin: 4px 0 8px;
  font-size: clamp(24px, 3vw, 30px);
  letter-spacing: -0.02em;
}

.charge-lede {
  margin: 0;
  color: var(--muted-strong);
  font-size: 16px;
  line-height: 1.55;
}

.charge-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.charge-step {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.charge-icon {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.charge-icon svg {
  width: 21px;
  height: 21px;
}

.charge-step-num {
  position: absolute;
  top: 18px;
  right: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--border-strong);
}

.charge-step-title {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.charge-step-body {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.55;
}

/* "Why SuperbAPI" benefit cards. */
.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 36px;
}

.benefit-card {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.benefit-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.benefit-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.benefit-icon svg {
  width: 22px;
  height: 22px;
}

.benefit-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.benefit-card p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.55;
}

.pricing-rate-table {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.pricing-rate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pricing-rate {
  width: 100%;
  border-collapse: collapse;
}

.pricing-rate th,
.pricing-rate td {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: baseline;
}

.pricing-rate tr:last-child th,
.pricing-rate tr:last-child td {
  border-bottom: none;
}

.pricing-rate th {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.pricing-rate th em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.pricing-rate td {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--muted-strong);
  text-align: right;
  white-space: nowrap;
}

.pricing-rate-foot {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  background:
    radial-gradient(circle at 74% 20%, rgba(100, 103, 242, 0.12), transparent 28%),
    linear-gradient(135deg, #fff 0%, #f9f9fc 100%);
}

.auth-panel {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  padding: clamp(24px, 5vw, 56px);
}

.auth-copy h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 48ch;
  margin: 16px 0 0;
  color: var(--muted-strong);
  font-size: 15px;
}

.auth-divider {
  position: relative;
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-divider::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--border);
  content: "";
}

.auth-divider span {
  position: relative;
  background: #fff;
  padding: 0 12px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.auth-status,
.workspace-message,
.notice {
  min-height: 22px;
  margin: 0;
  color: var(--muted-strong);
  overflow-wrap: anywhere;
}

.workspace-message {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(20, 122, 74, 0.14);
  border-radius: 999px;
  background: rgba(20, 122, 74, 0.07);
  padding: 5px 10px;
  color: var(--success);
  font-size: 13px;
}

.auth-status.is-error,
.workspace-message.is-error {
  border-color: rgba(194, 53, 53, 0.2);
  background: rgba(194, 53, 53, 0.07);
  color: var(--danger);
}

.auth-status.is-success,
.workspace-message.is-success {
  color: var(--success);
}

.auth-link {
  color: var(--accent);
  font-weight: 700;
}

.auth-link-button {
  justify-self: start;
  min-height: auto;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.auth-link-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.auth-reset {
  display: grid;
  gap: 14px;
}

.auth-reset-hint {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
}

.auth-aside {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(24px, 6vw, 80px);
}

.preview-card,
.preview-grid div,
.table-card,
.inline-card,
.subscription-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.preview-card {
  max-width: 620px;
  padding: 28px;
}

.preview-card span,
.preview-grid span,
.stat-strip span,
.table-head span,
.record-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.preview-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(30px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
}

.preview-card p {
  max-width: 52ch;
  color: var(--muted-strong);
}

.preview-grid {
  display: grid;
  max-width: 620px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.preview-grid div {
  padding: 16px;
}

.preview-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  white-space: nowrap; /* keep values like "1 URL" / "12 mo" on one line */
}

.preview-points {
  max-width: 620px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.preview-points li {
  position: relative;
  padding-left: 26px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.5;
}

.preview-points li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid var(--accent-strong);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.workspace-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 247, 251, 0) 220px),
    var(--bg);
}

.workspace-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border);
  background: rgba(250, 251, 255, 0.95);
  padding: 16px 12px;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close {
  display: none;
}

.workspace-picker {
  display: grid;
  width: 100%;
  min-height: 52px;
  border-color: var(--border);
  background: #fff;
  padding: 9px 11px;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.workspace-picker span {
  font-weight: 700;
}

.workspace-picker small {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 2px;
}

.sidebar-nav button {
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted-strong);
  min-height: 38px;
  border-radius: 7px;
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-nav button.is-active {
  border-color: #dfe3ff;
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: none;
}

.nav-group-title {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-main {
  min-width: 0;
  min-height: 100dvh;
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  padding: 8px clamp(14px, 2.2vw, 26px);
  backdrop-filter: blur(16px);
}

.mobile-sidebar-toggle {
  display: none;
}

.search-box {
  display: flex;
  width: min(470px, 44vw);
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  color: var(--muted);
  min-height: 40px;
  padding: 8px 11px;
}

.search-box kbd {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 1px 6px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-account {
  display: grid;
  margin-left: auto;
  text-align: right;
}

.topbar-account span {
  font-weight: 800;
}

.topbar-account small {
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-content {
  display: grid;
  gap: 14px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 26px);
}

.workspace-panel {
  display: grid;
  gap: 16px;
}

.workspace-panel[hidden] {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.page-head h2 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 31px);
  line-height: 1.12;
  letter-spacing: 0;
}

.page-head p:not(.eyebrow) {
  max-width: 64ch;
  margin: 8px 0 0;
  color: var(--muted-strong);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.api-page-head {
  position: sticky;
  top: 58px;
  z-index: 8;
  background: rgba(246, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

.developer-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) auto minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.developer-endpoint {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.developer-endpoint span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

code {
  border: 1px solid #e7eaf2;
  border-radius: 6px;
  background: #f8f9fc;
  color: #202334;
  padding: 2px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  white-space: pre-wrap;
}

/* One slim bar instead of four boxed cards: the figures matter, the chrome
   around them did not. Balance still leads with the accent colour. */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.stat-strip div {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 0;
  padding: 12px 18px;
}

.stat-strip div + div {
  border-left: 1px solid var(--border);
}

.stat-strip span {
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat-strip strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* The Plan cell holds prose ("Pay as you go"), not a figure — keep it in the
   display face so monospace doesn't stretch the words awkwardly. */
.stat-strip div:nth-child(3) strong {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.stat-strip div:first-child strong {
  color: var(--accent-strong);
}

.stat-strip small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .stat-strip div {
    flex: 1 1 45%;
  }

  .stat-strip div:nth-child(3) {
    border-left: none;
  }
}

.quickstart-panel,
.key-detail-panel,
.legacy-key-panel,
.admin-checklist {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.quickstart-grid,
.key-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.quickstart-grid > div,
.key-detail-grid > div {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  border-right: 1px solid var(--border);
  padding: 12px;
}

.quickstart-grid > div:last-child,
.key-detail-grid > div:last-child {
  border-right: 0;
}

.quickstart-grid span,
.key-detail-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.key-detail-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.key-detail-grid p {
  margin: 0;
  color: var(--muted-strong);
}

.rename-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rename-row input {
  min-height: 36px;
  padding: 7px 9px;
}

.rename-row button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 7px 10px;
  font-weight: 700;
}

.legacy-key-row,
.checklist-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 1.2fr) minmax(0, 1.6fr);
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
}

.checklist-row {
  grid-template-columns: auto minmax(0, 1fr);
}

.legacy-key-row small {
  color: var(--muted);
}

.table-card {
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.table-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
  padding: 36px 16px;
  text-align: center;
}

.table-empty strong {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
}

.table-empty span {
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.55;
}

.table-empty .button {
  margin-top: 4px;
}

.table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.table-head strong {
  flex: 0 0 auto;
}

.table-head span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--muted);
  background: #fafbfe;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.key-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 11px;
}

.limit-badge {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid #e7eaf2;
  border-radius: 999px;
  background: #f8f9fc;
  padding: 2px 7px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}

.status-active {
  border-color: rgba(20, 122, 74, 0.22);
  background: rgba(20, 122, 74, 0.08);
  color: var(--success);
}

.status-revoked,
.status-expired {
  border-color: rgba(194, 53, 53, 0.16);
  background: rgba(194, 53, 53, 0.07);
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Key value + inline copy icon (Copy lives right next to the key now). */
.key-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-copy {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted-strong);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.key-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Copied state: keep the 30px box, swap the copy glyph for a green check
   instead of replacing it with the (vertically-wrapping) word "Copied". */
.key-copy.is-copied {
  border-color: #1a7f43;
  background: rgba(26, 127, 67, 0.09);
}
.key-copy.is-copied > svg {
  visibility: hidden;
}
.key-copy.is-copied::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 9px;
  border: solid #1a7f43;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}
.key-copy.is-copy-failed {
  border-color: #c0392b;
  color: #c0392b;
}

/* Any copy button that DOES swap its label must never wrap to vertical letters. */
.data-table button.is-copied,
[data-copy-text],
[data-copy-key],
[data-copy-base-url],
[data-copy-auth-header] {
  white-space: nowrap;
}

/* ⋯ actions menu — collapses Rename / Details / Revoke / Delete. */
.key-menu {
  position: relative;
  display: inline-block;
}

.key-menu-trigger {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.key-menu-trigger:hover,
.key-menu-trigger[aria-expanded="true"] {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--ink);
}

.key-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 152px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft), 0 10px 30px rgba(15, 15, 30, 0.14);
}

.key-menu-popover [role="menuitem"] {
  text-align: left;
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}

.key-menu-popover [role="menuitem"]:hover {
  background: var(--surface-muted);
}

.key-menu-popover .row-action-danger {
  color: var(--danger, #c0392b);
}

.key-menu-popover .row-action-danger:hover {
  background: color-mix(in srgb, var(--danger, #c0392b) 9%, #fff);
}

/* Let the ⋯ menu escape the key table's card (cards clip by default). */
.table-card:has(.api-keys-table) {
  overflow: visible;
}

/* "Your API keys" table — desktop column balancing. Mobile (<=820px) drops the
   table layout for stacked data-label cards, so these rules are scoped to wide
   viewports and the <colgroup> widths only take effect there. */
@media (min-width: 821px) {
  .api-keys-table {
    table-layout: fixed;
  }

  .api-keys-table .col-name { width: 18%; }
  .api-keys-table .col-key { width: 19%; }
  .api-keys-table .col-limits { width: 17%; }
  .api-keys-table .col-usage { width: 14%; }
  .api-keys-table .col-status { width: 9%; }
  .api-keys-table .col-last-used { width: 15%; }
  .api-keys-table .col-action { width: 8%; }

  /* Key column: masked value flexes/truncates so the copy icon stays put. */
  .api-keys-table .key-cell .key-mask { flex: 1; min-width: 0; }

  /* The ⋯ menu sits at the right edge of its column. */
  .api-keys-table td[data-label="Action"] { text-align: right; }

  /* Status pill and its header sit on a single line. */
  .api-keys-table th:nth-child(5),
  .api-keys-table td[data-label="Status"] .status-pill {
    white-space: nowrap;
  }

  /* Masked key value: tighter mono, breaks to at most two lines. */
  .api-keys-table .key-mask {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    word-break: break-all;
  }

  /* Usage: two stacked lines (requests + tokens, then spend). */
  .api-keys-table .key-usage {
    display: block;
  }
}

.key-usage-line {
  display: block;
}

.key-usage-spend {
  margin-top: 2px;
}

/* Top model (most-used first) shown in the key row so the dominant model leads;
   the "+N more" tail hints at multi-model use. Full breakdown is in Details. */
.key-usage-models {
  margin-top: 4px;
  display: inline-block;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}
.key-usage-more {
  color: var(--muted);
  font-weight: 600;
}

/* Per-model usage breakdown in the key Details panel. */
.key-models-panel {
  margin: 4px 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.key-model-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
}
.key-model-row code {
  font-size: 12.5px;
  color: var(--accent-strong);
  word-break: break-all;
}
.key-model-row span {
  flex: none;
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}
.key-model-empty {
  margin: 0;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Reveal-once banner: the primary place to copy a newly created full API key. */
.key-reveal-banner {
  margin: 0 0 16px;
  border: 1px solid rgba(20, 122, 74, 0.28);
  border-radius: 12px;
  background: rgba(20, 122, 74, 0.06);
  padding: 14px 16px;
}

.key-reveal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.key-reveal-head strong {
  font-size: 15px;
  color: var(--success);
}

.key-reveal-dismiss {
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.key-reveal-note {
  margin: 6px 0 12px;
  color: var(--muted-strong);
  font-size: 13px;
}

.key-reveal-value {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.key-reveal-value code {
  flex: 1 1 240px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px 12px;
  font-size: 13px;
  word-break: break-all;
}

.key-reveal-value .button {
  flex: 0 0 auto;
}

.data-table button,
.record-list button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 6px 10px;
  font-weight: 700;
}

.data-table button:hover,
.record-list button:hover {
  border-color: var(--border-strong);
  background: var(--surface-muted);
}

/* Provider-key health surfacing in the admin Provider Keys panel. The badge
   color is paired with a text label so status is never conveyed by color alone. */
.provider-health-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.provider-health-ok {
  border: 1px solid rgba(20, 122, 74, 0.18);
  background: rgba(20, 122, 74, 0.08);
  color: var(--success);
}

.provider-health-degraded {
  border: 1px solid rgba(194, 53, 53, 0.18);
  background: rgba(194, 53, 53, 0.08);
  color: var(--danger);
}

.provider-key-error {
  color: var(--danger);
}

/* The empty-state CTA is a real primary action — keep its accent styling and a
   comfortable hit area, not the compact table-row button treatment. */
.table-empty .button-primary {
  min-height: 44px;
  border-color: var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
}

.table-empty .button-primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.offer-list,
.record-list {
  display: grid;
  gap: 10px;
}

.offer-list > div,
.record-list > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-soft);
}

.offer-list span,
.record-list span {
  color: var(--muted-strong);
}

/* --- Support chat -------------------------------------------------------- */
.support-chat {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.support-threads {
  display: grid;
  gap: 14px;
  padding: 18px;
  align-content: start;
}

.support-threads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.support-threads-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.support-thread-list {
  display: grid;
  gap: 10px;
}

.support-thread {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.support-thread:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.support-thread:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.support-thread-subject {
  font-weight: 600;
  color: var(--text);
}

.support-thread-preview {
  color: var(--muted-strong);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-thread-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.support-empty,
.support-greeting {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  padding: 38px 24px;
  color: var(--muted-strong);
}

.support-empty-title,
.support-greeting-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.support-empty-body,
.support-greeting-body {
  margin: 0;
  max-width: 46ch;
  font-size: 13px;
}

/* Conversation view: header / scrolling log / composer.
   Height is a fixed px (not vh) so the 1fr message track is always
   well-defined and the log scrolls reliably across environments. */
.support-conversation {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  /* Pin the single column to the container width (minmax(0,1fr)); the default
     auto column would size to the widest bubble and overflow the panel. */
  grid-template-columns: minmax(0, 1fr);
  height: 520px;
}

.support-conversation-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.support-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  min-height: 32px;
}

.support-back:hover {
  background: var(--accent-soft);
}

.support-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.support-conversation-subject {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  /* min-height/min-width:0 let this grid track shrink below its content so the
     log scrolls vertically and never widens the panel horizontally (a grid
     item's default min-size is its content). Scroll-behavior is left at the
     default (auto) so the JS jump-to-newest is instant across engines. */
  min-height: 0;
  min-width: 0;
  background: var(--surface-muted);
}

.support-messages:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.support-bubble-row {
  display: flex;
}

.support-bubble-row.is-user {
  justify-content: flex-end;
}

.support-bubble-row.is-support {
  justify-content: flex-start;
}

.support-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--shadow-soft);
}

.support-bubble-row.is-user .support-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.support-bubble-row.is-support .support-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.support-bubble-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-bubble-body strong {
  font-weight: 600;
}

.support-bubble-meta {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.75;
}

.support-bubble-row.is-user .support-bubble-meta {
  color: rgba(255, 255, 255, 0.85);
}

.support-bubble-row.is-support .support-bubble-meta {
  color: var(--muted);
}

/* Typing indicator while the auto-reply is in flight */
.support-bubble-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
}

.support-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: support-bounce 1.2s infinite ease-in-out;
}

.support-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.support-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes support-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.support-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 4px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
}

.support-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
}

.support-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.support-send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  white-space: nowrap;
}

.support-send[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.support-composer-hint {
  margin: 0;
  padding: 0 16px 12px;
  font-size: 11px;
  color: var(--muted);
}

.support-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted-strong);
}

.support-status.is-error {
  color: var(--danger);
}

@media (max-width: 520px) {
  .support-conversation {
    height: 70vh;
    min-height: 420px;
  }

  .support-bubble {
    max-width: 88%;
  }

  .support-send-text {
    display: none;
  }

  /* The global mobile rule makes every .button full-width; keep the chat send
     button compact (icon-only) so the input keeps its space. Higher specificity
     (descendant) so it wins over the later global `.button { width:100% }`. */
  .support-composer .support-send {
    width: auto;
    flex: 0 0 auto;
    padding: 10px 14px;
  }

  .support-threads-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-dot {
    animation: none;
  }

  .support-messages {
    scroll-behavior: auto;
  }

  .support-thread {
    transition: none;
  }
}

.credit-pack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* Same elevated tile language as the home pricing tiers (.tier-card). */
.credit-pack {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px 16px 18px;
  border-radius: 13px;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.credit-pack-bonus {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
}

.credit-pack-flow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.credit-pack-pay {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-strong);
}

.credit-pack-arrow {
  color: var(--accent);
  font-weight: 700;
}

.credit-pack-get {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.credit-pack-caption {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Action affordance — always present, but only emphasised on hover/selection. */
.credit-pack-cta {
  margin-top: 8px;
  justify-self: start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted-strong);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 14px;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.credit-pack:hover .credit-pack-cta {
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* Recommended pack matches the home "Best value" tile. */
.credit-pack.is-best {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), #fff 70%);
  box-shadow: 0 14px 30px rgba(100, 103, 242, 0.18);
}

.credit-pack.is-best .credit-pack-get,
.credit-pack.is-best .credit-pack-bonus {
  color: var(--accent-strong);
}

/* Selected state reads clearly: accent ring + filled CTA. */
.credit-pack.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent) inset, 0 12px 26px rgba(100, 103, 242, 0.2);
}

.credit-pack.is-selected .credit-pack-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Keep the recommended/selected tints on hover instead of the generic
   surface-muted fill the base .credit-pack:hover rule would apply. */
.credit-pack.is-best:hover {
  background: linear-gradient(180deg, var(--accent-soft), #fff 70%);
  border-color: var(--accent);
}

.credit-pack.is-selected:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.credit-pack:hover {
  transform: translateY(-2px);
}

.inline-card,
.subscription-card,
.settings-grid {
  display: grid;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.inline-card {
  grid-template-columns: minmax(180px, 260px) auto minmax(0, 1fr);
}

.subscription-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.subscription-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.subscription-card p {
  margin: 0;
  color: var(--muted-strong);
}

.form-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.command-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  background: rgba(20, 20, 28, 0.22);
  padding: 12vh 16px;
}

.command-dialog[hidden] {
  display: none;
}

.command-surface {
  width: min(620px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.command-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 12px;
}

.command-input-row input {
  border: 0;
}

.command-input-row button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 4px 9px;
}

.command-list {
  display: grid;
  padding: 8px;
}

.command-list button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 10px;
  text-align: left;
}

.command-list button:hover {
  background: var(--surface-muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(20, 20, 28, 0.28);
  padding: 24px;
}

.modal-sheet {
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 48px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding: 18px;
}

.modal-head h2,
.modal-head p {
  margin: 0;
}

.modal-head h2 {
  font-size: 24px;
  line-height: 1.15;
}

.modal-head p:not(.eyebrow),
.modal-hint {
  color: var(--muted-strong);
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-hint {
  margin: 0;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Allowed-models multi-select --------------------------------------- */

.models-field {
  display: grid;
  gap: 7px;
}

.models-field-label,
.model-select-fallback-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.model-select {
  position: relative;
  display: grid;
  gap: 0;
}

.model-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
}

.model-select-trigger:hover {
  border-color: var(--border-strong);
}

.model-select-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-select-caret {
  color: var(--muted);
  font-size: 11px;
  flex: none;
}

.model-select-trigger[aria-expanded="true"] .model-select-caret {
  transform: rotate(180deg);
}

/* The popover flows inline (it pushes the rest of the form down) rather than
   floating absolutely. Inside a scrolling modal this avoids clipping at the
   sheet edge and keeps the whole list reachable at every breakpoint. */
.model-select-popover {
  margin-top: 8px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.model-select-search-row {
  display: grid;
}

.model-select-search {
  min-height: 40px;
}

.model-select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-strong);
  font-weight: 600;
}

.model-select-clear {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--accent-strong);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
}

.model-select-clear:hover {
  border-color: var(--border-strong);
}

.model-select-list {
  overflow-y: auto;
  display: grid;
  gap: 12px;
  max-height: 200px;
  padding-right: 2px;
}

.model-group {
  display: grid;
  gap: 4px;
}

.model-group-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.model-group-title span {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0;
}

.model-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.model-option:hover {
  background: var(--surface-muted);
}

.model-option input {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}

.model-option-id {
  overflow-wrap: anywhere;
}

.model-select-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.model-select-fallback {
  display: grid;
  gap: 7px;
}

@media (max-width: 1020px) {
  .public-hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .public-route-visual {
    min-height: 460px;
  }

  .public-signal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-family-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pricing-layout {
    grid-template-columns: 1fr;
  }

  .charge-steps {
    grid-template-columns: 1fr;
  }

  .benefit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-routing {
    display: grid;
  }

  .stat-strip,
  .credit-pack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .developer-strip {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .developer-strip .developer-endpoint:nth-of-type(2) {
    grid-column: 1 / -1;
  }

  .quickstart-grid,
  .key-detail-grid {
    grid-template-columns: 1fr;
  }

  .quickstart-grid > div,
  .key-detail-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .quickstart-grid > div:last-child,
  .key-detail-grid > div:last-child {
    border-bottom: 0;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-aside {
    align-content: start;
  }
}

@media (max-width: 820px) {
  body {
    font-size: 13px;
  }

  .public-topbar {
    position: sticky;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .public-nav-toggle {
    display: inline-grid;
  }

  /* Collapse the links into a full-width dropdown under the bar; the hamburger
     opens it. Keeps one clean row + one CTA instead of 8 links wrapping. */
  .public-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 10px;
  }

  .public-topbar.nav-open .public-nav {
    display: flex;
  }

  .public-nav a:not(.button) {
    padding: 13px 6px;
    border-top: 1px solid var(--border);
    font-size: 16px;
  }

  .public-nav .button {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }

  .public-hero,
  .public-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .public-hero-copy h1 {
    font-size: 48px;
  }

  .public-lede {
    font-size: 16px;
  }

  .public-route-visual {
    min-height: 380px;
  }

  .public-metric-strip {
    grid-template-columns: 1fr;
  }

  .public-endpoint-card {
    grid-template-columns: 1fr;
  }

  .public-endpoint-card .button {
    width: 100%;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
  }

  .workspace-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .workspace-shell.sidebar-open .workspace-sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .mobile-sidebar-toggle {
    display: inline-grid;
  }

  .workspace-topbar {
    gap: 8px;
    padding: 8px 12px;
  }

  .search-box {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .search-box span:nth-child(2),
  .search-box kbd,
  .topbar-account small {
    display: none;
  }

  .topbar-account {
    margin-left: 0;
    font-size: 12px;
  }

  .workspace-content {
    padding: 14px;
  }

  .page-head {
    display: grid;
    gap: 12px;
  }

  .api-page-head {
    position: static;
    background: transparent;
    backdrop-filter: none;
  }

  .page-head h2 {
    font-size: 24px;
  }

  .page-actions {
    justify-content: stretch;
  }

  .page-actions .button {
    flex: 1 1 160px;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .developer-strip {
    grid-template-columns: 1fr;
  }

  .developer-strip .button {
    width: 100%;
  }

  .inline-card,
  .subscription-card,
  .form-grid,
  .settings-grid,
  .legacy-key-row {
    grid-template-columns: 1fr;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(72px, max-content) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: center;
    border-bottom: 0;
    padding: 6px 10px;
  }

  .data-table td::before {
    align-self: start;
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 800;
    padding-top: 2px;
  }

  /* In mobile card rows, pills and action groups should hug their content,
     not stretch to fill the grid cell. */
  .data-table td .status-pill,
  .data-table td .limit-badge {
    justify-self: start;
  }

  .data-table td .row-actions,
  .data-table td .key-limits {
    justify-self: stretch;
  }

  /* Compact API-key cards. The generic label-per-row layout stacks 7 tall rows
     per key; reflow into name+kebab / key / status+limits / usage / last-used
     with no label column, so each key takes far less vertical space. */
  .api-keys-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 10px;
    padding: 16px 20px;
  }
  .api-keys-table td {
    display: block;
    width: auto;
    padding: 0;
    margin: 0;
  }
  .api-keys-table td::before {
    content: none;
  }
  .api-keys-table td[data-label="Name"] {
    flex: 1 1 auto;
    min-width: 0;
    order: 1;
  }
  .api-keys-table td[data-label="Action"] {
    order: 2;
    margin-left: auto;
  }
  .api-keys-table td[data-label="Key"] {
    flex: 1 1 100%;
    order: 3;
  }
  .api-keys-table td[data-label="Status"] { order: 4; }
  .api-keys-table td[data-label="Limits"] { order: 5; }
  .api-keys-table td[data-label="Usage"] {
    flex: 1 1 100%;
    order: 6;
  }
  .api-keys-table td[data-label="Last used"] {
    flex: 1 1 100%;
    order: 7;
  }
  /* usage + last-used collapse to a single muted line each */
  .api-keys-table .key-usage-line {
    display: inline;
  }
  .api-keys-table .key-usage-spend::before {
    content: " · ";
  }
  .api-keys-table .key-usage {
    font-size: 12.5px;
  }
  .api-keys-table td[data-label="Name"] small {
    font-size: 12px;
  }
}

@media (max-width: 520px) {
  .public-hero-copy h1 {
    font-size: 40px;
  }

  .public-actions .button {
    width: 100%;
  }

  .model-family-grid {
    grid-template-columns: 1fr;
  }

  .pricing-tiers-card {
    padding: 18px;
  }

  .tier-grid {
    grid-template-columns: 1fr;
  }

  .benefit-grid {
    grid-template-columns: 1fr;
  }

  .pricing-rate td {
    white-space: normal;
  }

  .public-route-visual {
    min-height: 320px;
  }

  .route-core {
    width: 58%;
  }

  .route-node {
    min-width: 92px;
    min-height: 44px;
    font-size: 12px;
  }

  .node-credit {
    top: 12%;
    left: 8%;
  }

  .node-model {
    top: 18%;
    right: 8%;
  }

  .node-support {
    bottom: 14%;
    left: 9%;
  }

  .node-key {
    right: 8%;
    bottom: 16%;
  }

  .public-signal-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .auth-aside {
    padding: 20px;
  }

  .auth-copy h1 {
    max-width: 12ch;
    font-size: 32px;
  }

  .preview-grid,
  .credit-pack-grid {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-content {
    padding: 10px;
  }

  .page-head h2 {
    font-size: 22px;
  }

  .workspace-message {
    width: 100%;
    border-radius: 8px;
  }

  .button {
    width: 100%;
  }

  .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .row-actions button {
    width: 100%;
  }

  /* The search box collapses to a bare icon on phones and competes with the
     account balance and action buttons. Hide it and surface search through the
     sidebar instead so the topbar can breathe. */
  .workspace-topbar .search-box {
    display: none;
  }

  .topbar-account {
    margin-left: 0;
    margin-right: auto;
  }

  .workspace-topbar .button {
    width: auto;
    padding-inline: 12px;
  }

  /* When the table-head description wraps under the title on phones, left-align
     it so it reads as a normal subtitle instead of a stranded right-aligned line. */
  .table-head span {
    flex-basis: 100%;
    text-align: left;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-sheet {
    max-height: calc(100dvh - 20px);
  }

  .modal-head,
  .modal-form {
    padding: 14px;
  }

  .modal-actions {
    display: grid;
  }

  /* On phones the modal docks to the bottom; keep the popover compact and its
     list scrollable so a long catalog never pushes actions off-screen. */
  .model-select-popover {
    max-height: 60vh;
  }

  .model-select-list {
    max-height: 38vh;
  }
}

/* ---------------------------------------------------------------------------
   Motion & interaction polish (additive). Reveal/tilt effects are gated behind
   the .motion class on <html>, which is only present when the user has NOT
   requested reduced motion — so reduced-motion users get the final, static
   state with no hidden content.
   --------------------------------------------------------------------------- */

/* Scroll-reveal: elements start slightly lowered + transparent, then settle.
   Tilt-cards are excluded from the transform half of the reveal so the pointer
   tilt (which also drives transform) does not fight the reveal end-state — they
   reveal via opacity only. */
.motion [data-reveal] {
  opacity: 0;
  transition: opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.motion [data-reveal]:not(.tilt-card) {
  transform: translateY(16px);
}

.motion [data-reveal].is-revealed:not(.tilt-card) {
  transform: none;
}

.motion [data-reveal].is-revealed {
  opacity: 1;
}

/* Pointer tilt on feature/pricing cards via CSS 3D perspective. */
.motion .tilt-card {
  transform: perspective(720px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateZ(0);
  transition: transform 200ms ease, box-shadow 200ms ease, opacity 620ms cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.motion .tilt-card.is-tilting {
  transition: transform 80ms ease-out, box-shadow 200ms ease;
  box-shadow: 0 22px 44px rgba(18, 23, 38, 0.12);
}

/* Sheen sweep on primary buttons. */
.button-primary {
  position: relative;
  overflow: hidden;
}

.button-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.28),
    transparent
  );
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.motion .button-primary:hover::after {
  animation: button-sheen 720ms ease;
}

@keyframes button-sheen {
  0% {
    left: -60%;
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    left: 130%;
    opacity: 0;
  }
}

/* Copy feedback pulse on code-block / API-key copy buttons. */
.is-copied {
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.motion .is-copied {
  animation: copy-pop 360ms ease;
}

@keyframes copy-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

/* Slightly richer input focus affordance (purely additive to the focus ring). */
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

/* ===========================================================================
   Models catalog — browse / search / filter / sort / compare
   Dense, light, mono numerals. Used on both the public home and the workspace.
   =========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.button-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  border-radius: 8px;
  padding: 10px 12px;
}

.button-ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.available-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(20, 122, 74, 0.28);
  background: rgba(20, 122, 74, 0.08);
  color: var(--success);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.available-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(20, 122, 74, 0.14);
}

/* Comparison-only models: muted/grey, visually de-emphasised but readable. The
   text label (not colour alone) carries the meaning for accessibility. */
.unavailable-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.unavailable-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(100, 105, 120, 0.12);
}

.model-card-tags {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.newest-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(100, 103, 242, 0.34);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* --- Catalog: browse layout (left rail + main column) --- */
.models-catalog {
  display: block;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.catalog-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* --- Left filter rail --- */
.catalog-rail-disclosure {
  position: sticky;
  /* Clears the workspace sticky topbar (~61px) so the rail is not tucked under
     it; on the public home there is no topbar so this is just a small offset. */
  top: 76px;
}

/* On desktop the rail is always shown: the disclosure summary is hidden and the
   rail content is always visible (it only acts as a drawer at narrow widths). */
.catalog-rail-summary {
  display: none;
}

.catalog-rail {
  display: grid;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.catalog-rail-section {
  display: grid;
  gap: 9px;
}

.catalog-rail-title {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.catalog-check-group {
  display: grid;
  gap: 6px;
}

.catalog-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-strong);
  cursor: pointer;
}

.catalog-check input {
  width: 17px;
  height: 17px;
  min-height: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.catalog-check-label {
  flex: 1 1 auto;
}

.catalog-check-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.catalog-check-flush {
  margin-top: 2px;
}

.catalog-range {
  display: grid;
  gap: 8px;
}

.catalog-range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-strong);
}

.catalog-range-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
}

.catalog-range input[type="range"] {
  width: 100%;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.catalog-rail-reset {
  justify-self: start;
}

/* --- Modality tabs (with live counts) --- */
.catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.catalog-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 9px 9px 0 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.catalog-tab:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.catalog-tab.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

.catalog-tab-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
}

.catalog-tab.is-active .catalog-tab-count {
  background: #fff;
  color: var(--accent-strong);
}

.catalog-tab:focus-visible {
  outline: 3px solid rgba(100, 103, 242, 0.24);
  outline-offset: 2px;
}

/* --- Top toolbar: search + sort + view toggle --- */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.catalog-search {
  position: relative;
  display: block;
  flex: 1 1 240px;
}

.catalog-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
}

.catalog-search input {
  padding-left: 38px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.catalog-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.catalog-field {
  display: grid;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.catalog-field-block {
  display: block;
}

.catalog-field-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.catalog-field-inline > span {
  white-space: nowrap;
}

.catalog-field select {
  min-height: 40px;
  border-radius: 9px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  width: 100%;
}

.catalog-field-block select {
  width: 100%;
}

.catalog-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  overflow: hidden;
  flex: 0 0 auto;
}

.catalog-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.catalog-view-btn + .catalog-view-btn {
  border-left: 1px solid var(--border);
}

.catalog-view-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.catalog-view-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.catalog-view-btn:focus-visible {
  outline: 3px solid rgba(100, 103, 242, 0.24);
  outline-offset: -2px;
}

/* Pure-CSS list/grid glyphs so no icon font or external asset is needed. */
.catalog-view-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.catalog-view-icon-list {
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor);
  background-size: 100% 2px;
  background-position: 0 2px, 0 7px, 0 12px;
  background-repeat: no-repeat;
}

.catalog-view-icon-grid {
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor);
  background-size: 6px 6px;
  background-position: 0 0, 10px 0, 0 10px, 10px 10px;
  background-repeat: no-repeat;
}

.catalog-count {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.catalog-count strong {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
}

.catalog-count-note {
  color: var(--muted);
}

@media (max-width: 520px) {
  .catalog-count-note {
    display: block;
    margin-top: 2px;
  }
}

/* --- Card grid --- */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 14px;
}

.model-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.model-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* Available models are the neutral default. The newest releases get a subtle
   accent so they stand out in the grid. */
.model-card.is-newest {
  border-color: rgba(100, 103, 242, 0.34);
}

/* Comparison-only models sit on a muted surface and read slightly recessed, so
   the available set leads the eye while these stay fully browsable. */
.model-card.is-unavailable {
  background: var(--surface-muted);
  border-style: dashed;
}

.model-card.is-unavailable .model-card-id h3,
.model-card.is-unavailable .model-card-desc,
.model-card.is-unavailable .model-card-stats dd {
  color: var(--muted-strong);
}

.model-card.is-unavailable .model-card-provider {
  color: var(--muted);
}

.model-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.model-card-id {
  flex: 1 1 auto;
  min-width: 0;
}

.model-card .model-card-tags {
  flex: 0 0 auto;
}

/* Provider glyph (text avatar) — no external logos are fetched. */
.model-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(100, 103, 242, 0.28);
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.model-card.is-unavailable .model-avatar {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--muted-strong);
}

.model-card-id h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.model-card-provider {
  margin: 3px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-strong);
}

.model-card-modalities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modality-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

.modality-text { border-color: rgba(100, 103, 242, 0.28); background: var(--accent-soft); color: var(--accent-strong); }
.modality-image { border-color: rgba(159, 100, 7, 0.26); background: rgba(159, 100, 7, 0.08); color: var(--warning); }
.modality-video { border-color: rgba(194, 53, 53, 0.24); background: rgba(194, 53, 53, 0.07); color: var(--danger); }
.modality-audio { border-color: rgba(20, 122, 74, 0.26); background: rgba(20, 122, 74, 0.07); color: var(--success); }

.model-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.model-card-stats div {
  display: grid;
  gap: 2px;
}

.model-card-stats dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.model-card-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.model-card-stats dd small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.model-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.model-card-cutoff {
  font-size: 11.5px;
  color: var(--muted);
}

/* Open-weight source link on model cards/rows. */
.model-card-source {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-strong);
  white-space: nowrap;
}
.model-card-source:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.model-row-meta .model-card-source {
  margin-left: 10px;
}

.model-card-compare {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 0;
  border: none;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-strong);
  cursor: pointer;
}

.model-card-compare input {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--accent);
}

/* --- List view (rows) --- */
.models-list {
  display: grid;
  gap: 10px;
}

.model-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.model-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.model-row.is-newest {
  border-color: rgba(100, 103, 242, 0.34);
}

.model-row.is-unavailable {
  background: var(--surface-muted);
  border-style: dashed;
}

.model-row.is-unavailable .model-row-name,
.model-row.is-unavailable .model-row-desc {
  color: var(--muted-strong);
}

.model-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.model-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.model-row-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.model-row-provider {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-strong);
}

.model-row.is-unavailable .model-row-provider {
  color: var(--muted);
}

.model-row-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.model-meta-item {
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

.model-meta-key {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--muted);
  margin-right: 3px;
}

.model-row-aside {
  flex: 0 0 auto;
  align-self: center;
}

.catalog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-muted);
}

.catalog-empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.catalog-empty-body {
  margin: 6px auto 16px;
  max-width: 42ch;
  font-size: 13px;
}

/* Inline "N hidden by your filters — Reset filters" hint on the count line. */
.catalog-hidden {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
  color: var(--text);
  font-weight: 500;
}

.catalog-reset {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.catalog-empty .catalog-reset {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  text-decoration: none;
}

.catalog-reset:hover {
  color: var(--accent-strong, var(--accent));
}

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

/* --- Compare selection bar --- */
.compare-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  position: sticky;
  bottom: 12px;
  z-index: 5;
}

.compare-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 600;
}

.compare-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1;
}

.compare-chip button:hover {
  background: var(--danger);
  color: #fff;
}

.compare-bar-actions {
  display: flex;
  gap: 8px;
}

.compare-bar-actions .button {
  border-radius: 9px;
}

.button-primary[disabled],
.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Compare modal --- */
.compare-sheet {
  width: min(960px, 100%);
}

.compare-table-wrap {
  overflow-x: auto;
  padding: 4px 18px 18px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.compare-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 2px solid var(--border-strong);
  z-index: 1;
}

.compare-table tbody th {
  width: 150px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-muted);
}

.compare-col-name {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.compare-col-provider {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
}

.compare-table td code {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.compare-table tbody tr:hover td {
  background: var(--surface-raised);
}

/* Availability cells in the compare table: clear text + colour, not colour alone. */
.compare-avail {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.compare-avail-yes {
  border: 1px solid rgba(20, 122, 74, 0.28);
  background: rgba(20, 122, 74, 0.08);
  color: var(--success);
}

.compare-avail-no {
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--muted);
}

/* --- Responsive: collapse the rail into a drawer below the tabs --- */
@media (max-width: 900px) {
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* The rail becomes a real disclosure drawer: show the summary toggle, hide
     the rail body until opened. On desktop the body is always visible. */
  .catalog-rail-disclosure {
    position: static;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }
  .catalog-rail-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }
  .catalog-rail-summary::-webkit-details-marker {
    display: none;
  }
  .catalog-rail-summary-icon {
    width: 16px;
    height: 12px;
    background-image:
      linear-gradient(currentColor, currentColor),
      linear-gradient(currentColor, currentColor),
      linear-gradient(currentColor, currentColor);
    background-size: 100% 2px, 70% 2px, 40% 2px;
    background-position: 0 0, 0 5px, 0 10px;
    background-repeat: no-repeat;
    color: var(--muted);
  }
  .catalog-rail-summary-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .catalog-rail-disclosure[open] .catalog-rail-summary {
    border-bottom: 1px solid var(--border);
  }
  .catalog-rail {
    border: none;
    border-radius: 0 0 12px 12px;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .catalog-toolbar {
    align-items: stretch;
  }
  .catalog-search {
    flex-basis: 100%;
  }
  .catalog-toolbar-controls {
    width: 100%;
    justify-content: space-between;
  }
  .catalog-field-inline {
    flex: 1 1 auto;
  }
  .catalog-field-inline select {
    flex: 1 1 auto;
  }
}

/* --- Responsive: mobile (cards, single column) --- */
@media (max-width: 520px) {
  .models-grid {
    grid-template-columns: 1fr;
  }
  .catalog-tab {
    padding: 8px 11px;
    font-size: 13px;
  }
  .model-row {
    flex-wrap: wrap;
  }
  .model-row-aside {
    align-self: flex-start;
  }
  .compare-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .compare-bar-actions .button {
    flex: 1;
  }
  .compare-table tbody th {
    width: 110px;
  }
}

input[type="search"]:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(100, 103, 242, 0.24);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .model-card:hover {
    transform: none;
  }
}

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

/* --- Consent checkbox (sign-up + checkout) ------------------------------- */
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}

.consent-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent-check a {
  color: var(--accent-strong);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-turnstile {
  margin: 4px 0 2px;
  min-height: 65px;
  display: flex;
  justify-content: center;
}

.auth-turnstile[hidden] {
  display: none;
}

.consent-check a:hover {
  color: var(--accent);
}

.consent-check.consent-check-error {
  border-color: var(--danger);
  background: rgba(194, 53, 53, 0.06);
  color: var(--danger);
}

.consent-check-checkout {
  margin-top: 4px;
}

.support-cure-note {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.5;
}

.support-cure-note a {
  color: var(--accent-strong);
  font-weight: 600;
}

.settings-legal-links {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.settings-legal-links a {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.settings-legal-links a:hover {
  text-decoration: underline;
}

/* --- Public footer ------------------------------------------------------- */
.public-footer {
  border-top: 1px solid rgba(228, 231, 238, 0.9);
  background: rgba(255, 255, 255, 0.6);
}

.public-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 64px);
}

.public-footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.public-footer-nav {
  display: flex;
  gap: 20px;
}

.public-footer-nav a {
  color: var(--muted-strong);
  font-weight: 600;
  text-decoration: none;
}

.public-footer-nav a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.public-footer-note {
  flex: 1 1 240px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

/* --- Multi-column marketing footer ------------------------------------- */
.site-footer {
  border-top: 1px solid rgba(228, 231, 238, 0.9);
  background: rgba(255, 255, 255, 0.6);
}

.site-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 48px clamp(18px, 4vw, 64px) 28px;
}

.site-footer-brand-col {
  max-width: 360px;
}

.site-footer-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.site-footer-col h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.site-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer-col li {
  color: var(--muted-strong);
  font-size: 14px;
}

.site-footer-col a {
  color: var(--muted-strong);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-col a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 28px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 18px clamp(18px, 4vw, 64px) 36px;
  border-top: 1px solid rgba(228, 231, 238, 0.7);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .site-footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px 24px;
    padding-top: 36px;
  }

  .site-footer-brand-col {
    grid-column: 1 / -1;
  }

  .site-footer-bottom {
    flex-direction: column;
  }
}

/* --- Legal page (/terms, /refund-policy) --------------------------------- */
.legal-page {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
}

.legal-page .public-nav a.is-active {
  color: var(--accent-strong);
}

.legal-article {
  flex: 1 1 auto;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 32px) clamp(48px, 6vw, 80px);
  outline: none;
}

.legal-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.legal-header h1 {
  margin: 4px 0 12px;
  font-size: clamp(30px, 4.4vw, 44px);
}

.legal-intro {
  margin: 0;
  color: var(--muted-strong);
  font-size: 17px;
  line-height: 1.6;
}

.legal-section {
  margin-top: 36px;
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: clamp(20px, 2.6vw, 25px);
}

.legal-section p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.legal-list {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text);
}

.legal-list li {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.legal-code {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow-x: auto;
}

.legal-code code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.legal-example {
  margin: 0 0 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.legal-example figcaption {
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.legal-example-table {
  width: 100%;
  border-collapse: collapse;
}

.legal-example-table th,
.legal-example-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
}

.legal-example-table th {
  font-weight: 500;
  color: var(--muted-strong);
}

.legal-example-table td {
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}

.legal-example-table tr:last-child th,
.legal-example-table tr:last-child td {
  border-bottom: none;
  font-weight: 700;
  color: var(--text);
}

.legal-example-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

@media (max-width: 520px) {
  .public-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .public-footer-note {
    text-align: left;
  }

  .legal-example-table th,
  .legal-example-table td {
    font-size: 13.5px;
  }

  .legal-example-table td {
    white-space: normal;
  }
}

/* Provisioning + MCP cards (API keys panel). Reuse the table-card chrome and the
   design-system accent so they read as first-class workspace surfaces. */
.provisioning-card,
.mcp-card {
  margin-top: 18px;
}

.provisioning-body,
.mcp-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

.provisioning-status {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-strong);
}

.provisioning-reveal {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
}

.provisioning-reveal label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
}

.provisioning-secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.provisioning-secret-row code {
  flex: 1 1 240px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.provisioning-reveal small {
  color: var(--muted);
  font-size: 12px;
}

.provisioning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.provisioning-snippet summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
}

.provisioning-snippet pre,
.mcp-body pre {
  margin: 10px 0 6px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.provisioning-snippet pre code,
.mcp-body pre code,
.mcp-body .developer-endpoint code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
}

.provisioning-snippet small,
.mcp-body .muted {
  color: var(--muted);
  font-size: 12px;
}

.mcp-body .developer-endpoint code {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* --- Admin · all-users console ----------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.admin-users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-users-toolbar input[type="search"],
.admin-users-toolbar select {
  min-height: 38px;
}

.admin-users-toolbar input[type="search"] {
  min-width: 220px;
}

.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-users-table-card {
  overflow: hidden;
}

.admin-user-row {
  cursor: pointer;
}

.admin-user-row:hover {
  background: var(--surface-muted);
}

.admin-user-row.is-selected {
  background: var(--accent-soft);
}

.admin-user-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.admin-user-row [data-admin-user-open] { cursor: pointer; }
.admin-user-row.is-blocked { background: rgba(194, 53, 53, 0.05); }
.admin-user-row.is-blocked td[data-label="User"] strong { color: var(--danger); }

.admin-user-check-col { width: 34px; }
.admin-user-check { text-align: center; }
.admin-user-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.admin-user-rank {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
}

/* Bulk block/unblock action bar — shown only when accounts are selected. */
.admin-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 600;
}

.admin-bulk-bar[hidden] { display: none; }
.admin-bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.button-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}
.button-danger:hover { filter: brightness(0.94); }

/* Admin support inbox — thread with messages + reply composer. */
.admin-thread {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface);
}
.admin-thread-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.admin-thread-head small { color: var(--muted); }
.admin-thread-msgs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.admin-thread-msg {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-muted);
  max-width: 85%;
}
.admin-thread-msg p { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; }
.admin-thread-msg-admin { align-self: flex-end; background: var(--accent-soft); }
.admin-thread-who { font-size: 11px; font-weight: 600; color: var(--muted); }
.admin-thread-reply { display: flex; gap: 8px; align-items: flex-end; }
.admin-thread-reply textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  resize: vertical;
}

.admin-usage-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.admin-usage-filter select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}
.admin-usage-filter-total {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

/* Admin spend monitor — per-call feed + top accounts + anomaly flags. */
.spend-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.spend-filter-bar input[type="search"] {
  flex: 1 1 220px;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
}
.spend-filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font-size: 14px;
}
.spend-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

/* Platform consumption breakdowns: by-date and by-model horizontal bars. */
.spend-breakdowns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}
.spend-bars {
  padding: 10px 14px;
  max-height: 340px;
  overflow-y: auto;
}
.spend-bar-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.spend-bar-label {
  font-size: 12px;
  color: var(--muted-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spend-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}
.spend-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.spend-bar-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-strong);
  white-space: nowrap;
}
.spend-bar-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
@media (max-width: 760px) {
  .spend-breakdowns { grid-template-columns: 1fr; }
}
.spend-accounts-card .record-list { padding: 6px; max-height: 520px; overflow-y: auto; }
.spend-accounts-card .record-list > div { padding: 8px 10px; border-radius: 8px; }
.spend-accounts-card .record-list strong { font-family: var(--font-mono); }
.spend-row-flagged { background: rgba(194, 53, 53, 0.06); }
.spend-row-flagged td[data-label="Cost"] { color: var(--danger); font-weight: 700; }
.spend-flag { color: var(--danger); }
.spend-account-flagged { background: rgba(194, 53, 53, 0.08); }
.spend-account-flagged strong { color: var(--danger); }

/* Provider-key rotate control — paste a fresh secret in place (stays wired). */
.provider-key-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.provider-rotate-input,
.provider-cap-input {
  flex: 1 1 220px;
  min-width: 160px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.provider-cap-input { flex: 0 1 200px; }
.provider-key-cap { display: block; margin-top: 2px; }
.provider-rotate-btn,
.provider-cap-btn {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.provider-rotate-btn:hover,
.provider-cap-btn:hover { background: var(--surface-muted); }
.provider-rotate-btn:disabled,
.provider-cap-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 860px) {
  .spend-layout { grid-template-columns: 1fr; }
}

.data-table td.num {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.admin-user-detail {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-detail-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.admin-detail-head p {
  margin: 2px 0 12px;
  overflow-wrap: anywhere;
}

.admin-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}

.admin-meta-grid div {
  min-width: 0;
}

.admin-meta-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-meta-grid dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-credit-form {
  border: 1px solid var(--accent-soft);
  border-radius: 10px;
  background: var(--accent-soft);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-credit-form h4 {
  margin: 0;
  font-size: 14px;
}

.admin-credit-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.admin-credit-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-strong);
}

.admin-credit-form .button {
  align-self: start;
}

.admin-credit-msg {
  margin: 0;
  font-size: 12px;
  min-height: 1em;
}

.admin-credit-msg.is-error {
  color: var(--danger);
}

.admin-credit-msg.is-success {
  color: var(--success);
}

.admin-detail-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.admin-detail-section .data-table {
  font-size: 12px;
}

.admin-key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.admin-key-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-key-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-key-head code {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.muted.small,
.small {
  font-size: 11px;
}

@media (max-width: 900px) {
  .admin-users-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-credit-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Integrations hub --------------------------------------------------- */
.integrations-head h2 {
  max-width: 18ch;
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

/* The OpenAI-compatible card carries the most content, so it spans full width
   and anchors the hub rather than sitting in an even 2-up row like the rest. */
.integration-card-wide {
  grid-column: 1 / -1;
}

.integration-card {
  display: grid;
  gap: 14px;
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.integration-card .provisioning-body,
.integration-card .mcp-body {
  padding: 0;
}

.integration-card-head {
  display: grid;
  gap: 8px;
}

.integration-card-head h3 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.integration-card-head p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.6;
}

.integration-tag {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.integration-endpoints {
  margin-top: 2px;
}

.integration-snippets {
  margin-top: 2px;
}

.integration-links {
  margin: 2px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
}

.integration-links a {
  color: var(--accent-strong);
  font-weight: 600;
}

.integration-links code,
.credit-lots-note code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-muted);
}

/* --- Test-a-call widget (folded from the old Routing page) -------------- */
.test-call-card {
  margin-top: 18px;
}

.test-call-body {
  display: grid;
  gap: 14px;
  padding: 18px 18px 20px;
}

.test-call-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.test-call-estimate {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* --- Usage & billing merge --------------------------------------------- */
.usage-billing-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.billing-history-card .record-list {
  padding: 14px;
  max-height: 360px;
  overflow-y: auto;
}

/* Usage Activity — filtered usage analytics: a filter bar, filtered headline
   tiles, by-model / by-key spend-share bars, and a daily spend trend. */
.usage-activity {
  margin-top: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.usage-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.usage-filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
  flex: 1 1 150px;
  min-width: 140px;
}

.usage-filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.usage-filter-reset {
  flex: 0 0 auto;
  padding: 8px 14px;
}

.usage-activity-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.usage-activity-tiles > div {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.usage-activity-tiles > div > span {
  font-size: 12px;
  color: var(--muted);
}

.usage-activity-tiles strong {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.usage-activity-tiles small {
  font-size: 11px;
  color: var(--muted);
}

.usage-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.usage-breakdown {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  background: var(--surface);
}

.usage-breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.usage-breakdown-head strong { font-size: 14px; }
.usage-breakdown-head span { font-size: 12px; color: var(--muted); }

.usage-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.usage-bar-row {
  display: grid;
  grid-template-columns: minmax(64px, 34%) 1fr auto;
  align-items: center;
  gap: 10px;
}

.usage-bar-label {
  font-size: 13px;
  color: var(--muted-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-bar-track {
  height: 8px;
  border-radius: 6px;
  background: var(--surface-muted);
  overflow: hidden;
}

.usage-bar-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--accent);
}

.usage-bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}

.usage-bar-value small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.usage-bars-empty {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0;
}

.usage-breakdown-trend { }

.usage-trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 6px;
  overflow-x: auto;
}

.usage-trend-col {
  flex: 1 0 14px;
  min-width: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}

.usage-trend-bar {
  width: 62%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}

.usage-trend-day {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .usage-activity-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-breakdowns { grid-template-columns: 1fr; }
}

/* Collapsed per-request usage detail — the stat strip and credit lots above are
   the primary view; the full per-request table is opt-in. */
.usage-detail {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.usage-detail > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 40px 14px 16px;
  position: relative;
}

.usage-detail > summary::-webkit-details-marker {
  display: none;
}

.usage-detail > summary::after {
  content: "▾";
  position: absolute;
  right: 16px;
  top: 15px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.usage-detail[open] > summary::after {
  transform: rotate(180deg);
}

.usage-detail > summary:hover {
  background: var(--surface-muted);
}

.usage-detail-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.usage-detail-hint {
  color: var(--muted);
  font-size: 13px;
}

.usage-detail-card {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

/* Discreet administrator-access disclosure at the foot of Settings — kept
   low-key so regular users are not shown admin controls they can't use. */
.settings-admin-unlock {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.settings-admin-unlock > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-admin-unlock > summary::-webkit-details-marker {
  display: none;
}

.settings-admin-unlock > summary::before {
  content: "🔒";
  font-size: 12px;
}

.settings-admin-unlock-body {
  margin-top: 12px;
  max-width: 440px;
  display: grid;
  gap: 10px;
}

.settings-admin-unlock-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.credit-lots-note {
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.6;
}

.link-button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: var(--accent);
}

/* --- Settings (restructured) ------------------------------------------- */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: start;
}

.settings-col {
  display: grid;
  gap: 18px;
  align-content: start;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.settings-card-head {
  display: grid;
  gap: 6px;
}

.settings-card-head h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.settings-card-head p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13.5px;
  line-height: 1.6;
}

.settings-meta {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.settings-meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
}

.settings-meta > div + div {
  border-top: 1px solid var(--border);
}

.settings-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.settings-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-strong);
}

.settings-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-card-danger {
  border-color: rgba(194, 53, 53, 0.32);
  background: rgba(194, 53, 53, 0.03);
}

.settings-card-danger .settings-card-head h3 {
  color: var(--danger);
}

.admin-checklist.settings-card {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.settings-legal-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-legal-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.settings-legal-list a::before {
  content: "→";
  color: var(--muted);
}

.settings-legal-list a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 900px) {
  .integrations-grid,
  .usage-billing-split,
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .test-call-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .test-call-actions .button {
    width: 100%;
  }

  .integration-card,
  .settings-card {
    padding: 18px 16px 20px;
  }
}

/* ---- Tool setup guides (public #tool-setup + workspace Integrations) ---- */

.tool-guides {
  display: grid;
  gap: 16px;
}

.tool-guides-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tool-value {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.tool-value > div {
  grid-column: 2;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tool-value strong {
  font-size: 13px;
}

.tool-value code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.tool-value-step {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 13px;
}

/* Label/code and the CTA share the content column and stack on their own rows,
   so the URL never breaks mid-word and long labels stay on one line. */
.tool-value-step {
  grid-column: 1;
  align-self: start;
}

.tool-value-hint {
  grid-column: 2;
  margin: 0;
  max-width: none;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
  line-height: 1.45;
}

.tool-value .button {
  grid-column: 2;
  justify-self: start;
  margin: 0;
}

.tool-guide {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.tool-guide summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.tool-guide summary::-webkit-details-marker {
  display: none;
}

.tool-guide summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.tool-guide[open] summary::after {
  content: "\2212";
}

.tool-guide summary:hover {
  background: var(--surface-muted);
}

.tool-guide-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.tool-guide-sub {
  color: var(--muted);
  font-size: 12.5px;
}

.tool-guide-body {
  display: grid;
  gap: 16px;
  padding: 4px 18px 20px;
  border-top: 1px solid var(--border);
}

.tool-steps {
  margin: 12px 0 0;
  padding: 0 0 0 20px;
  display: grid;
  gap: 8px;
}

.tool-steps li {
  padding-left: 4px;
}

.tool-steps code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-muted);
  border-radius: 4px;
  padding: 1px 5px;
}

/* "Screenshot" mockups: a neutral settings window drawn in CSS so the guide
   shows exactly where each value goes without shipping image assets. */
.tool-shot {
  margin: 0;
  display: grid;
  gap: 8px;
}

.tool-shot-window {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.tool-shot-titlebar {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
}

.tool-shot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
}

.tool-shot-row + .tool-shot-row {
  border-top: 1px solid var(--border);
}

.tool-shot-row.is-muted {
  opacity: 0.62;
}

.tool-shot-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tool-shot-label {
  font-size: 12px;
  font-weight: 600;
}

.tool-shot-field {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-strong);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 4px 8px;
  overflow-wrap: anywhere;
}

.tool-shot-toggle {
  flex: none;
  margin-left: auto;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
}

.tool-shot-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
}

.tool-shot-toggle.is-on {
  background: var(--success);
}

.tool-shot-toggle.is-on::after {
  left: auto;
  right: 2px;
}

.tool-shot-note {
  flex: none;
  font-size: 11.5px;
  color: var(--accent-strong);
  font-weight: 600;
}

.tool-shot-terminal pre {
  margin: 0;
  padding: 14px 16px;
  background: #14151d;
  color: #d7dae4;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

.tool-shot figcaption {
  color: var(--muted);
  font-size: 12px;
}

.tool-gotchas {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--surface-raised);
}

.tool-gotchas p {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warning);
}

.tool-gotchas ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--muted-strong);
}

.tool-gotchas code {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

@media (max-width: 760px) {
  .tool-guides-values {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-value-hint {
    max-width: none;
    text-align: left;
  }

  .tool-shot-row {
    flex-wrap: wrap;
  }

  .tool-shot-note {
    width: 100%;
  }
}

/* ---- Density pass: quieter tables, collapsed quickstart ---- */

/* Keys with no custom limits get one muted chip instead of three defaults. */
.limit-badge-none {
  color: var(--muted);
  border-style: dashed;
  background: transparent;
}

/* Quickstart code is one click away instead of three code columns up front. */
.quickstart-collapsible > summary {
  cursor: pointer;
  list-style: none;
}

.quickstart-collapsible > summary::-webkit-details-marker {
  display: none;
}

.quickstart-collapsible > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.quickstart-collapsible[open] > summary::after {
  content: "\2212";
}

.quickstart-collapsible > summary:hover strong {
  color: var(--accent-strong);
}

/* Cutoff footer only renders when a cutoff is known; keep the row tidy. */
.model-card-cutoff:empty {
  display: none;
}

/* "Use it in Cursor" next step inside the key-reveal banner. */
.key-reveal-next {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}

.key-reveal-next strong {
  font-size: 13px;
}

.key-reveal-step {
  color: var(--muted-strong);
  font-size: 12.5px;
}

.key-reveal-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.key-reveal-pair code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}

.key-reveal-pair button {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 7px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}

.key-reveal-next a {
  font-size: 12.5px;
  color: var(--accent-strong);
}

/* Provider served a different model than requested — loud, not silent. */
.model-mismatch {
  display: block;
  margin-top: 2px;
  color: var(--danger);
  font-weight: 600;
  font-size: 11px;
}

/* Prompt-cache hits inside the usage table's Tokens cell. */
.tokens-cached {
  display: block;
  margin-top: 2px;
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
}

/* ---- Admin: Key Groups cards (users + spend) ---- */
.key-group-cards {
  display: grid;
  gap: 14px;
}

.key-group-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.key-group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.key-group-card-head strong {
  font-family: var(--font-display);
  font-size: 16px;
}

.key-group-card-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.key-group-card-total {
  text-align: right;
}

.key-group-card-total span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.key-group-card-total strong {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent-strong);
}

.key-group-providers {
  color: var(--muted-strong);
  font-size: 12px;
}

.key-group-members {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.key-group-members th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.key-group-members th:not(:first-child),
.key-group-members td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.key-group-members td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--surface-muted);
  overflow-wrap: anywhere;
}

.key-group-empty {
  color: var(--muted);
  text-align: center !important;
}

.admin-advanced {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.admin-advanced > summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted-strong);
  list-style: none;
}

.admin-advanced > summary::-webkit-details-marker { display: none; }
.admin-advanced > summary::after { content: " +"; color: var(--muted); }
.admin-advanced[open] > summary::after { content: " \2212"; }

.admin-advanced-body {
  padding: 0 16px 16px;
  display: grid;
  gap: 12px;
}

.admin-advanced-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Dedicated /guides page ---- */
.guides-article {
  max-width: 960px;
}

.guides-article > h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 4px 0 12px;
}

.guides-lede {
  color: var(--muted-strong);
  font-size: 15px;
  max-width: 60ch;
  margin-bottom: 28px;
}

.guides-article .tool-guides {
  margin-top: 8px;
}

/* ---- Key edit / usage panel ---- */
.key-usage-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.key-usage-panel > div {
  background: #fff;
  padding: 12px 14px;
  display: grid;
  gap: 3px;
}

.key-usage-panel span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.key-usage-panel strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.key-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.key-edit-grid label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
}

.key-edit-grid input {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font: inherit;
}

/* The allowed-models allowlist takes a comma-separated list, so give it the
   full row rather than a cramped third of the grid. */
.key-edit-grid label.key-edit-models { grid-column: 1 / -1; }

/* Per-key reliability (success vs failed upstream calls). */
.key-usage-fail {
  display: block;
  color: #b4540a;
  font-weight: 600;
}
.key-reliability {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted, #f6f7fb);
  font-size: 13px;
  color: var(--muted-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.key-reliability strong { color: var(--ink, #191a26); }
.key-reliability-warn {
  border-color: #f0b37e;
  background: rgba(240, 132, 20, 0.08);
}
.key-reliability-warn strong { color: #b4540a; }
.key-reliability-note { color: var(--muted); font-weight: 400; font-size: 12px; }
@media (prefers-color-scheme: dark) {
  .key-usage-fail { color: #f0a868; }
  .key-reliability-warn strong { color: #f0a868; }
}

.key-edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.key-edit-actions small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .key-usage-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .key-edit-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Top-right user dropdown ---- */
.user-menu {
  position: relative;
  flex: none;
  /* Pin the account chip to the far top-right of the topbar. */
  margin-left: auto;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.user-menu-trigger:hover,
.user-menu.is-open .user-menu-trigger {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.user-menu-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

.user-menu-meta {
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.2;
}

.user-menu-meta strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.user-menu-meta small {
  color: var(--muted);
  font-size: 11px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-caret {
  color: var(--muted);
  font-size: 11px;
}

.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 2px;
  z-index: 40;
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.user-menu-head strong {
  display: block;
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-head small {
  color: var(--muted);
  font-size: 11.5px;
}

.user-menu-popover [role="menuitem"] {
  text-align: left;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.user-menu-popover [role="menuitem"]:hover {
  background: var(--surface-muted);
}

.user-menu-signout {
  color: var(--danger) !important;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  border-radius: 0 0 8px 8px !important;
}

/* On mobile the meta text hides; the avatar remains the tap target. */
@media (max-width: 620px) {
  .user-menu-meta { display: none; }
}

/* ---- Floating AI support chat ---- */
.ai-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.ai-chat-bubble {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(100, 103, 242, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.ai-chat-bubble:hover {
  background: var(--accent-strong);
  transform: translateY(-2px);
}

.ai-chat.is-open .ai-chat-bubble {
  display: none;
}

.ai-chat-panel {
  width: min(360px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(18, 23, 38, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
}

.ai-chat-head strong { font-family: var(--font-display); font-size: 15px; }
.ai-chat-head small { display: block; color: var(--muted-strong); font-size: 11.5px; }

.ai-chat-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.ai-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-chat-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-chat-msg-assistant {
  align-self: flex-start;
  background: var(--surface-muted);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.ai-chat-typing { color: var(--muted); letter-spacing: 2px; }

.ai-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.ai-chat-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font: inherit;
}

.ai-chat-form button {
  flex: none;
  width: 42px;
  padding: 0;
  font-size: 18px;
}

@media (max-width: 520px) {
  .ai-chat { right: 14px; bottom: 14px; }
}

/* ---- Home trending-models strip + /models page ---- */
.public-section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.public-section-head-row .button {
  flex: none;
}

.trending-models {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.trending-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.trending-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.trending-card-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.trending-card-body strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.trending-card-provider {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.trending-card-price {
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
}

/* The catalog needs real width: a 244px filter rail + a 2-column card grid.
   Override the narrow legal-article width so cards use the space. */
.models-article {
  width: min(100%, 1200px);
  max-width: none;
}

.models-article .models-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .models-article .models-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.models-article > h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 4px 0 12px;
}

.models-lede {
  color: var(--muted-strong);
  font-size: 15px;
  max-width: 68ch;
  margin-bottom: 24px;
}

/* ---- "No service fee until 31 Dec 2026" messaging ---- */
.fee-badge {
  display: inline-block;
  background: rgba(20, 122, 74, 0.1);
  color: var(--success);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  border: 1px solid rgba(20, 122, 74, 0.24);
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 8px;
}

.fee-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(20, 122, 74, 0.28);
  border-radius: 14px;
  background: rgba(20, 122, 74, 0.06);
}

.fee-banner-badge {
  flex: none;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(20, 122, 74, 0.12);
  color: var(--success);
  border: 1px solid rgba(20, 122, 74, 0.28);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.fee-banner strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.fee-banner span {
  color: var(--muted-strong);
  font-size: 13px;
}

@media (max-width: 560px) {
  .fee-banner { flex-direction: column; align-items: flex-start; }
}

/* ---- Referral / earn-credit panel ---- */
.referral-share {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--accent-soft);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.referral-share label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-strong);
  margin-bottom: 8px;
}

.referral-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.referral-link-row code {
  flex: 1;
  min-width: 220px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  overflow-wrap: anywhere;
}

.referral-share small {
  display: block;
  margin-top: 10px;
  color: var(--muted-strong);
}

.referral-stats {
  margin-bottom: 18px;
}

.table-empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 18px !important;
}

/* ---- Home "How it works" visual section ---- */
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.how-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.how-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 4px 0 0;
}

.how-card p {
  color: var(--muted-strong);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}

.how-card code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-muted);
  border-radius: 4px;
  padding: 1px 5px;
}

.how-figure {
  height: 190px;
  border-radius: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}

/* Diagram 1: endpoint → models SVG */
.how-svg { width: 100%; height: 100%; }
.how-svg-line path { fill: none; stroke: var(--border-strong); stroke-width: 2; }
.how-svg-box { fill: #fff; stroke: var(--border-strong); stroke-width: 1.5; }
.how-svg-label { font: 700 12px var(--font-body); fill: var(--text); text-anchor: middle; }
.how-svg-sub { font: 500 9px var(--font-body); fill: var(--muted); text-anchor: middle; }
.how-svg-hub { fill: var(--accent); }
.how-svg-hub-label { font: 700 12px var(--font-mono); fill: #fff; text-anchor: middle; }
.how-svg-chip rect { fill: #fff; stroke: rgba(100, 103, 242, 0.4); stroke-width: 1.5; }
.how-svg-chip text { font: 600 10px var(--font-body); fill: var(--accent-strong); text-anchor: middle; }

/* Diagram 2: key card mockup */
.how-keycard {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  font-size: 12px;
}
.how-keycard-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  margin-bottom: 10px;
}
.how-keycard-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
}
.how-keycard-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--muted-strong);
}
.how-keycard-row strong { color: var(--text); font-family: var(--font-mono); }
.how-keycard-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  margin: 10px 0 6px;
  overflow: hidden;
}
.how-keycard-bar span { display: block; height: 100%; background: var(--accent); }
.how-keycard-foot { color: var(--muted); font-size: 11px; }

/* Diagram 3: wallet flow */
.how-wallet { width: 100%; display: grid; gap: 8px; }
.how-wallet-balance {
  background: var(--accent-soft);
  border: 1px solid rgba(100, 103, 242, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
}
.how-wallet-balance span { display: block; color: var(--muted-strong); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.how-wallet-balance strong { font-family: var(--font-mono); font-size: 20px; color: var(--accent-strong); }
.how-wallet-flow { text-align: center; color: var(--muted); font-size: 16px; line-height: 0.5; }
.how-wallet-keys { display: grid; gap: 6px; }
.how-wallet-keys > div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
}
.how-wallet-keys span { font-weight: 600; }
.how-wallet-keys em { color: var(--muted); font-style: normal; font-size: 11px; }
.how-wallet-keys strong { font-family: var(--font-mono); color: var(--accent-strong); }

@media (max-width: 900px) {
  .how-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Legal company line + Contact page ---- */
.legal-company {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  font-size: 13px;
  color: var(--muted-strong);
}

.contact-article { max-width: 960px; }
.contact-article > h1 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 4px 0 12px; }
.contact-lede { color: var(--muted-strong); font-size: 15px; max-width: 60ch; margin-bottom: 28px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.contact-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-card h3 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.contact-card p { color: var(--muted-strong); font-size: 13.5px; line-height: 1.55; margin: 0; }
/* Anchor each card's CTA to the bottom so all three align across the row. */
.contact-card .button { align-self: start; margin-top: auto; }
.contact-email {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent-strong);
  font-weight: 600;
  margin-top: auto;
  overflow-wrap: anywhere;
}

.contact-company {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.contact-company h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 8px; }
.contact-company p { color: var(--muted-strong); font-size: 13.5px; line-height: 1.6; }

@media (max-width: 820px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- AI chat lead-capture form (name + email) ---- */
.ai-lead-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-top: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-raised);
}
.ai-lead-intro {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted-strong);
  font-weight: 600;
}
.ai-lead-form input,
.ai-lead-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.ai-lead-form button {
  margin-top: 2px;
  font-size: 13px;
}

.admin-subhead {
  font-family: var(--font-display);
  font-size: 14px;
  margin: 18px 0 8px;
  color: var(--muted-strong);
}
.admin-subhead:first-of-type { margin-top: 0; }

/* ---- Workspace boot spinner (prevents login-flash for signed-in users) ---- */
.workspace-boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
}
.workspace-boot-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: workspace-boot-spin 0.7s linear infinite;
}
.workspace-boot-label {
  color: var(--muted);
  font-size: 13px;
}
@keyframes workspace-boot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .workspace-boot-spinner { animation-duration: 2s; }
}

/* Summary row when the receipt list is truncated to its most recent entries. */
.receipt-list-more {
  color: var(--muted, #64748b);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

/* Admin referral-rate control (Users panel). */
.admin-referral-rate {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 0.9rem;
}
.admin-referral-rate label { font-weight: 600; }
.admin-referral-rate input {
  width: 4.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
}
.admin-referral-rate small { color: var(--muted, #64748b); }

/* Fee comparison: typical aggregator (blurred mark) vs SuperbAPI. */
.fee-compare {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.fee-compare-head h3 { margin: 4px 0 6px; }
.fee-compare-head p { color: var(--muted); max-width: 60ch; }
.fee-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.fee-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-raised);
}
.fee-card-us {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.fee-card-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 1.6em;
}
.fee-blur-logo {
  filter: blur(5px);
  opacity: 0.65;
  font-weight: 700;
  user-select: none;
}
.fee-card-mark { font-weight: 700; color: var(--accent-strong); }
.fee-card-label { color: var(--muted); font-size: 0.85rem; }
.fee-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.fee-line span { color: var(--muted); font-size: 0.9rem; }
.fee-line strong { font-size: 1.15rem; }
.fee-step {
  color: var(--muted);
  font-size: 0.85rem;
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
}
.fee-step-good { color: var(--success); border-left-color: var(--success); }
.fee-result { border-top: 1px dashed var(--border); padding-top: 10px; }
.fee-card-them .fee-result strong { color: var(--muted-strong); }
.fee-card-us .fee-result strong { color: var(--success); font-size: 1.35rem; }
.fee-compare-foot { margin-top: 14px; color: var(--muted); font-size: 0.9rem; max-width: 72ch; }

/* Launch promo badge: a just-released model, shown only until its newUntil
   date passes (then it silently reverts to an ordinary catalog entry). */
.launch-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(20, 122, 74, 0.34);
  background: rgba(20, 122, 74, 0.1);
  color: var(--success, #147a4a);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Model card footer: Compare stays bottom-LEFT (with the cutoff / open-weights
   line); the availability + launch tags move to bottom-RIGHT. They used to sit
   in the header where they stole width from the model name and forced mid-word
   wraps like "DeepSee k V3.2". The footer was already a space-between flex row,
   so this adds no height and the card size is unchanged. */
.model-card-foot-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* The name may now use the full card width. */
.model-card-head .model-card-id h3 {
  overflow-wrap: anywhere;
}

/* Keep the footer row's height driven by the Compare control, not the pills, so
   moving the tags here does not grow the card by a couple of pixels. */
.model-card-foot .model-card-tags > span {
  padding: 2px 8px;
  line-height: 1.25;
}

/* Compare modal: section headers, capability yes/no, benchmark highlights. */
.compare-table .compare-section th {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-muted);
}
.compare-yes { color: var(--success); font-weight: 600; }
.compare-no { color: var(--muted); }
.compare-bench { font-variant-numeric: tabular-nums; }
.compare-bench-best { color: var(--accent-strong); font-weight: 700; }
.compare-params {
  display: inline-block;
  max-width: 30ch;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted-strong);
  word-break: break-word;
}
.compare-footnote {
  margin: 10px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
  max-width: 90ch;
}

/* Setup-guide prerequisite callout (e.g. Cursor Pro required). */
.tool-guide-prereq {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--danger);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  font-size: 0.92rem;
  line-height: 1.55;
}
.tool-guide-prereq a { font-weight: 600; }
.tool-troubleshoot li { margin-bottom: 6px; }

/* One-click setup row at the top of each tool guide. */
.tool-oneclick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}
.tool-oneclick-hint { color: var(--muted); font-size: 0.85rem; }
.tool-guide kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-muted);
  font-size: 0.85em;
}
