/*
 * credit.css — Unified Credit V1 UI. Layers on top of styles.css (admin light
 * theme). Reuses .admin-* tokens; adds credit-specific components. Scoped under
 * .credit-page so it never leaks into the game/usage pages.
 *
 * Design direction: light "fintech dashboard" — disciplined hierarchy, three
 * clearly separated entitlement lanes (credit / VIP / DeepSeek) each with its
 * own accent, provider-colored catalog groups, dense but readable ledger.
 * Credit is the hero unit; VND is always secondary.
 */
.credit-page {
  --c-bg: #f4f7fb;
  --c-surface: #ffffff;
  --c-line: rgba(24, 49, 79, 0.12);
  --c-line-soft: rgba(24, 49, 79, 0.07);
  --c-text: #17233a;
  --c-head: #17365d;
  --c-muted: #53657d;
  --c-secondary: #61728a;
  --c-subtle: #66778d;
  --c-credit: #2563eb;   /* standard credit lane */
  --c-vip: #d98b15;      /* VIP Auth lane (gold) */
  --c-deepseek: #7c3aed; /* DeepSeek gift lane */
  --c-ok: #0aa36a;
  --c-warn: #d98b15;
  --c-bad: #d73343;
  --c-r: 14px;
  --c-r-sm: 10px;
  /* Keep prominent numeric values in the established display typeface. */
  --c-num: "Anton", "Be Vietnam Pro", "Segoe UI", sans-serif;
  color: var(--c-text);
  font-size: 15px;
  line-height: 1.5;
  background: linear-gradient(180deg, #f7fbff 0%, #eef3fb 100%);
  min-height: 100vh;
}

.credit-main {
  width: min(calc(100% - 40px), 1240px);
  margin: 0 auto;
  padding: 116px 0 80px;
}
@media (max-width: 980px) {
  .credit-main { width: min(calc(100% - 28px), 760px); padding-top: 104px; }
}

/* ---- Header intro / hero balance ---- */
.credit-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}
@media (max-width: 860px) { .credit-hero { grid-template-columns: 1fr; } }

.credit-hero-main,
.credit-card {
  border: 1px solid var(--c-line);
  border-radius: var(--c-r);
  background: var(--c-surface);
  box-shadow: 0 18px 44px rgba(33, 62, 98, 0.08);
}
.credit-hero-main { padding: 22px 24px; position: relative; overflow: hidden; }
.credit-hero-main::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14), transparent 70%);
  pointer-events: none;
}
.credit-hero-label {
  margin: 0 0 4px; color: var(--c-muted); font-size: 0.8rem; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.credit-hero-balance {
  margin: 0; color: var(--c-head); font-family: var(--c-num); font-weight: 400;
  font-size: clamp(2.1rem, 3.6vw, 2.8rem); line-height: 1.1; letter-spacing: 0.2px;
}
.credit-hero-balance .unit { font-size: 0.4em; color: var(--c-muted); margin-left: 8px; font-weight: 700; letter-spacing: 0.03em; }
.credit-hero-vnd { margin: 5px 0 0; color: var(--c-muted); font-weight: 700; font-size: 0.92rem; }
.credit-hero-sub { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 18px; }
.credit-hero-sub > div { min-width: 120px; }
.credit-hero-sub small { display: block; color: var(--c-muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.credit-hero-sub strong { display: block; margin-top: 3px; color: var(--c-head); font-size: 1.02rem; font-weight: 800; }

.credit-hero-actions { display: flex; flex-direction: column; gap: 10px; padding: 20px; justify-content: center; }
.credit-hero-actions .credit-note { margin: 0; color: var(--c-secondary); font-size: 0.82rem; font-weight: 500; line-height: 1.5; }

/* ---- Buttons ---- */
.credit-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 10px 18px; border-radius: var(--c-r-sm); cursor: pointer;
  border: 1px solid var(--c-line); background: #fff; color: #234469;
  font: inherit; font-weight: 800; letter-spacing: 0.02em; text-decoration: none;
  transition: transform .12s, box-shadow .12s, filter .12s, background .12s, border-color .12s;
}
.credit-btn:hover { border-color: #9db4ff; background: #f3f6ff; transform: translateY(-1px); }
.credit-btn:focus-visible { outline: 3px solid #98b6ff; outline-offset: 2px; }
.credit-btn-primary { border: 0; color: #fff; background: linear-gradient(135deg, #5fc8ef, #4f7bf6); box-shadow: 0 6px 16px rgba(59, 110, 232, .32); }
.credit-btn-primary:hover { filter: brightness(1.06); }
.credit-btn-gold { border: 0; color: #3a2c00; background: linear-gradient(135deg, #ffe082 0%, #ffc107 45%, #ff9800 100%); box-shadow: 0 6px 16px rgba(255, 160, 0, .4); }
.credit-btn-ghost { background: transparent; }
.credit-btn-sm { min-height: 32px; padding: 6px 12px; font-size: 0.82rem; }
.credit-btn:disabled { filter: grayscale(.35) brightness(.92); cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Section shell ---- */
.credit-section { margin-bottom: 22px; }
.credit-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.credit-kicker { margin: 0 0 4px; color: #ff952b; font-size: 0.76rem; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.credit-section-head h2 { margin: 0; color: var(--c-head); font-family: var(--c-num); font-weight: 400; font-size: clamp(1.35rem, 2vw, 1.7rem); letter-spacing: 0; }
.credit-section-note { margin: 6px 0 0; color: var(--c-secondary); font-size: 0.92rem; font-weight: 500; line-height: 1.55; max-width: 60ch; }

/* ---- Three entitlement lanes ---- */
.credit-lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .credit-lanes { grid-template-columns: 1fr; } }

.credit-lane {
  --lane: var(--c-credit);
  border: 1px solid var(--c-line); border-top: 4px solid var(--lane);
  border-radius: var(--c-r); background: var(--c-surface); padding: 18px;
  box-shadow: 0 12px 30px rgba(33, 62, 98, 0.07); display: flex; flex-direction: column;
}
.credit-lane.is-vip { --lane: var(--c-vip); }
.credit-lane.is-deepseek { --lane: var(--c-deepseek); }
.credit-lane-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.credit-lane-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--lane) 14%, #fff); color: var(--lane);
  border: 1px solid color-mix(in srgb, var(--lane) 32%, transparent);
}
.credit-lane-title { margin: 0; color: var(--c-head); font-size: 1.06rem; font-weight: 900; }
.credit-lane-title small { display: block; color: var(--c-secondary); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 2px; }

.credit-lane-primary { margin: 6px 0 2px; color: var(--lane); font-family: var(--c-num); font-weight: 400; font-size: 1.7rem; line-height: 1.15; letter-spacing: 0; }
.credit-lane-primary .unit { font-size: 0.5em; color: var(--c-muted); font-family: inherit; margin-left: 6px; font-weight: 700; }
.credit-lane-vnd { margin: 0 0 12px; color: var(--c-muted); font-size: 0.86rem; font-weight: 700; }

.credit-meter { height: 8px; border-radius: 999px; background: rgba(24, 49, 79, .10); overflow: hidden; margin: 4px 0 10px; }
.credit-meter > span { display: block; height: 100%; width: var(--pct, 0%); border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--lane) 75%, #fff), var(--lane)); }

.credit-kv { display: grid; gap: 6px; margin: 4px 0 12px; }
.credit-kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; }
.credit-kv-row span { color: var(--c-secondary); font-weight: 600; }
.credit-kv-row strong { color: var(--c-head); font-weight: 800; text-align: right; }

.credit-lane-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--c-line-soft); color: var(--c-secondary); font-size: 0.84rem; font-weight: 500; line-height: 1.6; }
.credit-lane-foot p { margin: 0 0 6px; }
.credit-lane-foot .credit-alias { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

/* ---- Badges (never color-only: include text + icon) ---- */
.credit-badge {
  --b: var(--c-muted); display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid color-mix(in srgb, var(--b) 34%, transparent);
  background: color-mix(in srgb, var(--b) 12%, #fff); color: var(--b);
  border-radius: 999px; padding: 3px 9px; font-size: 0.74rem; font-weight: 800;
  letter-spacing: 0.03em; white-space: nowrap;
}
.credit-badge.is-ok { --b: var(--c-ok); }
.credit-badge.is-warn { --b: var(--c-warn); }
.credit-badge.is-bad { --b: var(--c-bad); }
.credit-badge.is-muted { --b: #64748b; }
.credit-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.credit-chip { display: inline-flex; align-items: center; border: 1px solid var(--c-line); border-radius: 999px; padding: 2px 8px; font-size: 0.72rem; font-weight: 800; color: #334660; background: #f2f6fc; font-family: monospace; }

/* ---- Model catalog ---- */
.credit-catalog-group { margin-bottom: 16px; }
.credit-catalog-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.credit-catalog-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--pc, #64748b); }
.credit-catalog-group-head h3 { margin: 0; color: var(--c-head); font-size: 1.05rem; font-weight: 900; }
.credit-catalog-group-head .credit-count { color: var(--c-muted); font-size: 0.8rem; font-weight: 700; }

.credit-model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.credit-model {
  border: 1px solid var(--c-line); border-left: 3px solid var(--pc, #64748b); border-radius: var(--c-r-sm);
  background: var(--c-surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.credit-model.is-unavailable { background: #fafbfd; opacity: 0.85; }
.credit-model-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.credit-model-name { margin: 0; color: var(--c-head); font-size: 0.98rem; font-weight: 800; }
.credit-model-id { margin: 2px 0 0; font-family: monospace; font-size: 0.74rem; color: var(--c-subtle); word-break: break-all; }
.credit-model-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.credit-model-price { color: var(--c-head); font-weight: 800; font-size: 0.9rem; }
.credit-model-price small { color: var(--c-secondary); font-weight: 600; }
.credit-model-reason { margin: 0; color: var(--c-bad); font-size: 0.78rem; font-weight: 700; }

/* ---- Usage: filters + summary + table ---- */
.credit-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.credit-field { display: flex; flex-direction: column; gap: 4px; }
.credit-field > span { color: var(--c-muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.credit-field select, .credit-field input {
  min-height: 38px; min-width: 150px; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--c-line); background: #fff; color: #234469; font: inherit; font-weight: 700;
}
.credit-field select:focus-visible, .credit-field input:focus-visible { outline: 3px solid #98b6ff; outline-offset: 1px; }

.credit-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
@media (max-width: 860px) { .credit-summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .credit-summary-grid { grid-template-columns: 1fr; } }
.credit-stat { border: 1px solid var(--c-line); border-radius: var(--c-r-sm); background: var(--c-surface); padding: 14px 16px; box-shadow: 0 10px 26px rgba(33, 62, 98, 0.06); }
.credit-stat span { display: block; color: var(--c-muted); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.credit-stat strong { display: block; margin-top: 6px; color: var(--c-head); font-family: var(--c-num); font-weight: 400; font-size: 1.6rem; letter-spacing: 0; }
.credit-stat small { display: block; margin-top: 2px; color: var(--c-subtle); font-weight: 600; font-size: 0.78rem; text-transform: none; letter-spacing: 0; }

.credit-table-wrap { overflow-x: auto; border: 1px solid var(--c-line-soft); border-radius: var(--c-r-sm); }
.credit-table { width: 100%; border-collapse: collapse; min-width: 920px; background: #fff; font-size: 0.86rem; }
.credit-table th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; text-align: left; background: #f5f8fc; color: #526782; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.credit-table th.num, .credit-table td.num { text-align: right; white-space: nowrap; }
.credit-table td { padding: 9px 12px; border-top: 1px solid var(--c-line-soft); color: #1b3456; font-weight: 600; vertical-align: top; }
.credit-table tr.is-error td { background: #fff7f7; }
.credit-model-cell strong { display: block; color: var(--c-head); font-family: monospace; font-size: 0.82rem; }
.credit-model-cell small { display: block; color: var(--c-subtle); font-size: 0.74rem; margin-top: 2px; }
.credit-charge-strong { color: var(--c-head); font-weight: 800; }
.credit-charge-zero { color: var(--c-muted); font-weight: 700; }

.tok-cell { line-height: 1.35; }
.tok-cell .tok-in { color: #d1495b; font-weight: 700; }
.tok-cell .tok-out { color: #2a9d8f; font-weight: 700; }
.tok-cell .tok-sub { display: block; color: var(--c-subtle); font-size: 0.72rem; margin-top: 2px; }

.credit-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }

/* ---- States ---- */
.credit-state { border: 1px dashed var(--c-line); border-radius: var(--c-r); background: #fbfdff; padding: 28px; text-align: center; color: var(--c-muted); }
/* Keep state titles aligned with the page heading typeface without changing normal body copy. */
.credit-state h3 { margin: 0 0 6px; color: var(--c-head); font-family: var(--c-num); font-weight: 400; font-size: 1.1rem; }
.credit-state p { margin: 0 0 12px; }
.credit-state.is-error { border-color: color-mix(in srgb, var(--c-bad) 40%, transparent); background: #fff4f5; }
.credit-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(37, 99, 235, .2); border-top-color: #2563eb; animation: credit-spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes credit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .credit-spinner { animation: none; } }

/* ---- Legacy / migration (secondary) ---- */
.credit-legacy { border: 1px solid var(--c-line); border-radius: var(--c-r); background: #fbfaf6; }
.credit-legacy summary { cursor: pointer; padding: 14px 18px; font-weight: 800; color: #6b5a2a; list-style: none; display: flex; align-items: center; gap: 10px; }
.credit-legacy summary::-webkit-details-marker { display: none; }
.credit-legacy summary .credit-badge { --b: #9a7b28; }
.credit-legacy[open] summary { border-bottom: 1px solid var(--c-line); }
.credit-legacy-body { padding: 16px 18px; color: var(--c-muted); }
.credit-legacy-body .credit-kv-row strong { color: #6b5a2a; }

/* ---- Login lock ---- */
.credit-lock { max-width: 460px; margin: 0 auto; text-align: center; }
.credit-lock .credit-card { padding: 26px 24px; }
/* Match the login title to the existing Anton heading system while preserving Barlow Condensed elsewhere. */
.credit-lock h2 { margin: 0 0 8px; color: var(--c-head); font-family: var(--c-num); font-weight: 400; }
.credit-lock p { color: var(--c-secondary); font-weight: 500; margin: 0 0 16px; }
.credit-lock form { display: flex; flex-direction: column; gap: 10px; }
.credit-lock input { min-height: 42px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--c-line); font: inherit; font-weight: 700; }
.credit-lock input:focus-visible { outline: 3px solid #98b6ff; outline-offset: 1px; }
.credit-lock .credit-error { color: var(--c-bad); font-weight: 700; font-size: 0.88rem; min-height: 1.2em; }

.credit-mock-flag { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 3px 9px; border-radius: 999px; background: #fff3cd; border: 1px solid #f0d98a; color: #7a5c00; font-size: 0.72rem; font-weight: 800; }

.credit-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; }

/* Admin extras */
.credit-admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .credit-admin-grid { grid-template-columns: 1fr; } }

/* ---- Period tabs retained from the previous usage-page layout ---- */
.credit-periods { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.credit-period {
  min-height: 36px; padding: 7px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--c-line); background: #fff; color: #47617f;
  font: inherit; font-weight: 800; font-size: 0.84rem; letter-spacing: 0.02em;
  transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.credit-period:hover { border-color: #9db4ff; background: #f3f6ff; }
.credit-period:focus-visible { outline: 3px solid #98b6ff; outline-offset: 2px; }
.credit-period.is-active { border-color: transparent; color: #fff; background: linear-gradient(135deg, #5fc8ef, #4f7bf6); box-shadow: 0 4px 12px rgba(59, 110, 232, .32); }

/* ---- Soft tracking restored from the legacy usage page ---- */
.credit-soft-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 12px 0; }
.credit-soft-title { color: var(--c-head); font-weight: 900; font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; margin-top: 4px; }
.credit-soft-card {
  border: 1px solid var(--c-line); border-radius: var(--c-r-sm); background: #fff;
  box-shadow: 0 10px 26px rgba(33, 62, 98, 0.06); padding: 14px; overflow: hidden;
}
.credit-soft-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.credit-soft-head h3 { margin: 0; color: var(--c-head); font-size: 1rem; font-weight: 900; }
.credit-soft-head p { margin: 2px 0 0; color: var(--c-secondary); font-size: 0.78rem; font-weight: 700; }
.credit-soft-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.credit-soft-metric { border: 1px solid var(--c-line-soft); border-radius: 10px; background: #f8fbff; padding: 9px 10px; min-width: 0; }
.credit-soft-metric span { display: block; color: var(--c-muted); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
.credit-soft-metric strong { display: block; margin-top: 3px; color: var(--c-head); font-weight: 900; word-break: break-word; }
.credit-soft-metric small { display: block; margin-top: 1px; color: var(--c-subtle); font-size: 0.7rem; font-weight: 600; }
.credit-soft-budget { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--c-line-soft); }
.credit-soft-budget span { border-radius: 999px; background: #f2f6fc; border: 1px solid var(--c-line); color: #334660; padding: 3px 8px; font-size: 0.74rem; font-weight: 800; }
@media (max-width: 520px) { .credit-soft-metrics { grid-template-columns: 1fr; } }

/* ---- Realtime request panel (pinned near top) ---- */.credit-live { border-top: 3px solid var(--c-credit); }
.credit-live-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
/* Match the realtime panel title to other section headings without touching table or status typography. */
.credit-live-head h2 { margin: 0; color: var(--c-head); font-family: var(--c-num); font-weight: 400; }
.credit-live-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.credit-live-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--c-ok); font-size: 0.78rem; font-weight: 800; }
.credit-live-dot.is-paused { color: var(--c-muted); }
.credit-live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: credit-pulse 2s ease-out infinite; }
.credit-live-dot.is-paused::before { animation: none; }
@keyframes credit-pulse { 0% { box-shadow: 0 0 0 0 rgba(10,163,106,.5); } 70% { box-shadow: 0 0 0 7px rgba(10,163,106,0); } 100% { box-shadow: 0 0 0 0 rgba(10,163,106,0); } }
@media (prefers-reduced-motion: reduce) { .credit-live-dot::before { animation: none; } }
.credit-live-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.credit-table-live { min-width: 760px; }
.credit-table-live tbody tr.is-new { animation: credit-row-in .5s ease; }
@keyframes credit-row-in { from { background: #eaf3ff; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .credit-table-live tbody tr.is-new { animation: none; } }

/* =====================================================================
   REDESIGN PASS 2 — header, provider colors, catalog, softer typography
   ===================================================================== */

/* ---- Custom dark header with HH Tech logo ---- */
.credit-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px clamp(16px, 3vw, 40px); min-height: 68px;
  background: linear-gradient(100deg, #071022 0%, #0d2039 55%, #0a2b52 100%);
  border-bottom: 1px solid rgba(90, 170, 255, 0.22);
  box-shadow: 0 8px 30px rgba(6, 14, 30, 0.35);
}
.credit-brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.credit-brand-logo {
  width: 46px; height: 46px; border-radius: 12px; object-fit: cover;
  border: 1px solid rgba(120, 190, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(20, 60, 110, 0.35), 0 4px 14px rgba(0, 140, 255, 0.28);
}
.credit-brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.credit-brand-copy strong {
  font-family: "Anton", "Be Vietnam Pro", sans-serif; font-weight: 400;
  font-size: 1.35rem; letter-spacing: 0.5px; color: #eaf4ff; text-transform: uppercase;
}
.credit-brand-api {
  color: #38e8ff; -webkit-text-fill-color: #38e8ff;
}
.credit-brand-copy small {
  color: #8fb4dd; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.credit-nav { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.credit-navlink {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 9px 16px; border-radius: 10px; font-weight: 800; font-size: 0.88rem;
  color: #cfe3fb; border: 1px solid rgba(120, 175, 240, 0.3); background: rgba(255,255,255,0.04);
  transition: background .14s, border-color .14s, transform .12s, color .14s;
}
.credit-navlink:hover { background: rgba(120, 190, 255, 0.14); border-color: rgba(120,190,255,.5); transform: translateY(-1px); color: #fff; }
.credit-navlink:focus-visible { outline: 3px solid #4aa8ff; outline-offset: 2px; }
.credit-navlink.is-cta {
  color: #05243f; border: 0; background: linear-gradient(135deg, #6fe0ff, #37b6ff);
  box-shadow: 0 6px 16px rgba(30, 160, 255, 0.4);
}
.credit-navlink.is-cta:hover { filter: brightness(1.07); color: #05243f; }
@media (max-width: 620px) {
  /* Let the multi-row mobile header participate in layout so it cannot cover page content. */
  .credit-header { position: static; flex-wrap: wrap; gap: 10px; min-height: 0; padding: 10px 16px; }
  .credit-main { padding-top: 28px; }
  .credit-brand-copy small { display: none; }
  .credit-navlink { padding: 8px 12px; font-size: 0.8rem; }
}

/* ---- Provider brand badges (like the colored group labels in old usage) ---- */
.credit-provider-badge {
  --pc: #64748b; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 11px 3px 9px; font-size: 0.78rem; font-weight: 800; white-space: nowrap;
  /* Solid declarations keep the badge readable when color-mix() is unavailable. */
  color: #223b5c;
  background: #f3f6fa;
  border: 1px solid var(--c-line);
  color: color-mix(in srgb, var(--pc) 82%, #0b1a2e);
  background: color-mix(in srgb, var(--pc) 15%, #ffffff);
  border-color: color-mix(in srgb, var(--pc) 42%, transparent);
}
.credit-provider-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 25%, transparent); }

/* ---- Softer overview / stat typography + subtle color accents ---- */
.credit-hero-main { background: linear-gradient(135deg, #ffffff 0%, #fff9ec 100%); }
.credit-hero-balance {
  color: #b8791a;
  background: linear-gradient(135deg, #f4b942 0%, #e89a17 55%, #d97e0a 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-size: clamp(1.7rem, 2.8vw, 2.1rem);
}
.credit-hero-balance .unit { -webkit-text-fill-color: initial; color: var(--c-muted); }
.credit-hero-sub strong { font-weight: 700; }        /* Reduce visual weight below the hero balance. */
.credit-hero-label { color: #a9862f; }

.credit-stat {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #ffffff 0%, #f6f9ff 100%);
  border-color: rgba(70, 120, 190, 0.16);
}
.credit-stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--stat-accent, #3b82f6); border-radius: 4px 0 0 4px;
}
.credit-stat span { color: #77879d; font-weight: 700; }   /* Keep labels secondary to numeric values. */
.credit-stat strong { color: #143a68; font-weight: 400; }
.credit-stat small { color: var(--c-subtle); font-weight: 600; }
/* Accent per card position via nth-child for the 7-card overview grid */
[data-overview-summary] .credit-stat:nth-child(1) { --stat-accent: #3b82f6; }
[data-overview-summary] .credit-stat:nth-child(2) { --stat-accent: #0aa36a; }
[data-overview-summary] .credit-stat:nth-child(3) { --stat-accent: #ef4444; }
[data-overview-summary] .credit-stat:nth-child(4) { --stat-accent: #22c55e; }
[data-overview-summary] .credit-stat:nth-child(5) { --stat-accent: #06b6d4; }
[data-overview-summary] .credit-stat:nth-child(6) { --stat-accent: #7c3aed; }
[data-overview-summary] .credit-stat:nth-child(7) { --stat-accent: #d98b15; }

/* ---- Catalog presentation: layered provider panels and premium pricing cards ---- */
.credit-catalog-group {
  position: relative; margin-bottom: 26px; overflow: hidden;
  /* Preserve a complete panel shell before applying color-mix() enhancements. */
  border: 1px solid var(--c-line);
  border-color: color-mix(in srgb, var(--pc, #64748b) 22%, var(--c-line));
  border-radius: 18px;
  background: #ffffff;
  background:
    radial-gradient(circle at 92% -20%, color-mix(in srgb, var(--pc, #64748b) 14%, transparent) 0, transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--pc, #64748b) 6%, #ffffff), #ffffff 48%, color-mix(in srgb, var(--pc, #64748b) 3%, #f8fbff));
  box-shadow: 0 14px 34px rgba(33, 62, 98, 0.08), 0 2px 8px rgba(33, 62, 98, 0.04);
}
/* Add a thin provider-colored edge so each section remains recognizable while scrolling. */
.credit-catalog-group::before {
  content: ""; position: absolute; inset: 0 0 auto; z-index: 2; height: 3px;
  background: linear-gradient(90deg, var(--pc, #64748b), color-mix(in srgb, var(--pc, #64748b) 35%, transparent) 62%, transparent);
}
.credit-catalog-group-head {
  position: relative; display: flex; align-items: center; gap: 12px; margin: 0; padding: 16px 18px 14px;
  /* The neutral header remains usable in browsers that ignore color-mix(). */
  background: #f7f9fc;
  background: linear-gradient(105deg, color-mix(in srgb, var(--pc, #64748b) 17%, #ffffff), color-mix(in srgb, var(--pc, #64748b) 5%, #ffffff) 65%, rgba(255,255,255,.88));
  border-bottom: 1px solid var(--c-line);
  border-bottom-color: color-mix(in srgb, var(--pc, #64748b) 22%, transparent);
}
/* Use a neutral glyph tile instead of vendor artwork so the design remains consistent across providers. */
.credit-provider-mark {
  width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 12px;
  /* Use the provider color as a safe fallback before the enhanced gradient and shadow. */
  color: #fff; background: var(--pc, #64748b);
  background: linear-gradient(145deg, color-mix(in srgb, var(--pc,#64748b) 78%, #fff), var(--pc,#64748b));
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 7px 16px rgba(33,62,98,.18), inset 0 1px 0 rgba(255,255,255,.45);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--pc,#64748b) 26%, transparent), inset 0 1px 0 rgba(255,255,255,.45);
}
.credit-provider-mark span { transform: translateY(-1px); font-family: var(--c-num); font-size: 0.92rem; line-height: 1; letter-spacing: 0.04em; }
.credit-provider-copy { min-width: 0; }
.credit-catalog-group-head h3 { margin: 0; color: #12345c; font-family: var(--c-num); font-weight: 400; font-size: 1.28rem; letter-spacing: 0.3px; }
.credit-provider-copy small { display: block; margin-top: 1px; color: var(--c-secondary); font-size: 0.76rem; font-weight: 600; }
.credit-catalog-group-head .credit-count {
  margin-left: auto; color: #315276;
  color: color-mix(in srgb, var(--pc,#64748b) 78%, #12345c);
  font-size: 0.78rem; font-weight: 800; background: rgba(255,255,255,.9); padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--c-line);
  border-color: color-mix(in srgb, var(--pc,#64748b) 30%, transparent);
  box-shadow: 0 3px 10px rgba(33,62,98,.06);
}
.credit-model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 18px; }
.credit-model {
  position: relative; isolation: isolate; overflow: hidden; min-height: 148px;
  border: 1px solid color-mix(in srgb, var(--pc, #64748b) 18%, var(--c-line)); border-radius: 14px;
  background: linear-gradient(150deg, #ffffff 0%, #ffffff 62%, color-mix(in srgb, var(--pc,#64748b) 5%, #f8fbff) 100%);
  padding: 15px 16px 14px; display: flex; flex-direction: column; gap: 11px;
  box-shadow: 0 5px 14px rgba(33, 62, 98, 0.07), inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
/* Give every model card a restrained color signature without reducing text contrast. */
.credit-model::before {
  content: ""; position: absolute; inset: 0 auto 0 0; z-index: -1; width: 4px;
  background: linear-gradient(180deg, var(--pc,#64748b), color-mix(in srgb, var(--pc,#64748b) 45%, transparent));
}
.credit-model::after {
  content: ""; position: absolute; z-index: -1; width: 92px; height: 92px; right: -42px; top: -48px; border-radius: 50%;
  background: color-mix(in srgb, var(--pc,#64748b) 9%, transparent);
}
.credit-model:hover {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--pc,#64748b) 42%, transparent);
  box-shadow: 0 15px 30px rgba(33, 62, 98, 0.13), 0 4px 12px color-mix(in srgb, var(--pc,#64748b) 10%, transparent);
}
/* Keep unavailable-model text at full opacity so status details retain accessible contrast. */
.credit-model.is-unavailable { background: #fafbfc; opacity: 1; }
.credit-model.is-unavailable:hover { transform: none; box-shadow: 0 5px 14px rgba(33, 62, 98, 0.06); }
.credit-model-name { margin: 0; color: #143a68; font-size: 1.03rem; font-weight: 900; line-height: 1.2; letter-spacing: -0.01em; }
.credit-model-id { margin: 4px 0 0; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.72rem; color: var(--c-subtle); word-break: break-all; }
.credit-model-price {
  color: #12345c; font-weight: 900; font-size: 1.02rem; line-height: 1.25;
  padding: 7px 11px; border-radius: 9px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pc,#64748b) 14%, #ffffff), color-mix(in srgb, var(--pc,#64748b) 7%, #f6f9ff));
  border: 1px solid color-mix(in srgb, var(--pc,#64748b) 24%, transparent); display: inline-block;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.credit-model-price small { color: var(--c-secondary); font-weight: 600; }
.credit-model-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: auto;
  padding-top: 11px; border-top: 1px dashed color-mix(in srgb, var(--pc,#64748b) 20%, var(--c-line));
}
/* Keep the status aligned with the identity block and away from the decorative corner glow. */
.credit-model-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

@media (max-width: 720px) {
  .credit-catalog-group { border-radius: 15px; margin-bottom: 20px; }
  .credit-catalog-group-head { padding: 14px; }
  .credit-provider-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
  .credit-provider-copy small { display: none; }
  .credit-model-grid { grid-template-columns: 1fr; padding: 12px; gap: 11px; }
  .credit-model { min-height: 0; }
}

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


/* ---- Featured model card + highlight chips (Effort / Ultra Code) ---- */
.credit-model.is-featured {
  border-color: color-mix(in srgb, var(--pc,#64748b) 45%, transparent);
  background: linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--pc,#64748b) 7%, #ffffff) 100%);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--pc,#64748b) 18%, transparent);
}
.credit-model-highlights { display: flex; flex-wrap: wrap; gap: 7px; }
.credit-model-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.01em;
  color: #0d3a63;
  background: color-mix(in srgb, var(--pc,#64748b) 14%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--pc,#64748b) 32%, transparent);
}
.credit-model-chip-i { font-size: 0.9rem; line-height: 1; }
