/* Theme toggle + shared dark bridges for pages without full aa-shell */

.aa-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.55rem 0.28rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(11, 31, 42, 0.12));
  background: var(--panel-solid, #f8fbfd);
  color: var(--ink, #0b1f2a);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.aa-theme-toggle:hover {
  border-color: var(--accent, #0b7a6a);
  background: var(--accent-soft, #d4efe9);
  color: var(--accent-ink, #065248);
}

.aa-theme-toggle-track {
  position: relative;
  width: 2.1rem;
  height: 1.2rem;
  border-radius: 999px;
  background: #c5d2db;
  flex-shrink: 0;
  transition: background 0.2s;
}

.aa-theme-toggle-thumb {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(11, 31, 42, 0.25);
  transition: transform 0.2s ease;
}

.aa-theme-toggle.is-dark .aa-theme-toggle-track {
  background: var(--accent, #0b7a6a);
}

.aa-theme-toggle.is-dark .aa-theme-toggle-thumb {
  transform: translateX(0.9rem);
}

.aa-theme-toggle-label {
  min-width: 2.4rem;
  text-align: left;
}

@media (max-width: 640px) {
  .header-actions .aa-theme-toggle-label {
    display: none;
  }
  .header-actions .aa-theme-toggle {
    padding: 0.28rem;
  }
}

.aa-theme-toggle-auth {
  margin-top: 0.85rem;
}

.aa-theme-toggle-float {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1200;
}

html[data-theme="dark"] .aa-theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(232, 240, 244, 0.14);
  color: #e8f0f4;
}

html[data-theme="dark"] .aa-theme-toggle:hover {
  background: rgba(61, 186, 165, 0.16);
  border-color: rgba(61, 186, 165, 0.45);
  color: #9ee4d6;
}

html[data-theme="dark"] .aa-theme-toggle-track {
  background: #3a5160;
}

/* Peer / standalone pages — best-effort dark canvas (skip aa-shell bodies) */
html[data-theme="dark"] body:not(.aa-app):not(.aa-home):not(.auth-page):not(.sector-financials):not(.insurance-financials):not(.lfc-financials):not(.bank-financials):not(.sector-companies-page):not(.insurance-companies-page):not(.lfc-companies-page):not(.bank-companies-page) {
  background: linear-gradient(165deg, #101c26 0%, #0d1820 45%, #081018 100%) !important;
  color: #e8f0f4 !important;
}

html[data-theme="dark"] .top-section {
  background: linear-gradient(165deg, #101c26 0%, #0d1820 45%, #081018 100%) !important;
}
