/* Shared portfolio appearance system.
   Night remains the established product design; Day is defined here once and
   reused by Disnat, AInvestor portfolios, Financial Analysis and X-Ray. */
:root {
  --portfolio-day-page: #eef4fb;
  --portfolio-day-surface: #ffffff;
  --portfolio-day-surface-soft: #f5f8fc;
  --portfolio-day-surface-blue: #eaf3ff;
  --portfolio-day-text: #101c31;
  --portfolio-day-muted: #5d6e85;
  --portfolio-day-border: #c8d7e9;
  --portfolio-day-blue: #087cf0;
  --portfolio-day-blue-dark: #0b438e;
  --portfolio-day-shadow: 0 12px 30px rgba(16, 45, 82, .09);
}

.ainvestor-theme-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-size: .76rem;
  font-weight: 850;
}

.ainvestor-theme-label { opacity: .82; }

.ainvestor-theme-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(148, 163, 184, .52);
  border-radius: 999px;
  background: rgba(2, 6, 23, .44);
}

.ainvestor-theme-switch button {
  min-width: 66px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  color: #dbeafe;
  background: transparent;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.ainvestor-theme-switch button.is-active {
  color: #08224b;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
}

.ainvestor-theme-switch button:focus-visible {
  outline: 3px solid rgba(250, 204, 21, .9);
  outline-offset: 2px;
}

html[data-ainvestor-theme="day"] .ainvestor-theme-switch {
  border-color: #afc4dc;
  background: #dbe8f7;
}

html[data-ainvestor-theme="day"] .ainvestor-theme-switch button {
  color: #425876;
}

html[data-ainvestor-theme="day"] .ainvestor-theme-switch button.is-active {
  color: #fff;
  background: var(--portfolio-day-blue);
}

/* Portfolio directory */
html[data-ainvestor-theme="day"] .portfolio-manage-page {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-page);
}

html[data-ainvestor-theme="day"] .portfolio-manage-page .snapshot-header,
html[data-ainvestor-theme="day"] .portfolio-manage-page .snap-card {
  border-color: var(--portfolio-day-border);
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface);
  box-shadow: var(--portfolio-day-shadow);
}

html[data-ainvestor-theme="day"] .portfolio-manage-page .manage-title h2,
html[data-ainvestor-theme="day"] .portfolio-manage-page .pf-title {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .portfolio-manage-page .manage-sub,
html[data-ainvestor-theme="day"] .portfolio-manage-page .portfolio-result-count {
  color: var(--portfolio-day-muted);
}

html[data-ainvestor-theme="day"] #portfolio-manage-table.tabulator,
html[data-ainvestor-theme="day"] #portfolio-manage-table .tabulator-tableholder,
html[data-ainvestor-theme="day"] #portfolio-manage-table .tabulator-table {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface);
}

html[data-ainvestor-theme="day"] #portfolio-manage-table .tabulator-row {
  color: var(--portfolio-day-text);
  background: #fff;
}

html[data-ainvestor-theme="day"] #portfolio-manage-table .tabulator-row:nth-child(even) {
  background: var(--portfolio-day-surface-soft);
}

html[data-ainvestor-theme="day"] #portfolio-manage-table .tabulator-row:hover {
  background: var(--portfolio-day-surface-blue);
}

/* AInvestor portfolio */
html[data-ainvestor-theme="day"] .portfolio-main {
  min-height: 100vh;
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-page);
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro {
  border-color: #87b4e9;
  color: var(--portfolio-day-text) !important;
  background: var(--portfolio-day-surface) !important;
  box-shadow: var(--portfolio-day-shadow);
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro * {
  color: var(--portfolio-day-text) !important;
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro .ph-link,
html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro .ph-metric span {
  color: var(--portfolio-day-blue-dark) !important;
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro .ph-select {
  border-color: #9bb7d7 !important;
  color: var(--portfolio-day-text) !important;
  background: #fff !important;
}

.portfolio-main .portfolio-header-pro .ainvestor-theme-switch button.is-active {
  color: #08224b !important;
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro .ainvestor-theme-switch button {
  color: #425876 !important;
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-header-pro .ainvestor-theme-switch button.is-active {
  color: #fff !important;
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-table-tools,
html[data-ainvestor-theme="day"] .portfolio-main .modal-content {
  border-color: var(--portfolio-day-border);
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface);
}

html[data-ainvestor-theme="day"] .portfolio-main .form-label {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table,
html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table .tabulator {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface);
}

html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table .tabulator-row {
  color: var(--portfolio-day-text);
  background: #fff;
}

html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table .tabulator-row:nth-child(even) {
  background: var(--portfolio-day-surface-soft);
}

html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table .tabulator-row:hover {
  background: var(--portfolio-day-surface-blue);
}

html[data-ainvestor-theme="day"] .portfolio-main #portfolio-table .tabulator-cell {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .portfolio-main .portfolio-table-wrap,
html[data-ainvestor-theme="day"] .portfolio-main .portfolio-table-tools {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .portfolio-main .table-dark {
  --bs-table-color: var(--portfolio-day-text);
  --bs-table-bg: #fff;
  --bs-table-border-color: #d6e2f0;
  --bs-table-striped-color: var(--portfolio-day-text);
  --bs-table-striped-bg: #f5f8fc;
  --bs-table-hover-color: var(--portfolio-day-text);
  --bs-table-hover-bg: #eaf3ff;
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .portfolio-main .text-secondary {
  color: var(--portfolio-day-muted) !important;
}

/* Consolidated Disnat data after transfer to AInvestor. */
html[data-ainvestor-theme="night"] .portfolio-main .disnat-consolidated-view {
  color: #e5eefc;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-summary-card,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-section {
  border-color: #293b55;
  color: #e5eefc;
  background: linear-gradient(180deg, #101c2e, #0a1425);
  box-shadow: 0 10px 25px rgba(0, 0, 0, .2);
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-summary-card > span,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-summary-card small,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-heading > span,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-combined-strip {
  color: #9fb0c7;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-summary-card strong,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-combined-strip b,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-heading h3,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table {
  color: #f5f8ff;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-combined-strip,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-heading {
  border-color: #293b55;
  background: #101c2e;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table th,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table td {
  border-color: #263850;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table tbody tr {
  background: #0b172a;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table tbody tr:nth-child(even) {
  background: #0f2038;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table tbody tr:hover {
  background: #173253;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table .source-symbol,
html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table .row-number {
  color: #93a7c1;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table .ticker-cell a {
  color: #67c8ff;
}

html[data-ainvestor-theme="night"] .portfolio-main .disnat-native-table .security-name {
  color: #dbeafe;
}

/* Financial Analysis and Portfolio X-Ray */
html[data-ainvestor-theme="day"] .xray-page {
  --xray-panel: var(--portfolio-day-surface);
  --xray-panel-2: var(--portfolio-day-surface-soft);
  --xray-border: rgba(79, 112, 153, .28);
  --xray-muted: var(--portfolio-day-muted);
  color: var(--portfolio-day-text);
  background: radial-gradient(circle at top right, rgba(8, 124, 240, .11), transparent 34%), var(--portfolio-day-page);
}

html[data-ainvestor-theme="day"] .xray-topbar,
html[data-ainvestor-theme="day"] .xray-section,
html[data-ainvestor-theme="day"] .xray-score-card,
html[data-ainvestor-theme="day"] .xray-overview-card {
  color: var(--portfolio-day-text);
  background: linear-gradient(145deg, #fff, #f7faff);
  box-shadow: var(--portfolio-day-shadow);
}

html[data-ainvestor-theme="day"] .xray-title,
html[data-ainvestor-theme="day"] .xray-overview-heading h2,
html[data-ainvestor-theme="day"] .xray-section > h2,
html[data-ainvestor-theme="day"] .xray-total-value,
html[data-ainvestor-theme="day"] .xray-overview-facts strong,
html[data-ainvestor-theme="day"] .xray-return-grid strong,
html[data-ainvestor-theme="day"] .xray-score-label,
html[data-ainvestor-theme="day"] .xray-bar-head strong,
html[data-ainvestor-theme="day"] .portfolio-beta-kpi > span {
  color: #0b172a;
}

html[data-ainvestor-theme="day"] .xray-subtitle,
html[data-ainvestor-theme="day"] .xray-muted,
html[data-ainvestor-theme="day"] .xray-total-caption,
html[data-ainvestor-theme="day"] .xray-overview-facts span,
html[data-ainvestor-theme="day"] .xray-return-grid span {
  color: #4c6079;
}

html[data-ainvestor-theme="day"] .xray-score-card.tone-cyan { color: #087da8; }
html[data-ainvestor-theme="day"] .xray-score-card.tone-green { color: #087f58; }
html[data-ainvestor-theme="day"] .xray-score-card.tone-amber { color: #9a6500; }
html[data-ainvestor-theme="day"] .xray-score-card.tone-red { color: #c52a49; }

html[data-ainvestor-theme="day"] .xray-btn {
  border-color: rgba(8, 124, 240, .38);
  color: #0b438e;
  background: rgba(8, 124, 240, .08);
}

html[data-ainvestor-theme="day"] .xray-btn:hover,
html[data-ainvestor-theme="day"] .xray-btn:focus-visible {
  color: #062f66;
  background: rgba(8, 124, 240, .16);
}

html[data-ainvestor-theme="day"] .xray-brainier-btn,
html[data-ainvestor-theme="day"] .portfolio-beta-brainier {
  border-color: #9d174d;
  color: #fff;
  background: linear-gradient(135deg, #db2777, #6d28d9);
  box-shadow: 0 9px 22px rgba(157, 23, 77, .24);
}

html[data-ainvestor-theme="day"] .xray-report-tabs {
  background: rgba(255, 255, 255, .96);
}

html[data-ainvestor-theme="day"] .xray-report-tabs a,
html[data-ainvestor-theme="day"] .xray-movers-grid h3,
html[data-ainvestor-theme="day"] .xray-score-note,
html[data-ainvestor-theme="day"] .xray-exposure h3,
html[data-ainvestor-theme="day"] .portfolio-beta-chart-card h3,
html[data-ainvestor-theme="day"] .portfolio-beta-reading-card h3,
html[data-ainvestor-theme="day"] .portfolio-beta-table-card h3 {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .xray-report-tabs a:hover,
html[data-ainvestor-theme="day"] .xray-report-tabs a:focus-visible {
  color: #062f66;
  background: var(--portfolio-day-surface-blue);
}

html[data-ainvestor-theme="day"] .xray-report-tabs a.is-active {
  color: #07111f;
}

html[data-ainvestor-theme="day"] .xray-exposure,
html[data-ainvestor-theme="day"] .portfolio-beta-heading,
html[data-ainvestor-theme="day"] .portfolio-beta-kpi,
html[data-ainvestor-theme="day"] .portfolio-beta-chart-card,
html[data-ainvestor-theme="day"] .portfolio-beta-reading-card,
html[data-ainvestor-theme="day"] .portfolio-beta-table-card {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface-soft);
}

html[data-ainvestor-theme="day"] .portfolio-beta-heading p,
html[data-ainvestor-theme="day"] .portfolio-beta-kpi small,
html[data-ainvestor-theme="day"] .portfolio-beta-reading-card > div span,
html[data-ainvestor-theme="day"] .portfolio-beta-reading-card p,
html[data-ainvestor-theme="day"] .watch-alert-detail {
  color: var(--portfolio-day-muted);
}

html[data-ainvestor-theme="day"] .portfolio-beta-kpi strong {
  color: var(--portfolio-day-text);
}

html[data-ainvestor-theme="day"] .xray-help-text {
  border-color: #087da8;
  color: #fff;
  background: #0b1f38;
  box-shadow: 0 12px 30px rgba(15, 35, 60, .28);
}

html[data-ainvestor-theme="day"] .xray-help-button {
  border-color: #087da8;
  color: #075985;
  background: #e0f2fe;
}

html[data-ainvestor-theme="day"] .xray-help-button:hover,
html[data-ainvestor-theme="day"] .xray-help-button:focus-visible {
  border-color: #075985;
  color: #fff;
  background: #087da8;
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable.tabulator,
html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-tableholder,
html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-table {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface);
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-row {
  color: var(--portfolio-day-text);
  background: #fff;
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-row:nth-child(even) {
  background: var(--portfolio-day-surface-soft);
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-row:hover {
  color: var(--portfolio-day-text);
  background: var(--portfolio-day-surface-blue);
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-row .tabulator-cell.tabulator-frozen {
  color: #8b6500;
  background: #edf4fd;
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-footer {
  color: var(--portfolio-day-text);
  background: #edf4fd;
}

html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-footer .tabulator-page,
html[data-ainvestor-theme="day"] #portfolioFinancialTable .tabulator-footer .tabulator-page-size {
  color: var(--portfolio-day-text);
  background: #fff;
}

@media (max-width: 720px) {
  .ainvestor-theme-toolbar { width: 100%; justify-content: space-between; }
}
