:root {
  color-scheme: light;
  --bg-a: #f5f8ff;
  --bg-b: #eefaf6;
  --bg-c: #fff7e9;
  --text: #1d2433;
  --muted: #667185;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --border: rgba(67, 92, 123, 0.18);
  --primary: #4768e8;
  --primary-strong: #2f52d6;
  --green: #10a879;
  --amber: #d59219;
  --rose: #d95770;
  --code-bg: #111827;
  --code-text: #d1fae5;
  --shadow: 0 24px 70px rgba(55, 73, 104, 0.18);
}

:root.dark {
  color-scheme: dark;
  --bg-a: #111827;
  --bg-b: #10231f;
  --bg-c: #281f12;
  --text: #eef3ff;
  --muted: #a9b4c7;
  --surface: rgba(21, 29, 43, 0.78);
  --surface-strong: rgba(24, 34, 50, 0.94);
  --border: rgba(169, 187, 213, 0.18);
  --primary: #7c9bff;
  --primary-strong: #9db2ff;
  --green: #52d7ad;
  --amber: #f0b849;
  --rose: #ff8397;
  --code-bg: #090f1d;
  --code-text: #c8facc;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 16% 18%, rgba(71, 104, 232, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 16%, rgba(16, 168, 121, 0.15), transparent 24rem),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.tool-shell {
  width: min(1440px, calc(100% - 28px));
}

.topbar,
.promise-panel,
.info-card,
.tutorial-shell,
.step-card,
.endpoint-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 18px;
  padding: 12px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(71, 104, 232, 0.18), rgba(16, 168, 121, 0.2));
}

.brand-mark img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions [hidden] {
  display: none !important;
}

.ghost-link,
.icon-button,
.nav-project-link,
.copy-button,
.copy-snippet,
.primary-action,
.secondary-action,
.tab-button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.ghost-link,
.nav-project-link,
.icon-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.32);
  padding: 0 14px;
}

.nav-link {
  font-weight: 800;
}

.nav-link.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  box-shadow: 0 10px 24px rgba(71, 104, 232, 0.18);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.nav-project-link {
  padding: 0 14px;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-entry,
.nav-project-link {
  white-space: nowrap;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: center;
  min-height: clamp(560px, 76vh, 740px);
  padding: 44px 0 28px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-title p {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 7.4vw, 6.3rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.78;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 800;
}

.primary-action {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  box-shadow: 0 16px 34px rgba(71, 104, 232, 0.24);
}

.secondary-action {
  background: var(--surface-strong);
}

.promise-panel {
  border-radius: 24px;
  padding: 24px;
}

.panel-logo {
  display: block;
  width: min(100%, 430px);
  margin: 0 0 22px;
  border-radius: 18px;
}

.panel-heading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-weight: 800;
}

.pulse {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(16, 168, 121, 0.12);
}

.promise-list {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.live-key-card {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.25);
}

.live-key-card span,
.live-key-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.live-key-card strong {
  color: var(--green);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.promise-list article,
.metric-row article {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.25);
}

.promise-list strong,
.promise-list span {
  display: block;
}

.promise-list span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.62;
}

.endpoint-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: none;
}

.endpoint-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.endpoint-card code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--primary-strong);
  font-size: 0.96rem;
}

.copy-button,
.copy-snippet {
  background: rgba(71, 104, 232, 0.1);
  color: var(--primary-strong);
  padding: 0 14px;
  font-weight: 800;
}

.assurance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0 52px;
}

.service-pulse {
  display: grid;
  gap: 18px;
  padding: 10px 0 26px;
}

.public-announcements {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.public-announcements[hidden] {
  display: none;
}

.announcement-label {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.announcement-label strong {
  color: var(--text);
  font-size: 1rem;
}

.announcement-list {
  display: grid;
  gap: 18px;
}

.announcement-list article + article {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.announcement-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.announcement-item-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.announcement-status {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 900;
}

.announcement-status.current {
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
}

.announcement-status.history {
  color: var(--muted);
}

.announcement-item-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.announcement-item-title > strong,
.announcement-list p {
  display: block;
}

.announcement-list p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.announcement-list p strong {
  display: inline;
  color: var(--text);
  font-weight: 900;
}

.announcement-list p a,
.announcement-item-title a {
  color: var(--primary-strong);
  font-weight: 850;
  overflow-wrap: anywhere;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--primary-strong) 42%, transparent);
}

.announcement-list p a:hover,
.announcement-list p a:focus-visible,
.announcement-item-title a:hover,
.announcement-item-title a:focus-visible {
  color: var(--primary);
  border-bottom-color: currentColor;
  outline: none;
}

.announcement-list .announcement-empty {
  margin: 0;
}

.stats-app.status-app {
  min-height: calc(100vh - 164px);
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.status-overview {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-intro {
  padding: 36px 40px;
}

.status-intro h1 {
  margin: 0;
  font-size: 2.65rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.status-intro > p:not(.tool-kicker) {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.status-sync-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.status-sync-line span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-sync-line strong {
  color: var(--primary-strong);
  font-size: 0.9rem;
}

.status-live-panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(17, 82, 69, 0.34);
  border-radius: 18px;
  background: #164f43;
  color: #ffffff;
  box-shadow: var(--shadow);
  padding: 36px 40px;
}

.status-live-panel::after {
  position: absolute;
  right: 0;
  bottom: 24px;
  width: 34%;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  content: "";
}

.status-live-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  font-weight: 900;
}

.status-live-panel .pulse {
  background: #7df0c6;
  box-shadow: 0 0 0 6px rgba(125, 240, 198, 0.14);
}

.status-live-panel strong {
  display: block;
  margin: 18px 0 10px;
  color: #ffffff;
  font-size: 5rem;
  line-height: 0.86;
  letter-spacing: 0;
}

.status-live-panel small {
  max-width: 290px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.55;
}

.status-content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
  margin-top: 16px;
}

.status-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px 30px;
}

.status-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.status-panel-heading h2 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: 0;
}

.status-panel-heading > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.status-announcement-panel {
  margin-top: 16px;
}

.status-metric-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

.status-metric-pair article {
  min-width: 0;
  padding: 24px 18px 4px 0;
}

.status-metric-pair article + article {
  border-left: 1px solid var(--border);
  padding-right: 0;
  padding-left: 24px;
}

.status-metric-pair span,
.status-metric-pair small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.status-metric-pair strong {
  display: block;
  margin: 10px 0 7px;
  color: var(--text);
  font-size: 2.75rem;
  line-height: 1;
  letter-spacing: 0;
}

.status-model-restrictions {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.status-model-restrictions-heading,
.status-model-restriction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-model-restrictions-heading span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.status-model-restrictions-heading strong {
  color: var(--text);
  font-size: 0.82rem;
}

.status-model-restriction-list {
  display: grid;
  margin-top: 12px;
}

.status-model-restriction-item {
  min-width: 0;
  padding: 12px 0;
}

.status-model-restriction-item + .status-model-restriction-item {
  border-top: 1px solid var(--border);
}

.status-model-restriction-name {
  min-width: 0;
}

.status-model-restriction-name strong,
.status-model-restriction-name span {
  display: block;
}

.status-model-restriction-name strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.9rem;
}

.status-model-restriction-name span,
.status-model-restriction-item time,
.status-model-restriction-empty {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-model-restriction-name span {
  margin-top: 4px;
}

.status-model-restriction-item time {
  flex: 0 0 auto;
  text-align: right;
}

.status-model-restriction-empty {
  margin: 0;
  padding: 12px 0 0;
}

.intro-cta,
.stats-panel,
.credit-panel,
.stats-app,
.credit-tool-card,
.credit-records {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.intro-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 10px 0 28px;
  border-radius: 24px;
  padding: 24px;
}

.intro-cta h2 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

.page-hero {
  padding: 62px 0 22px;
}

.compact-hero {
  max-width: 880px;
}

.compact-hero h1 {
  max-width: 880px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
}

.stats-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
  padding: 10px 0 28px;
}

.stats-panel,
.credit-panel {
  min-width: 0;
  border-radius: 24px;
  padding: 24px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.metric-row article {
  min-height: 124px;
  box-shadow: none;
}

.metric-row strong,
.metric-row span,
.credit-list h3,
.credit-list p {
  display: block;
}

.metric-row span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.62;
}

.credit-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.credit-list section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.25);
  padding: 16px;
}

.credit-list .card-icon {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--green));
}

.credit-list h3 {
  margin: 0;
  font-size: 1.06rem;
}

.credit-list p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.tool-main {
  padding: 18px 0 0;
}

.stats-app {
  min-height: calc(100vh - 164px);
  overflow: hidden;
  border-radius: 24px;
}

.billing-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(71, 104, 232, 0.12), rgba(16, 168, 121, 0.1)),
    var(--surface-strong);
}

.billing-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.billing-hero span {
  display: block;
  max-width: 760px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.68;
}

.print-usage-button {
  margin-top: 12px;
  cursor: pointer;
}

.stats-hero-side {
  display: grid;
  justify-items: end;
  gap: 12px;
  flex: 0 0 min(360px, 38%);
}

.billing-points {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 380px;
}

.billing-points span {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.stats-tabbar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
  padding: 12px;
  backdrop-filter: blur(20px);
}

.stats-tab-button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
  color: inherit;
  cursor: pointer;
  padding: 0 16px;
  font-weight: 900;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.stats-tab-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  box-shadow: 0 10px 24px rgba(71, 104, 232, 0.16);
}

.stats-tool-panel {
  display: none;
}

.stats-tool-panel.active {
  display: block;
}

.key-usage-frame-shell {
  min-height: calc(100vh - 238px);
  background: rgba(255, 255, 255, 0.48);
}

.key-usage-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 238px);
  border: 0;
  background: transparent;
}

.usage-query-shell {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 238px);
  background: rgba(255, 255, 255, 0.42);
  padding: 18px;
}

.usage-query-panel,
.usage-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
}

.usage-query-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
}

.usage-query-head,
.usage-section-head,
.credit-linked-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tool-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.usage-query-head h1,
.usage-section-head h2,
.credit-linked-banner h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  letter-spacing: 0;
}

.usage-query-head span,
.usage-section-head span,
.credit-linked-banner span,
.privacy-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.62;
}

.usage-status-pill {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(71, 104, 232, 0.1);
  color: var(--primary-strong);
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 900;
}

.usage-status-pill.success {
  background: rgba(16, 168, 121, 0.12);
  color: var(--green);
}

.usage-status-pill.error {
  background: rgba(217, 87, 112, 0.12);
  color: var(--rose);
}

.usage-query-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  align-items: center;
  align-self: start;
  gap: 10px;
}

.api-key-field {
  position: relative;
  display: block;
  min-width: 0;
  height: 56px;
}

.api-key-field input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  outline: none;
  padding: 0 56px 0 48px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.api-key-field input:focus {
  border-color: rgba(71, 104, 232, 0.55);
  background: var(--surface-strong);
  box-shadow: 0 0 0 4px rgba(71, 104, 232, 0.12);
}

.field-icon,
.field-icon-button {
  position: absolute;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.field-icon {
  top: 18px;
  left: 16px;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.field-icon-button {
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.field-icon-button:hover,
.field-icon-button:focus-visible {
  background: rgba(71, 104, 232, 0.1);
  color: var(--primary-strong);
  outline: none;
}

.field-icon-button::after {
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: rotate(45deg);
  transition: opacity 0.18s ease;
}

.field-icon-button.is-visible::after {
  opacity: 1;
}

.field-icon svg {
  width: 18px;
  height: 18px;
}

.field-icon-button svg {
  width: 20px;
  height: 20px;
}

.field-icon svg,
.field-icon-button svg {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.usage-query-button {
  width: 156px;
  height: 56px;
  min-height: 56px;
  border-radius: 14px;
  padding: 0 20px;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.usage-query-button[disabled] {
  cursor: progress;
  opacity: 0.68;
}

.usage-range-row,
.usage-metric-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.usage-message {
  border: 1px solid rgba(217, 87, 112, 0.22);
  border-radius: 14px;
  background: rgba(217, 87, 112, 0.08);
  color: var(--rose);
  padding: 12px 14px;
  font-weight: 800;
}

.usage-results {
  display: grid;
  gap: 18px;
}

.usage-results[hidden] {
  display: none;
}

.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.usage-summary-card,
.usage-info-item,
.usage-analysis-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 18px;
}

.usage-summary-card span,
.usage-info-item span,
.usage-analysis-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.usage-summary-card strong,
.usage-info-item strong,
.usage-analysis-item strong {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  line-height: 1.08;
}

.usage-summary-card small,
.usage-info-item small,
.usage-analysis-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.usage-card {
  min-width: 0;
  overflow: hidden;
}

.usage-section-head {
  border-bottom: 1px solid var(--border);
  padding: 18px;
}

.usage-section-head h2 {
  font-size: 1.18rem;
}

.usage-bar-chart {
  min-height: 320px;
  padding: 18px;
}

.usage-chart-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.usage-bar-track {
  display: flex;
  min-width: 100%;
  min-height: 268px;
  align-items: flex-end;
  gap: 7px;
}

.usage-bar-item {
  display: grid;
  flex: 1 0 18px;
  min-width: 18px;
  gap: 8px;
  align-items: end;
}

.usage-bar-stack {
  display: flex;
  height: 220px;
  align-items: flex-end;
}

.usage-single-bar,
.usage-stacked-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--green));
  transition: opacity 0.18s ease;
}

.usage-bar-item:hover .usage-single-bar,
.usage-bar-item:hover .usage-stacked-bar {
  opacity: 0.78;
}

.usage-stacked-bar {
  display: flex;
  overflow: hidden;
  flex-direction: column-reverse;
  background: transparent;
}

.usage-stacked-bar span {
  display: block;
  min-height: 1px;
}

.usage-token-input {
  background: #4768e8;
}

.usage-token-output {
  background: #10a879;
}

.usage-token-cache-write {
  background: #d59219;
}

.usage-token-cache-read {
  background: #d95770;
}

.usage-bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.usage-chart-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.usage-info-grid,
.usage-analysis-grid,
.billing-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.usage-info-item strong {
  font-size: clamp(1rem, 2vw, 1.24rem);
}

.usage-analysis-item strong {
  font-size: clamp(1.18rem, 2.2vw, 1.58rem);
}

.usage-analysis-item.positive strong {
  color: var(--green);
}

.usage-analysis-item.negative strong {
  color: var(--rose);
}

.billing-overview-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 18px;
}

.billing-overview-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.billing-overview-item strong {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(1.24rem, 2.4vw, 1.75rem);
  line-height: 1.1;
}

.billing-overview-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.model-usage-table {
  overflow-x: auto;
  padding: 0;
}

.model-usage-row,
.daily-detail-row {
  display: grid;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.model-usage-row {
  grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(110px, 0.7fr));
  min-width: 720px;
}

.daily-detail-row {
  grid-template-columns: minmax(110px, 0.8fr) repeat(6, minmax(110px, 0.7fr));
  min-width: 900px;
}

.model-usage-row:last-child,
.daily-detail-row:last-child {
  border-bottom: 0;
}

.model-usage-row span,
.daily-detail-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.model-usage-head,
.daily-detail-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.model-usage-row:not(.model-usage-head),
.daily-detail-row:not(.daily-detail-head) {
  font-size: 0.93rem;
}

.model-usage-row:not(.model-usage-head) span:not(:first-child),
.daily-detail-row:not(.daily-detail-head) span:not(:first-child) {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.daily-detail-table {
  overflow-x: auto;
}

.daily-range-summary {
  margin: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 18px;
}

.daily-range-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.daily-range-controls label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.daily-range-controls input {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0 9px;
  font: inherit;
  font-weight: 700;
}

.daily-range-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.daily-range-heading strong {
  color: var(--text);
  font-size: 1rem;
}

.daily-range-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.daily-range-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin-top: 14px;
}

.daily-range-metrics article {
  min-width: 0;
  border-left: 1px solid var(--border);
  padding: 10px 14px;
}

.daily-range-metrics article:first-child { border-left: 0; padding-left: 0; }
.daily-range-metrics span, .daily-range-metrics strong { display: block; }
.daily-range-metrics span { color: var(--muted); font-size: 0.76rem; font-weight: 800; }
.daily-range-metrics strong { margin-top: 7px; color: var(--text); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.credit-linked-banner {
  margin: 18px 18px 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 18px;
}

.credit-linked-banner h2 {
  font-size: 1.2rem;
}

.credit-tool-card [data-credit-personal-balance] {
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
}

.credit-empty-state {
  display: grid;
  min-height: min(360px, calc(100vh - 238px));
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 72px 18px;
  text-align: center;
}

.credit-empty-state[hidden],
.credit-business[hidden] {
  display: none;
}

.credit-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 700;
}

.empty-key-icon {
  color: color-mix(in srgb, var(--muted) 74%, transparent);
  line-height: 0;
}

.empty-key-icon svg {
  width: 76px;
  height: 76px;
  fill: currentColor;
}

.credit-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.credit-tool-card,
.credit-records {
  min-width: 0;
  border-radius: 18px;
  padding: 18px;
  box-shadow: none;
}

.tool-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.tool-card-title span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.tool-card-title strong {
  color: var(--text);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1;
}

.quota-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(71, 104, 232, 0.12);
}

.quota-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--green));
}

.credit-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.credit-meta-row:last-child {
  border-bottom: 0;
}

.credit-meta-row b {
  color: var(--text);
}

.redeem-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.redeem-form input,
.redeem-form select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  padding: 0 14px;
}

.redeem-form button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  cursor: pointer;
  padding: 0 18px;
  font-weight: 900;
}

.redeem-form button[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
}

.credit-plan-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.56;
}

.credit-records {
  margin: 0 18px 18px;
}

.record-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.record-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.record-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr 0.8fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}

.record-row:last-child {
  border-bottom: 0;
}

.record-head {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.empty-row {
  display: block;
  min-height: 84px;
  color: var(--muted);
  padding: 30px 14px;
  text-align: center;
}

.info-card {
  min-height: 214px;
  border-radius: 22px;
  padding: 24px;
}

.card-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
}

.accent-blue .card-icon {
  background: linear-gradient(135deg, var(--primary), #5aa1ff);
}

.accent-green .card-icon {
  background: linear-gradient(135deg, var(--green), #72c78f);
}

.accent-amber .card-icon {
  background: linear-gradient(135deg, var(--amber), #efc45d);
}

.accent-rose .card-icon {
  background: linear-gradient(135deg, var(--rose), #ef8aa0);
}

.info-card h3 {
  margin: 22px 0 10px;
  font-size: 1.26rem;
}

.info-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tutorial-section {
  padding: 24px 0 10px;
}

.section-title {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  letter-spacing: 0;
}

.section-title span {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.72;
}

.tutorial-shell {
  border-radius: 26px;
  padding: 18px;
}

.tab-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.25);
}

.tool-tabs {
  margin-top: 12px;
}

.tab-button {
  flex: 0 1 auto;
  font-weight: 800;
}

.tab-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--green));
  color: #fff;
  box-shadow: 0 10px 24px rgba(71, 104, 232, 0.18);
}

.tutorial-content {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.tutorial-head {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
}

.tutorial-head h3 {
  margin-bottom: 0;
  font-size: 1.38rem;
}

.tutorial-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.68;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.step-card {
  min-width: 0;
  border-radius: 20px;
  padding: 18px;
  box-shadow: none;
}

.step-card.full {
  grid-column: 1 / -1;
}

.step-label {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  background: rgba(71, 104, 232, 0.1);
  color: var(--primary-strong);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.step-card h4 {
  margin: 14px 0 10px;
  font-size: 1.08rem;
}

.step-card p,
.step-card li {
  color: var(--muted);
  line-height: 1.66;
}

.step-card ul,
.step-card ol {
  margin: 0;
  padding-left: 1.25rem;
}

.step-card h5 {
  margin: 16px 0 8px;
  color: var(--text);
  font-size: 0.98rem;
}

.muted-text {
  margin-top: 10px;
  margin-bottom: 0;
  color: var(--muted);
}

.substep-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.substep {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
  padding: 14px;
}

.substep h5 {
  margin-top: 0;
}

.substep p:last-child,
.note-box p:last-child {
  margin-bottom: 0;
}

.code-block {
  position: relative;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
  padding: 18px;
}

.code-block code {
  color: var(--code-text);
  font-family:
    "Cascadia Code",
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 0.88rem;
  line-height: 1.72;
}

.copy-snippet {
  position: absolute;
  right: 12px;
  top: 12px;
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.note-box {
  margin-top: 14px;
  border: 1px solid rgba(16, 168, 121, 0.3);
  border-radius: 16px;
  background: rgba(16, 168, 121, 0.08);
  color: var(--muted);
  padding: 14px;
  line-height: 1.68;
}

.note-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.priority-step {
  border-color: rgba(71, 104, 232, 0.28);
  background: var(--surface-strong);
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.faq-list details {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.26);
  overflow: hidden;
}

.faq-list summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  padding: 14px;
}

.faq-list details > p,
.faq-list .code-block {
  margin: 0 14px 14px;
}

footer {
  display: block;
  padding: 34px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.ghost-link:hover,
.icon-button:hover,
.nav-project-link:hover,
.copy-button:hover,
.copy-snippet:hover,
.primary-action:hover,
.secondary-action:hover,
.tab-button:hover,
.nav-link:hover,
.stats-tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(71, 104, 232, 0.45);
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .ghost-link,
  .nav-project-link {
    flex: 1 1 auto;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 42px;
  }

  .assurance-grid,
  .step-grid,
  .substep-grid,
  .stats-layout,
  .credit-workspace,
  .usage-summary-grid,
  .usage-info-grid,
  .usage-analysis-grid,
  .billing-overview-grid {
    grid-template-columns: 1fr;
  }

  .status-content-grid {
    grid-template-columns: 1fr;
  }

  .status-live-panel {
    min-height: 220px;
  }

  .intro-cta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .ghost-link {
    flex: 1 1 auto;
  }

  .nav-project-link {
    flex: 1 1 auto;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .status-panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .public-announcements {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .usage-query-head,
  .usage-section-head,
  .credit-linked-banner,
  .billing-hero {
    flex-direction: column;
  }

  .stats-hero-side,
  .billing-points {
    width: 100%;
    max-width: none;
    justify-items: stretch;
  }

  .billing-points {
    justify-content: flex-start;
  }

  .usage-query-form {
    grid-template-columns: 1fr;
  }

  .usage-query-button {
    width: 100%;
  }

  .stats-tab-button {
    flex: 1 1 auto;
  }

  .record-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 14px;
  }

  .daily-range-controls { align-items: stretch; flex-direction: column; }
  .daily-range-controls label { justify-content: space-between; }
  .daily-range-controls input { flex: 1; }
  .daily-range-controls > span { display: none; }
  .daily-range-controls button { width: 100%; }
  .daily-range-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .daily-range-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-range-metrics article:nth-child(odd) { border-left: 0; padding-left: 0; }
  .daily-range-metrics article:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .promise-panel,
  .info-card,
  .tutorial-shell,
  .step-card {
    border-radius: 18px;
    padding: 18px;
  }

  .endpoint-card {
    grid-template-columns: 1fr;
  }

  .tab-button {
    flex: 1 1 auto;
  }

  .redeem-form {
    grid-template-columns: 1fr;
  }

  .status-intro,
  .status-live-panel,
  .status-panel {
    padding: 24px;
  }

  .status-intro h1 {
    font-size: 2rem;
  }

  .status-live-panel strong {
    font-size: 4rem;
  }

  .status-metric-pair {
    grid-template-columns: 1fr;
  }

  .status-metric-pair article + article {
    border-top: 1px solid var(--border);
    border-left: 0;
    padding-left: 0;
  }

  .status-model-restriction-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .status-model-restriction-item time {
    text-align: left;
  }

  .announcement-item-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .announcement-item-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media print {
  @page { margin: 14mm; }
  html { background: #fff; }
  body { background: #fff; color: #111; }
  .topbar,
  .stats-tabbar,
  .stats-hero-side,
  .usage-query-form,
  .usage-range-row,
  .privacy-note,
  .credit-empty-state,
  .credit-business,
  footer { display: none !important; }
  .page-shell, .tool-shell { width: 100%; max-width: none; padding: 0; }
  .tool-main { padding: 0; }
  .billing-hero { display: block; padding: 0 0 16px; border-bottom: 1px solid #bbb; }
  .billing-hero h1 { margin-bottom: 4px; }
  .stats-tool-panel { display: block !important; }
  .usage-query-shell, .usage-query-panel, .usage-results { padding: 0; background: #fff; }
  .usage-query-panel { display: block; }
  .usage-query-head { padding: 16px 0; }
  .usage-status-pill { display: none; }
  .usage-card { break-inside: avoid; border-color: #bbb; }
  .usage-bar-chart { min-height: 180px; }
  .usage-chart-scroll, .model-usage-table, .daily-detail-table { overflow: visible; }
  .usage-bar-track { min-width: 0 !important; }
  .daily-range-summary { margin: 18px 0; }
  .daily-range-controls { display: none; }
  .daily-range-summary[hidden] { display: none !important; }
  .daily-detail-row { min-width: 0; font-size: 9pt; padding-left: 0; padding-right: 0; }
  .model-usage-row { min-width: 0; font-size: 9pt; padding-left: 0; padding-right: 0; }
}
