:root {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --cal-navy: #7fb3ff;
  --cal-blue-hover: #a8ccff;
  --cal-light-bg: #111827;
  --bg-gradient-top: #07111f;
  --bg-gradient-bot: #121826;
  --card-bg: #151f2f;
  --text-primary: #eef4ff;
  --text-secondary: #aebbd0;
  --divider-color: #2a374a;
  --border: #2b3a50;
  --primary: #7fb3ff;
  --primary-hover: #a8ccff;
  --primary-light: #14233a;
  --focus-bg: #102b35;
  --focus-border: #67e8f9;
  --toast-bg: #151f2f;
  --card-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
  --btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  background: #07111f;
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bot) 100%) fixed;
  color: var(--text-primary);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .atis-result-card,
html[data-theme="dark"] .portal-card,
html[data-theme="dark"] .metar-dialog,
html[data-theme="dark"] .controls,
html[data-theme="dark"] .flight-card,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .register-card,
html[data-theme="dark"] .reset-card,
html[data-theme="dark"] .apply-card,
html[data-theme="dark"] .verify-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .container > section,
html[data-theme="dark"] table {
  background-color: var(--card-bg) !important;
  color: var(--text-primary);
  border-color: var(--border, #2b3a50) !important;
  box-shadow: var(--card-shadow);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .input-field,
html[data-theme="dark"] .select-trigger,
html[data-theme="dark"] .custom-options,
html[data-theme="dark"] .suggestions-list {
  background-color: #0f1724 !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7f8da3;
}

html[data-theme="dark"] .normal-btn,
html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .home-btn,
html[data-theme="dark"] .kofi-home-btn,
html[data-theme="dark"] button.secondary,
html[data-theme="dark"] .atfm-btn,
html[data-theme="dark"] .adp-btn {
  background-color: #101a2a !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
  box-shadow: var(--btn-shadow);
}

html[data-theme="dark"] .primary-btn,
html[data-theme="dark"] button:not(.dark-mode-toggle):not(.secondary),
html[data-theme="dark"] .logo:not(img),
html[data-theme="dark"] .date-badge,
html[data-theme="dark"] .listen-btn,
html[data-theme="dark"] .metar-fab {
  background-color: #245ea8;
  color: #ffffff;
}

html[data-theme="dark"] img.logo {
  background: transparent !important;
}

html[data-theme="dark"] a,
html[data-theme="dark"] .card-header h1,
html[data-theme="dark"] .rctp-header,
html[data-theme="dark"] .status-highlight,
html[data-theme="dark"] .sug-icao,
html[data-theme="dark"] .security-wait-info {
  color: var(--cal-navy) !important;
}

html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .control-title,
html[data-theme="dark"] .version-text,
html[data-theme="dark"] .sug-name,
html[data-theme="dark"] .sug-country,
html[data-theme="dark"] .status-msg,
html[data-theme="dark"] .kofi-support-note {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .divider,
html[data-theme="dark"] .portal-header,
html[data-theme="dark"] .suggestion-item,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-color: #2b3a50 !important;
}

html[data-theme="dark"] .suggestion-item:hover,
html[data-theme="dark"] .suggestion-item.selected,
html[data-theme="dark"] .custom-option:hover {
  background-color: #17263b !important;
}

html[data-theme="dark"] .update-status-bar,
html[data-theme="dark"] .fav-strip,
html[data-theme="dark"] .atis-meta-footer,
html[data-theme="dark"] .metar-summary,
html[data-theme="dark"] .migration-banner {
  background-color: #101a2a !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .footer-warning {
  background: transparent !important;
  color: #93a4bd !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .footer-warning p {
  color: #ff8a8a !important;
}

html[data-theme="dark"] .atis-result-card {
  background: #0f1724 !important;
  border-color: #314158 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
}

html[data-theme="dark"] .atis-text-content,
html[data-theme="dark"] .metar-item-text {
  color: #dce7f7 !important;
}

html[data-theme="dark"] .acars-header,
html[data-theme="dark"] .atis-meta-footer {
  color: #93a4bd !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .meta-value {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .fav-chip {
  background: #0f1724 !important;
  border-color: #334155 !important;
  color: #dceaff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .fav-chip:hover {
  background: #17263b !important;
  border-color: #7fb3ff !important;
}

html[data-theme="dark"] .fav-chip-remove {
  color: #9fb0c7;
}

html[data-theme="dark"] .fav-toggle-btn {
  background: #0f1724 !important;
  border-color: #334155 !important;
  color: #9fb0c7 !important;
}

html[data-theme="dark"] .fav-toggle-btn:hover,
html[data-theme="dark"] .fav-toggle-btn.starred {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .highlight-runway {
  color: #ff9b6a !important;
  background: rgba(255, 155, 106, 0.14) !important;
}

html[data-theme="dark"] .highlight-wind,
html[data-theme="dark"] .highlight-temp {
  color: #35d3ac !important;
}

html[data-theme="dark"] .highlight-visibility {
  color: #6da6ff !important;
}

html[data-theme="dark"] .highlight-cloud {
  color: #c084fc !important;
}

html[data-theme="dark"] .highlight-qnh {
  color: #ff8a8a !important;
  background: rgba(255, 138, 138, 0.14) !important;
}

html[data-theme="dark"] .search-area,
html[data-theme="dark"] #result,
html[data-theme="dark"] .favorites-section {
  color: var(--text-primary);
}

html[data-theme="dark"] .fav-strip {
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .fav-empty {
  color: #7f8da3 !important;
}

html[data-theme="dark"] .fav-chip-star {
  color: #fbbf24 !important;
}

html[data-theme="dark"] .fav-chip-removing {
  opacity: 0.5;
}

html[data-theme="dark"] .card > .top-bar {
  background: transparent !important;
}

html[data-theme="dark"] .input-field:focus {
  border-color: #7fb3ff !important;
  box-shadow: 0 0 0 2px rgba(127, 179, 255, 0.2) !important;
}

html[data-theme="dark"] .input-field.error {
  border-color: #ff8a8a !important;
  box-shadow: 0 0 0 2px rgba(255, 138, 138, 0.18) !important;
}

html[data-theme="dark"] .suggestions-list {
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.36) !important;
}

html[data-theme="dark"] .suggestion-item {
  color: var(--text-primary);
  border-bottom-color: #26364c !important;
}

html[data-theme="dark"] .loader-container {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .loader-plane {
  fill: #7fb3ff !important;
}

html[data-theme="dark"] .loader-text {
  color: #dce7f7 !important;
}

html[data-theme="dark"] .loader-subtext,
html[data-theme="dark"] .loader-timer,
html[data-theme="dark"] .rctp-voice-status {
  color: #aebbd0 !important;
}

html[data-theme="dark"] .loader-timer {
  background: #0f1724 !important;
  border: 1px solid #334155;
}

html[data-theme="dark"] .rctp-voice-range {
  accent-color: #7fb3ff;
}

html[data-theme="dark"] .elapsed-value.elapsed-fresh {
  color: #6da6ff !important;
}

html[data-theme="dark"] .elapsed-value.elapsed-mid {
  color: #35d3ac !important;
}

html[data-theme="dark"] .elapsed-value.elapsed-old {
  color: #ff8a8a !important;
}

html[data-theme="dark"] .highlight-info {
  color: #ffb86b !important;
  border-bottom-color: #ffb86b !important;
}

html[data-theme="dark"] .metar-header,
html[data-theme="dark"] .metar-item {
  border-color: #334155 !important;
}

html[data-theme="dark"] .metar-item {
  background: #0f1724 !important;
}

html[data-theme="dark"] .metar-summary {
  color: #c4d0e1 !important;
}

html[data-theme="dark"] .metar-field label,
html[data-theme="dark"] .metar-item-time {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .metar-close-btn {
  background: #0f1724 !important;
  border-color: #334155 !important;
  color: #aebbd0 !important;
}

html[data-theme="dark"] .metar-close-btn:hover {
  background: #17263b !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .toast {
  background: #151f2f !important;
  color: var(--text-primary);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .toast-progress-bg {
  background: #0f1724 !important;
}

/* TPE Gate Info */
html[data-theme="dark"] .container,
html[data-theme="dark"] .header,
html[data-theme="dark"] .tableWrap,
html[data-theme="dark"] .modalBody,
html[data-theme="dark"] #atfmBody,
html[data-theme="dark"] #adpBody {
  color: var(--text-primary);
}

html[data-theme="dark"] .home-btn,
html[data-theme="dark"] .tabBtn,
html[data-theme="dark"] .select-trigger,
html[data-theme="dark"] .custom-options,
html[data-theme="dark"] .date-option,
html[data-theme="dark"] .gate-btn,
html[data-theme="dark"] #modalContent,
html[data-theme="dark"] #atfmContent,
html[data-theme="dark"] #adpContent,
html[data-theme="dark"] .info-block,
html[data-theme="dark"] .fr24-block {
  background-color: #101a2a !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .tableWrap {
  border-color: #334155 !important;
}

html[data-theme="dark"] thead th,
html[data-theme="dark"] .atfm-table thead th,
html[data-theme="dark"] .filter-tabs {
  background: #0f1724 !important;
  color: #aebbd0 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] tbody td,
html[data-theme="dark"] .atfm-table tbody td {
  background: #151f2f !important;
  color: #dce7f7 !important;
  border-bottom-color: #26364c !important;
}

html[data-theme="dark"] tbody tr:hover td,
html[data-theme="dark"] .atfm-table tbody tr:hover td,
html[data-theme="dark"] .date-option:hover,
html[data-theme="dark"] .date-option.selected,
html[data-theme="dark"] .gate-btn:hover,
html[data-theme="dark"] .adp-row:hover {
  background: #17263b !important;
}

html[data-theme="dark"] .flight-num,
html[data-theme="dark"] .big-text,
html[data-theme="dark"] .fr24-mono,
html[data-theme="dark"] .fr24-link,
html[data-theme="dark"] .fr24-block-title,
html[data-theme="dark"] .adp-filename,
html[data-theme="dark"] .adp-dl,
html[data-theme="dark"] .atfm-acid,
html[data-theme="dark"] .gate-current,
html[data-theme="dark"] tbody td[style*="var(--cal-navy)"] {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .security-wait-info,
html[data-theme="dark"] .note,
html[data-theme="dark"] .small-text,
html[data-theme="dark"] .fr24-label,
html[data-theme="dark"] .fr24-block-na,
html[data-theme="dark"] .atfm-window,
html[data-theme="dark"] .atfm-empty,
html[data-theme="dark"] .atfm-updated,
html[data-theme="dark"] .atfm-info-time,
html[data-theme="dark"] .adp-time,
html[data-theme="dark"] .group-label {
  color: #aebbd0 !important;
}

html[data-theme="dark"] .custom-options {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .select-trigger.active,
html[data-theme="dark"] input[type="text"]:focus {
  border-color: #7fb3ff !important;
  box-shadow: 0 0 0 3px rgba(127, 179, 255, 0.18) !important;
}

html[data-theme="dark"] .date-option {
  border-bottom-color: #26364c !important;
}

html[data-theme="dark"] .filter-tabs::-webkit-scrollbar-thumb {
  background-color: #334155;
}

html[data-theme="dark"] .filter-tab,
html[data-theme="dark"] .gate-btn.disabled,
html[data-theme="dark"] .fr24-block--empty {
  background: #0f1724 !important;
  color: #7f8da3 !important;
  border-color: #26364c !important;
}

html[data-theme="dark"] .filter-tab:hover,
html[data-theme="dark"] .gate-btn:not(.disabled):hover {
  color: #dce7f7 !important;
  border-color: #7fb3ff !important;
}

html[data-theme="dark"] .filter-tab.active,
html[data-theme="dark"] .gate-btn.selected,
html[data-theme="dark"] .tabBtn.active {
  background: #245ea8 !important;
  color: #ffffff !important;
  border-color: #4f8fdd !important;
}

html[data-theme="dark"] .tabBtn:not(.active) {
  background: #101a2a !important;
  color: #aebbd0 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] button.secondary {
  background: #101a2a !important;
  color: #dce7f7 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .atfm-btn {
  background: #2c2414 !important;
  color: #ffd98a !important;
  border: 1px solid #5f4615 !important;
}

html[data-theme="dark"] .adp-btn,
html[data-theme="dark"] .fr24-link {
  background: #10283a !important;
  color: #7dd3fc !important;
  border: 1px solid #1e4d68 !important;
}

html[data-theme="dark"] #loadingOverlay {
  background: rgba(2, 8, 23, 0.76) !important;
}

html[data-theme="dark"] .spinner {
  border-color: #334155 !important;
  border-top-color: #7fb3ff !important;
}

html[data-theme="dark"] .loading-text {
  color: #dce7f7 !important;
}

html[data-theme="dark"] #modal,
html[data-theme="dark"] #atfmModal,
html[data-theme="dark"] #adpModal {
  background: rgba(2, 8, 23, 0.72) !important;
}

html[data-theme="dark"] .modalHead {
  background: #245ea8 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .info-block {
  border-left-color: #7fb3ff !important;
}

html[data-theme="dark"] .info-block[style*="var(--focus-bg)"] {
  background: #102b35 !important;
  border-left-color: #67e8f9 !important;
}

html[data-theme="dark"] .fr24-block {
  border-left-color: #38bdf8 !important;
}

html[data-theme="dark"] .atfm-table-wrap,
html[data-theme="dark"] .atfm-info-list,
html[data-theme="dark"] .adp-group,
html[data-theme="dark"] .atfm-updated {
  border-color: #334155 !important;
}

html[data-theme="dark"] .atfm-code {
  background: rgba(251, 191, 36, 0.14) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .atfm-time-new,
html[data-theme="dark"] .status-change {
  color: #ffb86b !important;
}

html[data-theme="dark"] .status-cancelled,
html[data-theme="dark"] .gate-updated,
html[data-theme="dark"] .security-wait-age.danger {
  color: #ff8a8a !important;
}

html[data-theme="dark"] .status-success,
html[data-theme="dark"] .security-wait-age.fresh {
  color: #35d3ac !important;
}

html[data-theme="dark"] .gate-previous {
  color: #7f8da3 !important;
}

/* Home account portal */
html[data-theme="dark"] .portal-card {
  background: #151f2f !important;
  border-top-color: #7fb3ff !important;
  color: var(--text-primary);
}

html[data-theme="dark"] .portal-body {
  background: #151f2f !important;
  color: var(--text-primary);
}

html[data-theme="dark"] .portal-header {
  background: #151f2f !important;
  border-bottom-color: #2b3a50 !important;
}

html[data-theme="dark"] .portal-header [style*="color:#002663"],
html[data-theme="dark"] .portal-username,
html[data-theme="dark"] .pwd-label,
html[data-theme="dark"] .portal-section-icon {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .portal-avatar-lg,
html[data-theme="dark"] .user-avatar {
  background: #245ea8 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .portal-close {
  background: #0f1724 !important;
  color: #aebbd0 !important;
}

html[data-theme="dark"] .portal-close:hover {
  background: #17263b !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .portal-section {
  background: #0f1724 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .portal-section-toggle {
  background: #101a2a !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .portal-section-toggle:hover {
  background: #17263b !important;
}

html[data-theme="dark"] .portal-section-content {
  background: #0f1724 !important;
  border-top-color: #334155 !important;
}

html[data-theme="dark"] .portal-section-label {
  color: #c4d0e1 !important;
}

html[data-theme="dark"] .portal-section-summary,
html[data-theme="dark"] .portal-guest p,
html[data-theme="dark"] .pwd-hint {
  color: #aebbd0 !important;
}

html[data-theme="dark"] .pwd-input {
  background: #101a2a !important;
  border-color: #334155 !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .pwd-input:focus {
  border-color: #7fb3ff !important;
  box-shadow: 0 0 0 3px rgba(127, 179, 255, 0.18) !important;
}

html[data-theme="dark"] .portal-role-badge.user {
  background: rgba(96, 165, 250, 0.14) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .portal-role-badge.admin {
  background: rgba(52, 211, 153, 0.14) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] .portal-msg.success {
  background: rgba(16, 185, 129, 0.13) !important;
  color: #6ee7b7 !important;
  border-left-color: #10b981 !important;
}

html[data-theme="dark"] .portal-msg.error {
  background: rgba(239, 68, 68, 0.13) !important;
  color: #fca5a5 !important;
  border-left-color: #ef4444 !important;
}

html[data-theme="dark"] .portal-btn.primary,
html[data-theme="dark"] .portal-login-btn,
html[data-theme="dark"] .admin-shortcut {
  background: #245ea8 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .portal-btn.primary:hover,
html[data-theme="dark"] .portal-login-btn:hover,
html[data-theme="dark"] .admin-shortcut:hover {
  background: #2f70bf !important;
}

html[data-theme="dark"] .portal-btn.primary:disabled {
  background: #334155 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .portal-btn.danger {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

html[data-theme="dark"] .portal-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18) !important;
}

html[data-theme="dark"] .portal-footer-actions {
  border-top-color: #334155 !important;
}

html[data-theme="dark"] .portal-loading-dot {
  background: #7fb3ff !important;
}

/* Auth, verification, and admin pages */
html[data-theme="dark"] {
  --brand-navy: #7fb3ff;
  --brand-hover: #a8ccff;
  --bg-gradient: linear-gradient(135deg, #07111f 0%, #121826 100%);
  --text-main: #eef4ff;
  --text-sub: #aebbd0;
  --text-placeholder: #7f8da3;
  --border-color: #334155;
  --shadow-card: 0 18px 46px rgba(0, 0, 0, 0.38);
  --shadow-btn: 0 8px 20px rgba(0, 0, 0, 0.28);
  --error-bg: rgba(239, 68, 68, 0.13);
  --error-text: #fca5a5;
  --success-bg: rgba(16, 185, 129, 0.13);
  --success-text: #6ee7b7;
  --status-success-bg: rgba(16, 185, 129, 0.13);
  --status-danger-bg: rgba(239, 68, 68, 0.13);
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .step-card,
html[data-theme="dark"] .helper,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .req-card {
  background: #151f2f !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .login-card {
  border-top-color: #7fb3ff !important;
}

html[data-theme="dark"] .header h1,
html[data-theme="dark"] .title,
html[data-theme="dark"] h1,
html[data-theme="dark"] .input-label,
html[data-theme="dark"] .step-title,
html[data-theme="dark"] .user-name,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .req-user {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .header p,
html[data-theme="dark"] p,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .input-hint,
html[data-theme="dark"] .social-hint,
html[data-theme="dark"] .checkbox-container,
html[data-theme="dark"] .footer-link a,
html[data-theme="dark"] .back-link,
html[data-theme="dark"] .user-email,
html[data-theme="dark"] .req-label {
  color: #aebbd0 !important;
}

html[data-theme="dark"] .input-field,
html[data-theme="dark"] .search-input-override {
  background: #0f1724 !important;
  color: var(--text-primary) !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .input-field:focus,
html[data-theme="dark"] .search-input-override:focus {
  border-color: #7fb3ff !important;
  box-shadow: 0 0 0 3px rgba(127, 179, 255, 0.18) !important;
}

html[data-theme="dark"] .checkmark {
  border-color: #475569 !important;
  background: #0f1724 !important;
}

html[data-theme="dark"] .checkbox-container input:checked ~ .checkmark {
  background: #245ea8 !important;
  border-color: #7fb3ff !important;
}

html[data-theme="dark"] .login-btn,
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn-approve {
  background: #245ea8 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .login-btn:hover,
html[data-theme="dark"] .btn.primary:hover,
html[data-theme="dark"] .btn-approve:hover {
  background: #2f70bf !important;
}

html[data-theme="dark"] .login-btn:disabled,
html[data-theme="dark"] .btn:disabled {
  background: #334155 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .social-btn,
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .secondary-link,
html[data-theme="dark"] .forgot-password-btn {
  background: #101a2a !important;
  color: #dce7f7 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .social-btn:hover,
html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .secondary-link:hover {
  background: #17263b !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .social-btn.apple-btn {
  background: #050b14 !important;
  color: #ffffff !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] #googleSignIn {
  min-height: 48px !important;
  align-items: center !important;
}

html[data-theme="dark"] #googleSignIn:empty::before {
  content: "";
  width: min(100%, 336px);
  height: 44px;
  display: block;
  border-radius: 999px;
  background: #101a2a;
  border: 1px solid #334155;
}

html[data-theme="dark"] .divider {
  background-color: #2b3a50 !important;
}

html[data-theme="dark"] .error-message,
html[data-theme="dark"] .msg.error {
  background: rgba(239, 68, 68, 0.13) !important;
  color: #fca5a5 !important;
  border-left-color: #ef4444 !important;
}

html[data-theme="dark"] .msg.success {
  background: rgba(16, 185, 129, 0.13) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] .input-hint.error {
  color: #fca5a5 !important;
}

html[data-theme="dark"] .admin-card-override {
  background: #151f2f !important;
}

html[data-theme="dark"] .admin-card-override .top-bar {
  background: rgba(7, 17, 31, 0.82) !important;
  border-bottom: 1px solid #26364c;
}

html[data-theme="dark"] .header h1 span,
html[data-theme="dark"] .badge-count {
  background: #245ea8 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .table-wrapper {
  border-color: #334155 !important;
}

html[data-theme="dark"] thead {
  background: #0f1724 !important;
}

html[data-theme="dark"] th {
  background: #0f1724 !important;
  color: #aebbd0 !important;
  border-bottom-color: #334155 !important;
}

html[data-theme="dark"] td {
  background: #151f2f !important;
  color: #dce7f7 !important;
  border-bottom-color: #26364c !important;
}

html[data-theme="dark"] tbody tr:hover td {
  background: #17263b !important;
}

html[data-theme="dark"] .role-badge {
  background: rgba(96, 165, 250, 0.14) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .role-badge.admin {
  background: rgba(52, 211, 153, 0.14) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] .slider {
  background-color: #475569 !important;
}

html[data-theme="dark"] .slider:before {
  background-color: #e2e8f0 !important;
}

html[data-theme="dark"] input:checked + .slider {
  background-color: #245ea8 !important;
}

html[data-theme="dark"] input:checked + .slider.perm-slider {
  background-color: #10b981 !important;
}

html[data-theme="dark"] .perm-label,
html[data-theme="dark"] .req-value {
  color: #dce7f7 !important;
}

html[data-theme="dark"] .cal-loader-dot {
  background-color: #7fb3ff !important;
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(2, 8, 23, 0.72) !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .req-header,
html[data-theme="dark"] .req-actions {
  border-color: #334155 !important;
}

html[data-theme="dark"] .modal-body {
  background: #101a2a !important;
}

html[data-theme="dark"] .modal-close {
  background: #0f1724 !important;
  color: #aebbd0 !important;
}

html[data-theme="dark"] .modal-close:hover {
  background: #17263b !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .req-card {
  box-shadow: none !important;
}

html[data-theme="dark"] .req-card:hover {
  border-color: #7fb3ff !important;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28) !important;
}

html[data-theme="dark"] .req-tag {
  background: rgba(96, 165, 250, 0.14) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .btn-danger-soft,
html[data-theme="dark"] .btn-reject {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

html[data-theme="dark"] .btn-danger-soft:hover,
html[data-theme="dark"] .btn-reject:hover {
  background: rgba(239, 68, 68, 0.18) !important;
}

html[data-theme="dark"] .pagination-btn:disabled {
  background-color: #0f1724 !important;
  color: #64748b !important;
  border-color: #26364c !important;
}

html[data-theme="dark"] .pagination-controls {
  background: transparent !important;
}

html[data-theme="dark"] .spinner {
  border-color: rgba(255, 255, 255, 0.28) !important;
  border-top-color: #ffffff !important;
}

html[data-theme="dark"] .helper,
html[data-theme="dark"] .input-hint,
html[data-theme="dark"] .footer-link {
  border-color: #334155 !important;
}

html[data-theme="dark"] .helper {
  background: #101a2a !important;
}

html[data-theme="dark"] .step-card {
  background: #101a2a !important;
}

html[data-theme="dark"] .secondary-link:hover,
html[data-theme="dark"] .forgot-password-btn:hover {
  background: #17263b !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .footer-link a:hover,
html[data-theme="dark"] .back-link:hover {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .loading-container,
html[data-theme="dark"] #loading {
  background: transparent !important;
  color: #aebbd0 !important;
}

html[data-theme="dark"] .loading-text {
  color: #9cc5ff !important;
}

html[data-theme="dark"] .normal-btn,
html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .sys-btn.secondary-btn,
html[data-theme="dark"] .sys-btn.normal-btn {
  background: #101a2a !important;
  color: #dce7f7 !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .normal-btn:hover,
html[data-theme="dark"] .secondary-btn:hover,
html[data-theme="dark"] .sys-btn.secondary-btn:hover,
html[data-theme="dark"] .sys-btn.normal-btn:hover {
  background: #17263b !important;
  color: #ffffff !important;
  border-color: #7fb3ff !important;
}

html[data-theme="dark"] .req-actions {
  background: transparent !important;
}

html[data-theme="dark"] .btn-reject {
  background: rgba(239, 68, 68, 0.12) !important;
}

@media (max-width: 768px) {
  html[data-theme="dark"] .admin-card-override {
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-theme="dark"] tbody tr {
    background: #151f2f !important;
    border-color: #334155 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24) !important;
  }

  html[data-theme="dark"] tbody td {
    border-bottom-color: #26364c !important;
  }

  html[data-theme="dark"] td::before {
    color: #aebbd0 !important;
  }

  html[data-theme="dark"] td:last-child {
    background: #101a2a !important;
    border-top-color: #334155 !important;
  }
}

html[data-theme="dark"] .portal-overlay,
html[data-theme="dark"] .metar-backdrop {
  background: rgba(2, 8, 23, 0.72);
}

html[data-theme="dark"] img:not(.dark-mode-no-filter) {
  filter: brightness(0.92) contrast(1.04);
}

.dark-mode-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147483000;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  backdrop-filter: blur(12px);
}

.dark-mode-toggle:hover {
  transform: translateY(-2px);
}

.dark-mode-toggle::before {
  content: "☾";
  font-size: 22px;
  line-height: 1;
}

html[data-theme="dark"] .dark-mode-toggle {
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border-color: rgba(125, 179, 255, 0.46);
}

html[data-theme="dark"] .dark-mode-toggle::before {
  content: "☀";
  font-size: 19px;
}

@media (max-width: 640px) {
  .dark-mode-toggle {
    left: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
  }
}
