/* Shared dark palette. Loaded after page styles; light mode is unchanged. */
html[data-portal-theme="dark"] {
  color-scheme: dark;
  --bs-body-bg: #101b28;
  --bs-body-bg-rgb: 16, 27, 40;
  --bs-body-color: #edf5ff;
  --bs-body-color-rgb: 237, 245, 255;
  --bs-emphasis-color: #edf5ff;
  --bs-emphasis-color-rgb: 237, 245, 255;
  --bs-heading-color: #edf5ff;
  --bs-secondary-color: #b3c2d4;
  --bs-secondary-color-rgb: 179, 194, 212;
  --bs-tertiary-color: #9fb0c3;
  --bs-tertiary-color-rgb: 159, 176, 195;
  --bs-secondary-bg: #18283a;
  --bs-secondary-bg-rgb: 24, 40, 58;
  --bs-tertiary-bg: #142235;
  --bs-tertiary-bg-rgb: 20, 34, 53;
  --bs-border-color: #41556d;
  --bs-border-color-translucent: rgba(148, 174, 204, .3);
  --bs-link-color: #8ac5ff;
  --bs-link-color-rgb: 138, 197, 255;
  --bs-link-hover-color: #b5dcff;
  --bs-link-hover-color-rgb: 181, 220, 255;
  --portal-dark-positive: #91e6b4;
  --portal-dark-positive-bg: #123329;
  --portal-dark-warning: #ffe08a;
  --portal-dark-warning-bg: #382c12;
  --portal-dark-negative: #ffb2bf;
  --portal-dark-negative-bg: #3c1d2a;
  --portal-dark-info: #8ac5ff;
  --portal-dark-info-bg: #142e49;
}

/* Labels, inactive tabs, form controls and standard Bootstrap surfaces. */
html[data-portal-theme="dark"] .portal-ui :is(.form-label, .form-check-label, .col-form-label, .input-group-text) {
  color: var(--bs-body-color);
}
html[data-portal-theme="dark"] .portal-ui :is(.text-dark, .text-black, .text-light) {
  color: var(--bs-body-color) !important;
}
html[data-portal-theme="dark"] .portal-ui :is(.bg-white, .bg-light, .text-bg-light) {
  background-color: var(--bs-tertiary-bg) !important;
  color: var(--bs-body-color) !important;
}
html[data-portal-theme="dark"] .portal-ui :is(.form-text, .text-muted) {
  color: var(--bs-secondary-color) !important;
}
html[data-portal-theme="dark"] .portal-ui :is(.text-primary, .text-info) { color: var(--portal-dark-info) !important; }
html[data-portal-theme="dark"] .portal-ui .text-success { color: var(--portal-dark-positive) !important; }
html[data-portal-theme="dark"] .portal-ui .text-warning { color: var(--portal-dark-warning) !important; }
html[data-portal-theme="dark"] .portal-ui .text-danger { color: var(--portal-dark-negative) !important; }
html[data-portal-theme="dark"] .portal-ui .status-pill.success {
  background: var(--portal-dark-positive-bg);
  color: var(--portal-dark-positive);
  border-color: #356d55;
}
html[data-portal-theme="dark"] .portal-ui .status-pill.danger {
  background: var(--portal-dark-negative-bg);
  color: var(--portal-dark-negative);
  border-color: #884354;
}
html[data-portal-theme="dark"] .portal-ui :is(.form-control, .form-select, .input-group-text) {
  border-color: var(--bs-border-color);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}
html[data-portal-theme="dark"] .portal-ui :is(.form-control, .form-select):disabled {
  background-color: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
}
html[data-portal-theme="dark"] .portal-ui .form-control::placeholder {
  color: var(--bs-secondary-color);
  opacity: 1;
}
html[data-portal-theme="dark"] .portal-ui :is(.btn-outline-dark, .btn-outline-secondary, .btn-light) {
  --bs-btn-color: #d7e8fa;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: #71859e;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #253e58;
  --bs-btn-hover-border-color: #8ac5ff;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #253e58;
  --bs-btn-active-border-color: #8ac5ff;
  --bs-btn-disabled-color: #9fb0c3;
  --bs-btn-disabled-border-color: #41556d;
  color: var(--bs-btn-color);
}
html[data-portal-theme="dark"] .portal-ui :is(.btn-outline-dark, .btn-outline-secondary, .btn-light):is(:hover, :focus-visible, .active) {
  color: var(--bs-btn-hover-color);
  background-color: var(--bs-btn-hover-bg);
}
html[data-portal-theme="dark"] .portal-ui :is(.dlp-policy-lifecycle, .application-policy-filter-tabs, .policy-filter-lifecycle) .nav-link:not(.active) {
  color: var(--bs-secondary-color);
}
html[data-portal-theme="dark"] .portal-ui :is(.eyebrow, .module-command-header .eyebrow, .vpn-command-header .eyebrow, .module-console .card-header i, .module-console .info-panel-title i) {
  color: var(--portal-dark-info) !important;
}
html[data-portal-theme="dark"] .portal-ui .table {
  --bs-table-color: var(--bs-body-color);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-striped-color: var(--bs-body-color);
  --bs-table-striped-bg: rgba(138, 197, 255, .045);
  --bs-table-hover-color: var(--bs-body-color);
  --bs-table-hover-bg: rgba(138, 197, 255, .08);
}
html[data-portal-theme="dark"] .portal-ui .table-light {
  --bs-table-color: var(--bs-body-color);
  --bs-table-bg: var(--bs-tertiary-bg);
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-striped-bg: var(--bs-secondary-bg);
  --bs-table-striped-color: var(--bs-body-color);
  --bs-table-hover-bg: var(--bs-secondary-bg);
  --bs-table-hover-color: var(--bs-body-color);
}

/* Policy Center pages with legacy fixed light colors. */
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-metric, .app-control-card, .policy-filter-metric,
  .policy-filter-table tbody tr, .mode-metric, .mode-decision-card.is-advanced,
  .mode-table tbody tr, .suricata-metric, .suricata-intelligence-rule,
  .suricata-table tbody tr, .security-feed-metric, .security-feed-card, .policy-help-tooltip
) {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-toolbar, .app-control-chip, .policy-filter-toolbar,
  .policy-filter-search > summary, .policy-filter-group-row td,
  .policy-filter-table tbody tr.is-control-disabled, .policy-filter-tenant-toggle,
  .mode-toolbar, .mode-table tbody tr.is-control-disabled,
  .mode-path-diagram, .mode-path-diagram.is-local, .mode-path-diagram.is-disabled,
  .suricata-intelligence-rule-editor, .suricata-table tbody tr.is-control-disabled,
  .policy-filter-chip.is-security.is-suspended
) {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}
html[data-portal-theme="dark"] .portal-ui :is(
  .policy-filter-search, .policy-filter-search-body, .policy-filter-section,
  .policy-option-help-list, .policy-advanced-options, .mode-choice, .mode-decision-card,
  .ip-intel-map, .ip-intel-kv, .app-control-state
) { border-color: var(--bs-border-color); }
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-metric strong, .policy-filter-metric strong, .policy-filter-section-title,
  .policy-filter-tenant-name, .policy-filter-group-target, .policy-filter-empty strong,
  .policy-option-help-list dt, .mode-metric strong, .mode-choice strong,
  .mode-decision-card strong, .proxy-agent-name, .suricata-metric strong,
  .suricata-intelligence-rule-title, .security-feed-metric strong,
  .security-feed-card-title, .policy-kpi-label, .policy-filter-panel .form-label,
  .policy-control-switch
) { color: var(--bs-body-color); }
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-metric > span, .app-control-card small, .app-control-state,
  .policy-filter-metric-body > span, .policy-filter-metric small,
  .policy-filter-summary-hint, .policy-filter-results, .policy-filter-table thead th,
  .policy-filter-group-toggle-icon, .policy-filter-group-summary,
  .policy-filter-empty i, .policy-filter-empty span, .policy-filter-control-note,
  .policy-option-help-list dd, .mode-metric span, .mode-metric small,
  .mode-summary-hint, .mode-choice small, .mode-decision-card small,
  .mode-path-label, .mode-readiness-note, .mode-control-note,
  .suricata-metric > span, .suricata-intelligence-rule-meta, .suricata-control-note,
  .security-feed-metric span, .security-feed-secret-state
) { color: var(--bs-secondary-color); }
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-icon, .policy-filter-metric-icon, .policy-filter-chip,
  .policy-filter-chip.is-category, .policy-help-icon, .mode-help-band,
  .mode-choice-icon, .mode-path-diagram.is-upstream, .mode-kind-chip,
  .suricata-help, .suricata-help-icon, .suricata-chip, .policy-kpi-icon,
  .policy-control-switch:hover, .policy-control-switch:focus-visible,
  .policy-control-switch.is-audit:hover, .policy-control-switch.is-audit:focus-visible
) {
  background: var(--portal-dark-info-bg);
  color: var(--portal-dark-info);
  border-color: #38628a;
}
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-sync.is-applied, .policy-filter-metric.is-success .policy-filter-metric-icon,
  .mode-decision-card.is-path, .mode-path-diagram.is-guard, .mode-path-diagram.is-guard-local
) {
  background: var(--portal-dark-positive-bg);
  color: var(--portal-dark-positive);
  border-color: #356d55;
}
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-sync.is-pending, .policy-filter-metric.is-warning .policy-filter-metric-icon,
  .policy-filter-chip.is-port
) {
  background: var(--portal-dark-warning-bg);
  color: var(--portal-dark-warning);
  border-color: #806523;
}
html[data-portal-theme="dark"] .portal-ui :is(
  .app-control-sync.is-failed, .app-control-sync.is-conflict,
  .policy-filter-chip.is-security:not(.is-suspended), .security-feed-category,
  .policy-control-switch.is-danger:hover, .policy-control-switch.is-danger:focus-visible
) {
  background: var(--portal-dark-negative-bg);
  color: var(--portal-dark-negative);
  border-color: #884354;
}
html[data-portal-theme="dark"] .portal-ui .app-control-state.is-success { color: var(--portal-dark-positive); }
html[data-portal-theme="dark"] .portal-ui .app-control-state.is-warning { color: var(--portal-dark-warning); }
html[data-portal-theme="dark"] .portal-ui :is(.app-control-state.is-danger, .security-feed-state-error) { color: var(--portal-dark-negative); }
html[data-portal-theme="dark"] .portal-ui :is(.app-control-state.is-primary, .policy-option-help-list summary, .policy-advanced-options summary, .suricata-response-summary-action) { color: var(--portal-dark-info); }
html[data-portal-theme="dark"] .portal-ui .ip-intel-map-card {
  background-color: var(--bs-tertiary-bg);
  background-image: linear-gradient(135deg, rgba(138, 197, 255, .08), rgba(25, 163, 170, .12));
}

/* Classification keeps the meaning of every level without bright badges. */
html[data-portal-theme="dark"] .portal-ui .di-level { filter: none; }
html[data-portal-theme="dark"] .portal-ui .di-level--green { color: var(--portal-dark-positive); background: var(--portal-dark-positive-bg); border-color: #356d55; }
html[data-portal-theme="dark"] .portal-ui .di-level--blue { color: var(--portal-dark-info); background: var(--portal-dark-info-bg); border-color: #38628a; }
html[data-portal-theme="dark"] .portal-ui .di-level--amber { color: var(--portal-dark-warning); background: var(--portal-dark-warning-bg); border-color: #806523; }
html[data-portal-theme="dark"] .portal-ui .di-level--red { color: var(--portal-dark-negative); background: var(--portal-dark-negative-bg); border-color: #884354; }
html[data-portal-theme="dark"] .portal-ui .di-level--slate { color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); border-color: var(--bs-border-color); }
html[data-portal-theme="dark"] .portal-ui .di-level--purple { color: #d7b8ff; background: #2b2140; border-color: #675088; }
html[data-portal-theme="dark"] .portal-ui .topology-node .node-subtitle { fill: var(--bs-secondary-color); }
html[data-portal-theme="dark"] .portal-ui .dlp-print-watermark { color: var(--bs-secondary-color); border-color: var(--bs-border-color); }

/* Keep QR codes, document previews, logos and switch thumbs unmodified. */
