.theme-toggle {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .018);
  color: var(--muted);
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-icon {
  position: absolute;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  transition: opacity 180ms ease, transform 220ms var(--ease);
}

[data-theme="dark"] .theme-icon-sun,
[data-theme="light"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(-18deg) scale(.68);
}

[data-theme="light"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(24deg) scale(.68);
}

.mobile-theme-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--type-ui-sm);
}

.theme-toggle-mobile {
  width: 42px;
  height: 42px;
}

.theme-toggle-dashboard {
  width: 34px;
  height: 34px;
}

.theme-toggle-float {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 220;
  width: 42px;
  height: 42px;
  background: var(--panel-raised);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f4;
  --bg-deep: #efefec;
  --surface: #fbfbf8;
  --surface-2: #f1f1ee;
  --surface-3: #e8e8e4;
  --ink: #111214;
  --text: #45464c;
  --muted: #66676e;
  --dim: #7d7f85;
  --line: #d8d8d4;
  --line-strong: #bdbeba;
  --line-soft: rgba(189, 190, 186, .64);
  --panel: #fbfbf8;
  --panel-raised: #f2f2ef;
  --accent: #3e5b91;
  --accent-strong: #2f4978;
  --accent-dark: #253a61;
  --accent-soft: #e8ecf3;
  --accent-ink: #ffffff;
  --success: #19724a;
  --danger: #b94d40;
}

[data-theme="light"] body {
  background: var(--bg);
}

[data-theme="light"] body::before {
  display: none;
}

[data-theme="light"] .models-hero::after,
[data-theme="light"] .page-hero::after {
  display: none;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, .96);
  box-shadow:
    0 1px 0 rgba(17, 24, 39, .025),
    0 12px 32px rgba(17, 24, 39, .035);
}

[data-theme="light"] .desktop-nav a,
[data-theme="light"] .text-link {
  color: var(--text);
}

[data-theme="light"] .mobile-menu {
  background: var(--bg);
}

[data-theme="light"] .button {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34);
}

[data-theme="light"] .button-dark,
[data-theme="light"] .button-light {
  color: #f8faf7;
}

[data-theme="light"] .button-dark:hover {
  color: var(--accent-ink);
}

[data-theme="light"] .button-outline {
  background: rgba(20, 25, 24, .012);
}

[data-theme="light"] .button-outline:hover {
  background: rgba(20, 25, 24, .045);
}

[data-theme="light"] .models-hero-copy > p,
[data-theme="light"] .models-hero-rail .models-hero-aside,
[data-theme="light"] .hero-copy-row p,
[data-theme="light"] .model-family-list strong,
[data-theme="light"] .benchmark-toolbar > span,
[data-theme="light"] .status-summary > span,
[data-theme="light"] .status-kpi strong,
[data-theme="light"] .uptime-monitor h3,
[data-theme="light"] .service-status,
[data-theme="light"] .model-cell,
[data-theme="light"] .capability-list li,
[data-theme="light"] .price-table-row span,
[data-theme="light"] .callout p,
[data-theme="light"] .auth-form label > span,
[data-theme="light"] .dashboard-topbar-label strong,
[data-theme="light"] .dashboard-table code,
[data-theme="light"] .key-prefix,
[data-theme="light"] .settings-row > span {
  color: var(--text);
}

[data-theme="light"] .model-family-list small,
[data-theme="light"] .plan-number,
[data-theme="light"] .plan-type,
[data-theme="light"] .plan-price span,
[data-theme="light"] .token-control small,
[data-theme="light"] .range-caption,
[data-theme="light"] .uptime-number > span,
[data-theme="light"] .status-summary time,
[data-theme="light"] .status-kpi span,
[data-theme="light"] .status-kpi small,
[data-theme="light"] .uptime-monitor p,
[data-theme="light"] .uptime-ticks,
[data-theme="light"] .service-status b {
  color: var(--muted);
}

[data-theme="light"] .models-hero-rail,
[data-theme="light"] .filter-row,
[data-theme="light"] .performance-tabs {
  background-color: #fff;
  box-shadow: inset 0 1px 0 rgba(20, 25, 24, .025);
}

[data-theme="light"] .model-family-card {
  background:
    linear-gradient(135deg, rgba(17, 24, 39, .012), transparent 42%),
    var(--panel);
}

[data-theme="light"] .model-family-card:nth-child(2),
[data-theme="light"] .model-family-card:nth-child(3) {
  background:
    linear-gradient(135deg, rgba(70, 89, 201, .035), transparent 46%),
    var(--panel);
}

[data-theme="light"] .model-family-card:hover {
  background:
    linear-gradient(135deg, rgba(70, 89, 201, .065), transparent 48%),
    var(--panel-raised);
}

[data-theme="light"] .custom-model-card {
  background: linear-gradient(100deg, rgba(70, 89, 201, .08), rgba(255, 255, 255, .92) 48%, #fff);
}

[data-theme="light"] .custom-model-card:hover {
  background: linear-gradient(100deg, rgba(70, 89, 201, .12), #fff 48%, #fff);
}

[data-theme="light"] .performance-section,
[data-theme="light"] .pricing-section {
  background: #fff;
}

[data-theme="light"] .benchmark-panel,
[data-theme="light"] .code-window,
[data-theme="light"] .cost-calculator,
[data-theme="light"] .status-board {
  box-shadow:
    0 28px 70px rgba(42, 53, 49, .09),
    inset 0 1px 0 rgba(255, 255, 255, .75);
}

[data-theme="light"] .benchmark-toolbar,
[data-theme="light"] .code-toolbar,
[data-theme="light"] .status-summary {
  background: rgba(20, 25, 24, .018);
}

[data-theme="light"] .code-window pre,
[data-theme="light"] .code-sample pre {
  color: var(--text);
}

[data-theme="light"] .code-key {
  color: #6549a0;
}

[data-theme="light"] .code-string {
  color: #4f742d;
}

[data-theme="light"] .code-bool {
  color: #ad4838;
}

[data-theme="light"] .quick-steps li,
[data-theme="light"] .hero-stage-output {
  background: #fff;
}

[data-theme="light"] .quick-steps li:first-child {
  background: linear-gradient(90deg, rgba(70, 89, 201, .045), #fff 72%);
}

[data-theme="light"] .quick-steps .docs-link-item {
  background: linear-gradient(90deg, rgba(70, 89, 201, .13), rgba(70, 89, 201, .055));
}

[data-theme="light"] .cost-calculator,
[data-theme="light"] .model-picker-panel,
[data-theme="light"] .status-board,
[data-theme="light"] .status-kpis {
  background-color: var(--surface);
}

[data-theme="light"] .cost-calculator select {
  color-scheme: light;
}

[data-theme="light"] .cost-calculator select option {
  background: var(--surface);
  color: var(--ink);
}

[data-theme="light"] .model-picker-trigger:hover,
[data-theme="light"] .model-picker-trigger[aria-expanded="true"] {
  color: var(--ink);
}

[data-theme="light"] .plan-card {
  background:
    linear-gradient(155deg, rgba(17, 24, 39, .012), transparent 42%),
    #fff;
}

[data-theme="light"] .plan-card:hover {
  background:
    linear-gradient(155deg, rgba(70, 89, 201, .055), transparent 46%),
    #fff;
}

[data-theme="light"] .plan-card-featured {
  background: linear-gradient(180deg, rgba(70, 89, 201, .13), rgba(255, 255, 255, .94) 50%);
}

[data-theme="light"] .status-summary,
[data-theme="light"] .status-kpis {
  background: #fff;
}

[data-theme="light"] .uptime-timeline {
  background: #dce8e2;
  box-shadow: inset 0 0 0 1px #bad1c5;
}

[data-theme="light"] .final-cta {
  color: var(--accent-ink);
  box-shadow:
    0 28px 76px rgba(30, 64, 175, .18),
    inset 0 1px 0 rgba(255, 255, 255, .22);
}

[data-theme="light"] .final-cta .button-dark {
  background: #fff;
  color: var(--ink);
}

[data-theme="light"] .final-cta .button-outline {
  border-color: rgba(255, 255, 255, .5);
  color: #fff;
}

[data-theme="light"] .final-cta .button-outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, .1);
}

[data-theme="light"] .brand-finale {
  background: #fff;
}

[data-theme="light"] .footer-grid > div {
  background: #fff;
}

[data-theme="light"] .footer-brand {
  background: #fff !important;
}

[data-theme="light"] .detail-body {
  background: #fff;
}

[data-theme="light"] .page-stat-row > div:hover,
[data-theme="light"] .dashboard-model-list li:hover,
[data-theme="light"] .dashboard-table tbody tr:hover {
  background: rgba(70, 89, 201, .055);
}

[data-theme="light"] .model-catalogue-row,
[data-theme="light"] .price-table-row {
  background: #fff;
}

[data-theme="light"] .auth-form input,
[data-theme="light"] .auth-form textarea,
[data-theme="light"] .auth-form select {
  background: #fff;
}

[data-theme="light"] .dashboard-body {
  background: #fff;
}

[data-theme="light"] .dashboard-topbar {
  background: rgba(255, 255, 255, .96);
}

[data-theme="light"] .dashboard-panel {
  box-shadow: 0 18px 54px rgba(42, 53, 49, .07);
}

[data-theme="light"] .dashboard-chart .grid-line {
  stroke: #d5dad6;
}

[data-theme="light"] .table-status-warning {
  color: #94610d;
}

@media (max-width: 960px) {
  .mobile-menu {
    height: calc(100svh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
  }

  .theme-toggle:not(.theme-toggle-mobile, .theme-toggle-float, .theme-toggle-dashboard) {
    display: none;
  }
}

@media (max-width: 620px) {
  .theme-toggle-float {
    top: 18px;
    right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-icon {
    transition: none;
  }
}
