:root {
  color-scheme: dark;
  --wa-light-bg: #f4f7fb;
  --wa-light-bg-soft: #eef3f9;
  --wa-light-surface: #ffffff;
  --wa-light-surface-soft: #f7fafe;
  --wa-light-text: #0f172a;
  --wa-light-muted: #5f6b7a;
  --wa-light-border: #d8e0ea;
  --wa-light-border-strong: #c6d3e2;
  --wa-light-accent: #0b75d7;
}

html.theme-light {
  color-scheme: light;
}

.theme-toggle-fab {
  position: fixed;
  right: max(16px, calc(16px + var(--safe-right, 0px)));
  bottom: max(16px, calc(16px + var(--safe-bottom, 0px)));
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 22, 0.86);
  color: #f5f5f7;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  transition: transform 0.2s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.theme-toggle-fab:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.theme-toggle-fab:focus-visible {
  outline: 2px solid #2997ff;
  outline-offset: 2px;
}

.theme-toggle-fab .theme-toggle-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 640px) {
  .theme-toggle-fab {
    bottom: max(12px, calc(12px + var(--safe-bottom, 0px)));
    right: max(12px, calc(12px + var(--safe-right, 0px)));
    padding: 9px 12px;
    font-size: 12px;
  }
}

html.theme-light,
html.theme-light body {
  background-color: var(--wa-light-bg) !important;
  color: var(--wa-light-text) !important;
}

html.theme-light body {
  background-image: radial-gradient(circle at 15% 10%, rgba(11, 117, 215, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 88% 18%, rgba(56, 189, 248, 0.08) 0%, transparent 36%),
    linear-gradient(180deg, var(--wa-light-bg) 0%, var(--wa-light-bg-soft) 100%) !important;
}

html.theme-light .glass-nav {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

html.theme-light .grid-lines {
  background-image: linear-gradient(to right, rgba(15, 23, 42, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.06) 1px, transparent 1px) !important;
}

html.theme-light [class*="bg-[radial-gradient(circle_at_center,transparent_0%,#000000_70%)]"] {
  background-image: radial-gradient(circle at center, transparent 0%, var(--wa-light-bg) 72%) !important;
}

html.theme-light .text-white {
  color: var(--wa-light-text) !important;
}

html.theme-light .text-apple-muted,
html.theme-light .text-gray-300,
html.theme-light .text-gray-400 {
  color: var(--wa-light-muted) !important;
}

html.theme-light .text-apple-blue {
  color: var(--wa-light-accent) !important;
}

html.theme-light [class*="bg-black"],
html.theme-light [class*="bg-[#0a0a0c]"] {
  background-color: transparent !important;
}

html.theme-light [class*="bg-[#1D1D1F]"],
html.theme-light [class*="bg-[#1C1C1E]"],
html.theme-light [class*="bg-[#151516]"],
html.theme-light [class*="bg-apple-surface"] {
  background-color: var(--wa-light-surface) !important;
}

html.theme-light [class*="bg-apple-surfaceHover"] {
  background-color: var(--wa-light-surface-soft) !important;
}

html.theme-light [class*="bg-white/5"] {
  background-color: rgba(15, 23, 42, 0.04) !important;
}

html.theme-light [class*="bg-white/10"] {
  background-color: rgba(15, 23, 42, 0.06) !important;
}

html.theme-light [class*="bg-white/20"] {
  background-color: rgba(15, 23, 42, 0.08) !important;
}

html.theme-light [class*="border-apple-border"],
html.theme-light [class*="border-white/20"],
html.theme-light [class*="border-white/10"],
html.theme-light [class*="border-white/5"] {
  border-color: var(--wa-light-border) !important;
}

html.theme-light input,
html.theme-light textarea,
html.theme-light select {
  background-color: var(--wa-light-surface) !important;
  color: var(--wa-light-text) !important;
  border-color: var(--wa-light-border-strong) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html.theme-light input::placeholder,
html.theme-light textarea::placeholder {
  color: #7b8798 !important;
}

html.theme-light input:focus,
html.theme-light textarea:focus,
html.theme-light select:focus {
  border-color: var(--wa-light-accent) !important;
  box-shadow: 0 0 0 3px rgba(11, 117, 215, 0.12) !important;
}

html.theme-light a[class*="bg-apple-surface"],
html.theme-light button[class*="bg-apple-surface"] {
  background: linear-gradient(135deg, #0b75d7, #2563eb) !important;
  border-color: #0b75d7 !important;
  color: #f8fbff !important;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25) !important;
}

html.theme-light a[class*="bg-apple-surface"]:hover,
html.theme-light button[class*="bg-apple-surface"]:hover {
  background: linear-gradient(135deg, #0967bf, #1d4ed8) !important;
}

html.theme-light a[class*="bg-transparent"][class*="border-apple-border"],
html.theme-light button[class*="bg-transparent"][class*="border-apple-border"] {
  background-color: rgba(255, 255, 255, 0.9) !important;
  color: var(--wa-light-text) !important;
}

html.theme-light div[class*="rounded-[2rem]"],
html.theme-light div[class*="rounded-3xl"],
html.theme-light div[class*="rounded-2xl"] {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

html.theme-light table,
html.theme-light thead,
html.theme-light tbody {
  background-color: transparent !important;
}

html.theme-light tr:hover {
  background-color: rgba(11, 117, 215, 0.04) !important;
}

html.theme-light .inline-flex[class*="rounded-full"][class*="border"] {
  background-color: rgba(255, 255, 255, 0.8) !important;
}

html.theme-light .timeline-line::before {
  background: linear-gradient(
    180deg,
    rgba(11, 117, 215, 0.32) 0%,
    var(--wa-light-border) 28%,
    var(--wa-light-border) 72%,
    rgba(15, 23, 42, 0.2) 100%
  ) !important;
}

html.theme-light .theme-toggle-fab {
  border-color: rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

html.theme-light .theme-toggle-fab:hover {
  border-color: rgba(15, 23, 42, 0.3);
}

html.theme-light .theme-toggle-fab .theme-toggle-icon {
  background: rgba(11, 117, 215, 0.12);
  color: #0b75d7;
}
