/* Capital Air theme.
   Base layer only. Keep every visual override scoped to body.theme-light. */

body.theme-light {
  --bg-main: #f4f8ff;
  --bg-main-2: #f7faff;
  --bg-soft: #eef5ff;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.62);
  --text-main: #172033;
  --text-secondary: #465066;
  --text-muted: #7a8497;
  --text-soft: #a0a9b8;
  --blue: #2388f2;
  --blue-hover: #1677da;
  --blue-soft: #dceeff;
  --blue-light: #f0f7ff;
  --gold: #c8a46a;
  --gold-soft: #f2e7cf;
  --gold-light: #fff7e4;
  --green: #4f8f6b;
  --green-soft: #e5f4ec;
  --red: #b85c5c;
  --red-soft: #f8e7e7;
  --yellow: #b77a25;
  --yellow-soft: #fff0d6;
  --border: rgba(120, 150, 190, 0.16);
  --border-strong: rgba(120, 150, 190, 0.26);
  --border-gold: rgba(200, 164, 106, 0.28);
  --shadow-soft: 0 24px 80px rgba(28, 68, 120, 0.08);
  --shadow-hover: 0 28px 90px rgba(35, 136, 242, 0.14);
  --shadow-gold: 0 18px 48px rgba(200, 164, 106, 0.22);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --transition-fast: 160ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 360ms ease;
  color-scheme: light;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 8%, rgba(35, 136, 242, 0.11), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(200, 164, 106, 0.1), transparent 30%),
    radial-gradient(circle at 50% 95%, rgba(35, 136, 242, 0.07), transparent 38%),
    linear-gradient(180deg, #f7faff 0%, #f4f8ff 48%, #eef5ff 100%);
  background-attachment: fixed;
  color: var(--text-main);
}

body.theme-light::before,
body.theme-light::after {
  opacity: 0;
}

body.theme-light *,
body.theme-light *::before,
body.theme-light *::after {
  box-sizing: border-box;
}

body.theme-light button,
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  font: inherit;
}

body.theme-light a {
  color: var(--blue);
}

body.theme-light .card,
body.theme-light .glass-panel,
body.theme-light .premium-card,
body.theme-light .capital-card,
body.theme-light .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-main);
}

body.theme-light .interactive-card,
body.theme-light .strategy-card,
body.theme-light .metric-card,
body.theme-light .nav-item {
  transition:
    transform var(--transition-base),
    background var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

body.theme-light .interactive-card:hover,
body.theme-light .strategy-card:hover,
body.theme-light .metric-card:hover,
body.theme-light .nav-item:hover {
  transform: translateY(-3px) scale(1.01);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(35, 136, 242, 0.18);
  box-shadow: var(--shadow-hover);
}

body.theme-light .app-shell,
body.theme-light .capital-air-shell {
  position: relative;
  width: min(100%, 1180px);
  margin-inline: auto;
  color: var(--text-main);
}

body.theme-light .capital-air-shell {
  padding: 18px 18px 110px;
}

body.theme-light .capital-air-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

body.theme-light .capital-air-main,
body.theme-light .capital-air-stack {
  display: grid;
  gap: 18px;
}

body.theme-light .capital-air-section {
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-light .capital-air-section h2,
body.theme-light .capital-air-section h3 {
  margin: 0 0 14px;
  color: var(--text-main);
  letter-spacing: 0;
}

body.theme-light .capital-air-section p {
  color: var(--text-secondary);
}

body.theme-light .capital-air-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.theme-light .capital-air-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

body.theme-light .app-header,
body.theme-light .capital-air-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-light .sidebar {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-light .nav-item {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

body.theme-light .nav-item.is-active {
  background: var(--blue-light);
  border-color: rgba(35, 136, 242, 0.2);
  color: var(--blue);
}

body.theme-light .bottom-nav {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 48px rgba(28, 68, 120, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-light .bottom-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

body.theme-light .bottom-nav button.is-active {
  background: var(--blue);
  color: #ffffff;
}

body.theme-light .hero,
body.theme-light .capital-air-hero {
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 92% 10%, rgba(35, 136, 242, 0.12), transparent 34%),
    radial-gradient(circle at 15% 0%, rgba(200, 164, 106, 0.12), transparent 28%),
    rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
}

body.theme-light .hero h1,
body.theme-light .capital-air-hero h1 {
  max-width: 780px;
  margin: 0;
  color: var(--text-main);
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 650;
  line-height: 0.96;
  letter-spacing: 0;
}

body.theme-light .hero p,
body.theme-light .capital-air-hero p {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
}

body.theme-light .capital-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

body.theme-light .capital-summary-card,
body.theme-light .metric-card {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

body.theme-light .capital-summary-card span,
body.theme-light .metric-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.theme-light .capital-summary-card strong,
body.theme-light .metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text-main);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

body.theme-light .morpheus-mini,
body.theme-light .morpheus-mini-card {
  padding: 22px;
  border: 1px solid rgba(35, 136, 242, 0.16);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 8% 20%, rgba(35, 136, 242, 0.11), transparent 30%),
    rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
}

body.theme-light .morpheus-mini strong,
body.theme-light .morpheus-mini-card strong {
  color: var(--text-main);
}

body.theme-light .morpheus-mini p,
body.theme-light .morpheus-mini-card p {
  color: var(--text-secondary);
}

body.theme-light .btn,
body.theme-light .btn-secondary,
body.theme-light .btn-gold,
body.theme-light .chip,
body.theme-light .chip-button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    background var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    color var(--transition-base);
}

body.theme-light .btn:hover,
body.theme-light .btn-secondary:hover,
body.theme-light .chip-button:hover {
  transform: translateY(-1px);
  border-color: rgba(35, 136, 242, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  box-shadow: 0 16px 38px rgba(28, 68, 120, 0.1);
}

body.theme-light .btn-primary,
body.theme-light .primary-action,
body.theme-light .main-action {
  border-color: transparent;
  background: linear-gradient(180deg, #4da3ff 0%, var(--blue) 100%);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(35, 136, 242, 0.22);
}

body.theme-light .btn-primary:hover,
body.theme-light .primary-action:hover,
body.theme-light .main-action:hover {
  background: linear-gradient(180deg, #3997fb 0%, var(--blue-hover) 100%);
  box-shadow: 0 20px 48px rgba(35, 136, 242, 0.26);
}

body.theme-light .btn-gold {
  border-color: var(--border-gold);
  background: linear-gradient(180deg, #fff8e9 0%, var(--gold-soft) 100%);
  color: #6f5630;
  box-shadow: var(--shadow-gold);
}

body.theme-light .status-chip,
body.theme-light .status-pill,
body.theme-light .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

body.theme-light .status-chip--active,
body.theme-light .status-success,
body.theme-light .is-success {
  border-color: rgba(79, 143, 107, 0.22);
  background: var(--green-soft);
  color: var(--green);
}

body.theme-light .status-chip--gold {
  border-color: var(--border-gold);
  background: var(--gold-light);
  color: #7a5f31;
}

body.theme-light .status-chip span {
  background: currentColor;
  box-shadow: none;
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea,
body.theme-light .ask-field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-main);
  outline: none;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder {
  color: var(--text-soft);
}

body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus,
body.theme-light .ask-field:focus {
  border-color: rgba(35, 136, 242, 0.36);
  box-shadow: 0 0 0 4px rgba(35, 136, 242, 0.1);
}

body.theme-light button:disabled,
body.theme-light .btn-primary:disabled,
body.theme-light .btn-secondary:disabled,
body.theme-light .btn-gold:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

body.theme-light .is-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

body.theme-light .is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(35, 136, 242, 0.35);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: dkAirSpin 800ms linear infinite;
}

body.theme-light .empty-state {
  padding: 34px;
  border: 1px dashed rgba(120, 150, 190, 0.28);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-muted);
  text-align: center;
}

body.theme-light .empty-state-title {
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
}

body.theme-light .empty-state-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

body.theme-light .skeleton {
  position: relative;
  overflow: hidden;
  min-height: 16px;
  border-radius: 12px;
  background: rgba(120, 150, 190, 0.12);
}

body.theme-light .skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: dkAirSkeleton 1.4s ease infinite;
}

body.theme-light .data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

body.theme-light .data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

body.theme-light .data-table th {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

body.theme-light .data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(120, 150, 190, 0.1);
  color: var(--text-secondary);
}

body.theme-light .data-table tr:hover td {
  background: rgba(35, 136, 242, 0.04);
}

body.theme-light .pnl-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

body.theme-light .pnl-positive,
body.theme-light .positive {
  color: var(--green);
  background: var(--green-soft);
}

body.theme-light .pnl-negative,
body.theme-light .negative {
  color: var(--red);
  background: var(--red-soft);
}

body.theme-light .pnl-neutral {
  color: var(--text-muted);
  background: var(--blue-light);
}

body.theme-light .api-status-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

body.theme-light .api-status-card.is-connected {
  border-color: rgba(79, 143, 107, 0.24);
}

body.theme-light .api-status-card.is-error {
  border-color: rgba(184, 92, 92, 0.28);
  background: rgba(248, 231, 231, 0.42);
}

body.theme-light .api-status-title {
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
}

body.theme-light .api-status-text {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

body.theme-light .risk-card {
  padding: 24px;
  border: 1px solid var(--border-gold);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(200, 164, 106, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

body.theme-light .risk-level {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 700;
}

body.theme-light .modal,
body.theme-light .confirm-card {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 28px 90px rgba(28, 68, 120, 0.2);
}

body.theme-light .confirm-backdrop {
  background: rgba(207, 222, 244, 0.62);
}

body.theme-light .theme-toggle-btn,
body.theme-dark .theme-toggle-btn {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 999;
  width: 52px;
  height: 52px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

body.theme-light .theme-toggle-btn {
  border: 1px solid rgba(35, 136, 242, 0.18);
  background: rgba(255, 255, 255, 0.86);
  color: var(--blue);
  box-shadow: 0 18px 42px rgba(28, 68, 120, 0.14);
}

body.theme-dark .theme-toggle-btn {
  border: 1px solid rgba(200, 164, 106, 0.22);
  background: rgba(5, 6, 15, 0.72);
  color: #f3f0e8;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

@supports not ((backdrop-filter: blur(18px)) or (-webkit-backdrop-filter: blur(18px))) {
  body.theme-light .card,
  body.theme-light .glass-panel,
  body.theme-light .premium-card,
  body.theme-light .capital-card,
  body.theme-light .panel,
  body.theme-light .app-header,
  body.theme-light .sidebar,
  body.theme-light .bottom-nav {
    background: rgba(255, 255, 255, 0.94);
  }
}

@media (max-width: 900px) {
  body.theme-light .capital-air-layout {
    grid-template-columns: 1fr;
  }

  body.theme-light .capital-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body.theme-light {
    background-attachment: scroll;
  }

  body.theme-light .app-shell,
  body.theme-light .capital-air-shell {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  body.theme-light .sidebar {
    display: none;
  }

  body.theme-light .theme-toggle-btn,
  body.theme-dark .theme-toggle-btn {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 560px) {
  body.theme-light .capital-air-shell {
    padding-inline: 12px;
  }

  body.theme-light .capital-air-grid {
    grid-template-columns: 1fr;
  }

  body.theme-light .capital-summary {
    grid-template-columns: 1fr;
  }

  body.theme-light .hero,
  body.theme-light .capital-air-hero {
    padding: 24px;
  }
}

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

@keyframes dkAirSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dkAirSkeleton {
  to {
    transform: translateX(100%);
  }
}
