:root[data-bs-theme="light"] .sidebar {
  background: #fff;
  color: #17324d;
  border-right: 1px solid #dfe7ef;
  box-shadow: 4px 0 18px rgba(31, 60, 90, .05);
}
:root[data-bs-theme="light"] .sidebar-brand strong { color: #123b63; }
:root[data-bs-theme="light"] .sidebar-brand small { color: #637c92; opacity: 1; }
:root[data-bs-theme="light"] .sidebar-nav .nav-link { color: #506a82; }
:root[data-bs-theme="light"] .sidebar-nav .nav-link i { color: #52769a; }
:root[data-bs-theme="light"] .sidebar-nav .nav-link:hover {
  background: #f0f5fa;
  color: #184f86;
}
:root[data-bs-theme="light"] .sidebar-nav .nav-link.active {
  background: #e9f3ff;
  color: #125ca8;
  box-shadow: inset 3px 0 #18a4b8;
}
:root[data-bs-theme="light"] .sidebar-nav .nav-link.active i { color: #125ca8; }
:root[data-bs-theme="light"] .nav-section { color: #8295a8; }

:root[data-bs-theme="dark"] {
  --cells-bg: #101923;
  --cells-blue: #70b4ff;
  --cells-cyan: #55c8d4;
  --bs-body-bg: #101923;
  --bs-body-color: #e3ebf4;
  --bs-secondary-color: #aebdcd;
  --bs-border-color: #354557;
  --bs-tertiary-bg: #202e3c;
  --bs-secondary-bg: #1b2937;
  --bs-emphasis-color: #f5f8fc;
  --bs-primary-rgb: 112, 180, 255;
}

:root[data-bs-theme="dark"] .app-page { background: var(--cells-bg); color: var(--bs-body-color); }
:root[data-bs-theme="dark"] .sidebar { background: #0a1420; }
:root[data-bs-theme="dark"] .sidebar-nav .nav-link { color: #bdcddd; }
:root[data-bs-theme="dark"] .sidebar-nav .nav-link:hover,
:root[data-bs-theme="dark"] .sidebar-nav .nav-link.active { background: #263b50; color: #fff; }
:root[data-bs-theme="dark"] .topbar,
:root[data-bs-theme="dark"] .card,
:root[data-bs-theme="dark"] .modal-content,
:root[data-bs-theme="dark"] .metric-card,
:root[data-bs-theme="dark"] .empty-state { background: #1b2937; color: #e3ebf4; border-color: #354557; }
:root[data-bs-theme="dark"] .topbar { border-bottom-color: #354557; }
:root[data-bs-theme="dark"] .bg-white,
:root[data-bs-theme="dark"] .card-header.bg-white,
:root[data-bs-theme="dark"] .card-footer.bg-white { background-color: #1b2937 !important; }
:root[data-bs-theme="dark"] .bg-light { background-color: #202e3c !important; }
:root[data-bs-theme="dark"] .welcome-panel { background: linear-gradient(110deg, #1b2937, #233b47); border-color: #354557; }
:root[data-bs-theme="dark"] .metric-icon { background: #183a58; color: #8fc6ff; }
:root[data-bs-theme="dark"] .metric-card small,
:root[data-bs-theme="dark"] .text-secondary,
:root[data-bs-theme="dark"] .result-grid small { color: #afbed0 !important; }
:root[data-bs-theme="dark"] .user-button { color: #e3ebf4; }
:root[data-bs-theme="dark"] .avatar { background: #255362; color: #e7fcff; }
:root[data-bs-theme="dark"] .table { --bs-table-color: #e3ebf4; --bs-table-bg: transparent; --bs-table-border-color: #354557; --bs-table-striped-color: #e3ebf4; --bs-table-striped-bg: #233344; --bs-table-hover-color: #fff; --bs-table-hover-bg: #294258; }
:root[data-bs-theme="dark"] .table thead th { background: #263747; color: #c2d1e0; }
:root[data-bs-theme="dark"] .form-control,
:root[data-bs-theme="dark"] .form-select,
:root[data-bs-theme="dark"] .input-group-text { background-color: #132130; border-color: #425369; color: #e3ebf4; }
:root[data-bs-theme="dark"] .form-control::placeholder { color: #91a5ba; }
:root[data-bs-theme="dark"] .btn-light { background: #2a3b4c; border-color: #45586b; color: #e3ebf4; }
:root[data-bs-theme="dark"] .btn-light:hover { background: #354c61; color: #fff; }
:root[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #91c9ff; --bs-btn-border-color: #6598c8; --bs-btn-hover-bg: #2166a1; --bs-btn-hover-color: #fff; }
:root[data-bs-theme="dark"] .exam-number { color: #91c9ff; }
:root[data-bs-theme="dark"] .result-grid span,
:root[data-bs-theme="dark"] .status-pill.inactive,
:root[data-bs-theme="dark"] .stat-plan,
:root[data-bs-theme="dark"] .stat-controls,
:root[data-bs-theme="dark"] .exam-gauges,
:root[data-bs-theme="dark"] .eye-panel { background: #182635; }
:root[data-bs-theme="dark"] .eye-panel-header,
:root[data-bs-theme="dark"] .eye-subcard,
:root[data-bs-theme="dark"] .eye-measures > div,
:root[data-bs-theme="dark"] .shared-conclusion-card { background: #1f3040; color: #e3ebf4; border-color: #405166; }
:root[data-bs-theme="dark"] .eye-measures { background: #405166; }
:root[data-bs-theme="dark"] .eye-measures small,
:root[data-bs-theme="dark"] .eye-measures em,
:root[data-bs-theme="dark"] .stat-controls span { color: #b8cadc; }
:root[data-bs-theme="dark"] .stat-controls legend,
:root[data-bs-theme="dark"] .stat-controls label b { color: #add7ff; }
:root[data-bs-theme="dark"] .exam-module #examEditor .card-header,
:root[data-bs-theme="dark"] .exam-module #examEditor .eye-panel-header,
:root[data-bs-theme="dark"] .exam-module #examEditor .eye-subcard > h5,
:root[data-bs-theme="dark"] .exam-module #examEditor .stat-controls legend,
:root[data-bs-theme="dark"] .exam-module #examEditor .eye-samples-title,
:root[data-bs-theme="dark"] .eye-summary-title,
:root[data-bs-theme="dark"] .shared-conclusion-card .form-label { background: #57491b !important; color: #fff0b7 !important; border-color: #766537; }
:root[data-bs-theme="dark"] .exam-module .eye-header-actions .eye-total,
:root[data-bs-theme="dark"] .exam-module #examEditor .eye-header-action { background: #443c25; color: #fff0b7; border-color: #8a7850; }
:root[data-bs-theme="dark"] .exam-module #examRows tr:hover td { background: #294258; }
:root[data-bs-theme="dark"] .eye-summary-card textarea,
:root[data-bs-theme="dark"] .shared-conclusion-card textarea { background: #132130; color: #e3ebf4; }
:root[data-bs-theme="dark"] .clinic-logo-preview,
:root[data-bs-theme="dark"] .user-photo-editor { background: #1f3040; border-color: #405166; }
:root[data-bs-theme="dark"] #chartsDashboard svg text { fill: #d5e2ef; }
:root[data-bs-theme="dark"] #chartsDashboard svg line { stroke: #46586a; }
:root[data-bs-theme="dark"] #chartsDashboard svg circle:first-child[stroke="#edf2f7"] { stroke: #344658; }

/* As réguas mantêm as cores clínicas e os números legíveis nos dois temas. */
:root[data-bs-theme="dark"] .gauge-track { color: #111; }
:root[data-bs-theme="dark"] .gauge-tick span,
:root[data-bs-theme="dark"] .exam-module .gauge-marker span { color: #111; }

@media print {
  :root[data-bs-theme="dark"] { color-scheme: light; }
  :root[data-bs-theme="dark"] .app-page { background: #fff; color: #111; }
}
