/**
 * Site-wide light/dark bridges for pages outside aa-shell.
 * Uses html[data-theme="light"|"dark"] from js/aa-theme.js (key: lra-aa-theme).
 */

html[data-theme="light"] body.home-redesign,
html[data-theme="light"] body.home-page {
  color-scheme: light;
}

/* Generic dark peer / sector canvases → readable light canvas */
html[data-theme="light"] body:not(.aa-app):not(.aa-home):not(.auth-page) {
  color-scheme: light;
}

html[data-theme="light"] .peer-analysis-page body,
html[data-theme="light"] body.peer-analysis-page,
html.peer-analysis-page[data-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 175, 55, 0.16), transparent),
    linear-gradient(165deg, #faf6f0 0%, #f0e8dc 45%, #e8ddd0 100%) !important;
  color: #1a1010 !important;
}

html[data-theme="light"] .header,
html[data-theme="light"] .top-section,
html[data-theme="light"] .site-header {
  border-color: rgba(140, 100, 20, 0.28) !important;
}

html[data-theme="light"] .btn-secondary,
html[data-theme="light"] .mini-btn,
html[data-theme="light"] .bp-btn-ghost {
  color: #1a1010;
}

html[data-theme="light"] .subtitle,
html[data-theme="light"] .toolbar-label,
html[data-theme="light"] #h2hHint {
  color: rgba(40, 24, 24, 0.65) !important;
}

/* Bank Peer checkbox picker in light mode */
html[data-theme="light"] .h2h-metric-checks {
  background: rgba(255, 252, 248, 0.96);
  border-color: rgba(140, 100, 20, 0.28);
}

html[data-theme="light"] .h2h-metric-check {
  color: #1a1010;
}

html[data-theme="light"] .h2h-metric-picker-label,
html[data-theme="light"] .h2h-bank-slot-label {
  color: rgba(90, 60, 10, 0.75);
}

html[data-theme="light"] .head-to-head-toolbar {
  background: linear-gradient(180deg, #fffdf9, #f7f0e6);
  border-color: rgba(140, 100, 20, 0.32);
  box-shadow: 0 10px 24px rgba(40, 20, 20, 0.08);
}

html[data-theme="light"] .head-to-head-toolbar select {
  background: #fff;
  color: #1a1010;
  border-color: rgba(140, 100, 20, 0.28);
  color-scheme: light;
}

/* financials.php / sectors-style pages */
html[data-theme="light"] body {
  /* only softens pages that relied on dark red gradients without their own tokens */
}

html[data-theme="light"] .aa-theme-toggle {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(140, 100, 20, 0.28);
  color: #1a1010;
}

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

/* ── Peer sheet tables (Holdings / Corporate / Insurance / LFC) ── */
html[data-theme="light"] .sheet-wrap,
html[data-theme="light"] .table-scroll,
html[data-theme="light"] .table-container {
  background: #fffdf9 !important;
  border-color: rgba(140, 100, 20, 0.22) !important;
}

html[data-theme="light"] .sheet,
html[data-theme="light"] .peer-table,
html[data-theme="light"] .ratios-table,
html[data-theme="light"] .head-to-head-table {
  color: #1f1712;
}

html[data-theme="light"] .sheet th,
html[data-theme="light"] .sheet td {
  border-color: rgba(120, 90, 40, 0.14) !important;
}

html[data-theme="light"] .sheet th,
html[data-theme="light"] .sheet thead th.company-head,
html[data-theme="light"] .sheet thead th.period-head,
html[data-theme="light"] .sheet thead th.company-spacer,
html[data-theme="light"] .sheet th.particulars {
  background: #efe4d2 !important;
  color: #4a340c !important;
}

html[data-theme="light"] .sheet th.period-head {
  background: #f7f1e7 !important;
  color: #3a2a14 !important;
}

html[data-theme="light"] .sheet td {
  background: #fffdf9 !important;
  color: #1f1712 !important;
}

html[data-theme="light"] .sheet tbody tr:nth-child(even) td {
  background: #f7f2ea !important;
}

html[data-theme="light"] .sheet td.particulars,
html[data-theme="light"] .sheet th.particulars {
  background: #eef3fa !important;
  color: #1e3a5f !important;
}

html[data-theme="light"] .sheet tbody tr:hover td {
  background: #fff1cc !important;
}

html[data-theme="light"] .sheet td.has-formula:hover {
  background: rgba(212, 175, 55, 0.16) !important;
}

html[data-theme="light"] .sheet th.company-head.search-hit {
  background: #d8f5d8 !important;
  color: #14532d !important;
  box-shadow: inset 0 0 0 2px #22c55e;
}

html[data-theme="light"] .head-to-head-panel {
  background: #fffdf9 !important;
  border-color: rgba(140, 100, 20, 0.28) !important;
}

html[data-theme="light"] .head-to-head-panel-header,
html[data-theme="light"] .head-to-head-table th,
html[data-theme="light"] .head-to-head-table tr.h2h-section-row td,
html[data-theme="light"] .head-to-head-table tr.h2h-group-row td {
  background: #f3ebe0 !important;
  color: #4a340c !important;
}

html[data-theme="light"] .head-to-head-table td {
  color: #1f1712 !important;
  border-bottom-color: rgba(120, 90, 40, 0.14) !important;
}

html[data-theme="light"] .head-to-head-table td.diff-positive,
html[data-theme="light"] .head-to-head-table td.h2h-best {
  color: #15803d !important;
}

html[data-theme="light"] .head-to-head-table td.diff-negative,
html[data-theme="light"] .head-to-head-table td.h2h-worst {
  color: #b91c1c !important;
}

html[data-theme="light"] .analysis-toolbar,
html[data-theme="light"] .toolbar,
html[data-theme="light"] .top-section {
  background: rgba(255, 252, 248, 0.94) !important;
  color: #1a1010 !important;
}

html[data-theme="light"] .analysis-toolbar select,
html[data-theme="light"] .toolbar select,
html[data-theme="light"] .head-to-head-toolbar select {
  background: #fff !important;
  color: #1a1010 !important;
  border-color: rgba(140, 100, 20, 0.28) !important;
  color-scheme: light;
}
