/* Optional dark appearance. Original stylesheet and page logic remain intact. */
:root[data-theme="dark"]{color-scheme:dark;--primary:#76a7ff;--primary-2:#9fc1ff;--bg:#0d1422;--surface:#182336;--ink:#f1f5fd;--muted:#acbad0;--border:#34445b;--success:#43d49a;--danger:#ff827b;--warning:#ffc36b;--purple:#b9a2ff}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap;padding:9px 12px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--ink);font-size:12px;font-weight:700;line-height:1.2;min-height:36px;cursor:pointer}
.theme-toggle:hover{border-color:var(--primary)}.theme-toggle:focus-visible{outline:3px solid var(--primary);outline-offset:2px}.theme-toggle-icon{font-size:15px;line-height:1}
.auth-theme-position{position:fixed;top:18px;right:18px;z-index:30}
:root[data-theme="dark"] body,:root[data-theme="dark"] .app-shell{background:var(--bg);color:var(--ink)}
:root[data-theme="dark"] .sidebar,:root[data-theme="dark"] .topbar,:root[data-theme="dark"] .panel,:root[data-theme="dark"] .metric-card,:root[data-theme="dark"] .modal-card,:root[data-theme="dark"] .auth-card{background:var(--surface);color:var(--ink);border-color:var(--border)}
:root[data-theme="dark"] .sidebar-footer{background:#202e45}
:root[data-theme="dark"] .sidebar-footer p,:root[data-theme="dark"] .nav-item,:root[data-theme="dark"] .icon-btn,:root[data-theme="dark"] .ghost-btn,:root[data-theme="dark"] .metric-card span,:root[data-theme="dark"] .table-wrap td,:root[data-theme="dark"] .field,:root[data-theme="dark"] .form-stack label,:root[data-theme="dark"] .report-filter-grid label,:root[data-theme="dark"] .report-legend-item{color:#d2dcee}
:root[data-theme="dark"] .nav-item.active,:root[data-theme="dark"] .nav-item:hover{background:#2b5fb6;color:white}
:root[data-theme="dark"] .table-wrap th,:root[data-theme="dark"] thead th{background:#202e45;color:#c5d3e7;border-color:var(--border)}
:root[data-theme="dark"] .table-wrap td,:root[data-theme="dark"] table td,:root[data-theme="dark"] table th,:root[data-theme="dark"] .status-row,:root[data-theme="dark"] .bar-chart{border-color:var(--border)}
:root[data-theme="dark"] input,:root[data-theme="dark"] select,:root[data-theme="dark"] textarea,:root[data-theme="dark"] .search,:root[data-theme="dark"] .date-btn,:root[data-theme="dark"] .btn-outline,:root[data-theme="dark"] .btn-danger,:root[data-theme="dark"] .ghost-btn,:root[data-theme="dark"] .theme-toggle{background:#1d2a3f;color:var(--ink);border-color:var(--border)}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#91a4c0}
:root[data-theme="dark"] .btn-primary{background:#366fd3;border-color:#366fd3;color:#fff}
:root[data-theme="dark"] .btn-danger{color:#ffaaa5;border-color:#a45b62}
:root[data-theme="dark"] .auth-page{background:linear-gradient(135deg,#0b1322,#162844)}
:root[data-theme="dark"] .modal,:root[data-theme="dark"] .payment-modal-overlay{background:rgba(0,0,0,.7)}
:root[data-theme="dark"] .loading-overlay{background:rgba(13,20,34,.82)}
:root[data-theme="dark"] .avatar,:root[data-theme="dark"] .metric-icon.blue{background:#263e66;color:#b2d0ff}
:root[data-theme="dark"] .metric-icon.yellow{background:#4a3820;color:#ffd18c}
:root[data-theme="dark"] .metric-icon.green{background:#194838;color:#82e8bd}
:root[data-theme="dark"] .metric-icon.purple{background:#3d315b;color:#c9b5ff}
:root[data-theme="dark"] .metric-icon.red{background:#552d36;color:#ffaba8}
:root[data-theme="dark"] .metric-icon.sky{background:#1d405b;color:#8bd1ff}
:root[data-theme="dark"] .badge.pending,:root[data-theme="dark"] .payment.unpaid{background:#493820;color:#ffce87}
:root[data-theme="dark"] .badge.accepted,:root[data-theme="dark"] .badge.scheduled,:root[data-theme="dark"] .source-badge.app{background:#233f68;color:#b9d4ff}
:root[data-theme="dark"] .badge.completed,:root[data-theme="dark"] .payment.paid{background:#18483a;color:#8aebbf}
:root[data-theme="dark"] .badge.cancelled,:root[data-theme="dark"] .badge.rejected,:root[data-theme="dark"] .badge.declined{background:#512e35;color:#ffaaa5}
:root[data-theme="dark"] .source-badge.walk_in{background:#533a23;color:#ffc082}
:root[data-theme="dark"] .payment.refunded{background:#39315c;color:#d0baff}
:root[data-theme="dark"] .walkin-callout{background:#203758;border-color:#38567d;color:#e2eafb}
:root[data-theme="dark"] .report-bar-track{background:#35465e}
:root[data-theme="dark"] .booking-detail-badge,:root[data-theme="dark"] .booking-secondary{color:#c4d2e7}
:root[data-theme="dark"] .actions-menu,:root[data-theme="dark"] .action-menu,:root[data-theme="dark"] .actions-dropdown,:root[data-theme="dark"] .dropdown-menu{background:#1d2a3f;color:var(--ink);border-color:var(--border);box-shadow:0 10px 28px #0008}
:root[data-theme="dark"] .actions-menu button,:root[data-theme="dark"] .action-menu button,:root[data-theme="dark"] .actions-dropdown button,:root[data-theme="dark"] .dropdown-menu button{color:var(--ink);background:transparent}
:root[data-theme="dark"] .actions-menu button:hover,:root[data-theme="dark"] .action-menu button:hover,:root[data-theme="dark"] .actions-dropdown button:hover,:root[data-theme="dark"] .dropdown-menu button:hover{background:#2d405c}
:root[data-theme="dark"] .actions-menu .cancel-booking,:root[data-theme="dark"] .action-menu .cancel-booking{color:#ffaaa5}
:root[data-theme="dark"] .panel [style*="background: white"],:root[data-theme="dark"] .panel [style*="background:#fff"]{background:var(--surface)!important}
@media(max-width:520px){.theme-toggle{padding:8px 9px;font-size:11px}.topbar{gap:8px}}
@media print{:root[data-theme="dark"]{color-scheme:light;--bg:#fff;--surface:#fff;--ink:#152033;--muted:#667085;--border:#e4e7ec}.theme-toggle{display:none!important}}

/* Contrast fixes: additive CSS only; no JavaScript, markup, or booking layout changes. */
:root[data-theme="dark"]{--muted:#bac8dc}
:root[data-theme="dark"] :is(.panel,.metric-card,.modal-card,.auth-card,.payment-modal,.customer-detail-grid>div){color:var(--ink)}
:root[data-theme="dark"] :is(.payment-modal,.customer-detail-grid>div){background:#182336;border-color:var(--border)}
:root[data-theme="dark"] :is(.payment-modal-header h2,.payment-modal label,.payment-modal-description,.payment-modal-close,.payment-modal-note,.customer-detail-grid strong,.customer-detail-grid span,.panel-head span,.metric-card small,.page-heading p,.muted,.helper-text,.booking-primary,.booking-secondary,.booking-customer-service-cell,.booking-schedule-location-cell){color:#d5e1f1}
:root[data-theme="dark"] .payment-modal-note{background:#263750;color:#d5e1f1}
:root[data-theme="dark"] :is(.table-wrap tbody tr:hover,table tbody tr:hover){background:#24344c;color:var(--ink)}
:root[data-theme="dark"] :is(.table-wrap tbody tr:hover td,table tbody tr:hover td){color:#f1f5fd}
:root[data-theme="dark"] :is(.table-wrap tbody tr:hover .booking-secondary,table tbody tr:hover .booking-secondary){color:#c4d2e7}
:root[data-theme="dark"] :is(.btn-outline:hover,.ghost-btn:hover,.icon-btn:hover,.date-btn:hover,.theme-toggle:hover,.link-btn:hover){background:#2b3d58;color:#f1f5fd;border-color:#57749b}
:root[data-theme="dark"] :is(input,textarea,select,.search,.payment-modal-input){background:#1d2a3f;color:#f1f5fd;border-color:#445773}
:root[data-theme="dark"] :is(input:hover,textarea:hover,select:hover,.search:hover,.payment-modal-input:hover){background:#263750;color:#f1f5fd}
:root[data-theme="dark"] :is(input:focus,textarea:focus,select:focus,.search:focus,.payment-modal-input:focus){background:#263750;color:#fff;border-color:#76a7ff}
:root[data-theme="dark"] select option{background:#1d2a3f;color:#f1f5fd}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu){background:#1d2a3f;color:#f1f5fd}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu) :is(button,a){color:#f1f5fd;background:transparent}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu) :is(button,a):hover{background:#314662;color:#fff}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu) :is(.cancel-booking,.cancel-booking:hover){color:#ffaaa5}
:root[data-theme="dark"] :is(.btn-danger:hover,.btn-primary:hover){color:#fff}
:root[data-theme="dark"] :is(.badge.on_the_way,.badge.arrived,.badge.in_progress){background:#493820;color:#ffce87}
:root[data-theme="dark"] :is(.source-badge.app,.source-text.app){color:#93bdff}
:root[data-theme="dark"] :is(.source-badge.walk_in,.source-text.walk_in){color:#ffc082}
:root[data-theme="dark"] ::selection{background:#4066a2;color:#fff}


/* Global dark-mode coverage: only active when data-theme=dark. */
:root[data-theme="dark"]{--bg:#0d1422;--surface:#182336;--ink:#f1f5fd;--muted:#bac8dc;--border:#34445b;color-scheme:dark}
:root[data-theme="dark"] :is(body,.app-shell,.main-area,.page-content,.content,.dashboard-content){color:var(--ink)}
:root[data-theme="dark"] :is(.sidebar,.topbar,.panel,.metric-card,.auth-card,.modal-card,.customer-modal-card,.payment-modal,.business-form,.report-card,.settings-card,.stat-card,.card,.table-container,.table-wrap,.form-panel,.customer-detail-grid>div){background-color:#182336;color:#f1f5fd;border-color:#34445b}
:root[data-theme="dark"] :is(.sidebar-footer,.walkin-callout,.payment-modal-note,.report-bar-track,.status-row,.chart-container,.report-chart,.report-summary,.filter-bar,.filters,.table-toolbar,.toolbar,.pagination,.empty-state){background-color:#202e45;color:#dce6f5;border-color:#34445b}
:root[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6,p,label,legend,dt,dd,th,td,strong,small,.page-heading,.page-heading p,.panel-head h2,.panel-head span,.metric-card strong,.metric-card span,.metric-card small,.customer-detail-grid strong,.customer-detail-grid span,.form-section-title,.report-filter-grid label,.field,.form-stack label,.brand-admin,.admin-menu small,.helper-text,.muted,.empty,.booking-primary,.booking-secondary,.booking-id,.customer-cell small){color:#e0e9f7}
:root[data-theme="dark"] :is(.table-wrap,table,thead,tbody,tfoot,tr,td,th){border-color:#34445b}
:root[data-theme="dark"] :is(table,.table-wrap table){background:#182336;color:#e0e9f7}
:root[data-theme="dark"] :is(thead,thead tr,thead th,.table-wrap th){background:#202e45;color:#e0e9f7}
:root[data-theme="dark"] :is(tbody tr,.table-wrap tbody tr){background:#182336;color:#e0e9f7}
:root[data-theme="dark"] :is(tbody tr:nth-child(even),.table-wrap tbody tr:nth-child(even)){background:#1b293d}
:root[data-theme="dark"] :is(tbody tr:hover,.table-wrap tbody tr:hover){background:#293c57;color:#fff}
:root[data-theme="dark"] :is(tbody tr td,tbody tr th,.table-wrap td,.table-wrap tbody tr:hover td){color:#e0e9f7}
:root[data-theme="dark"] :is(input,select,textarea,button.date-btn,.search,.payment-modal-input,.report-filter-grid input,.report-filter-grid select,.form-stack input,.field input,.field select,.field textarea){background:#1d2a3f;color:#f1f5fd;border-color:#445773}
:root[data-theme="dark"] :is(input,select,textarea,.search,.payment-modal-input):is(:hover,:focus){background:#263750;color:#fff;border-color:#76a7ff}
:root[data-theme="dark"] :is(input,textarea)::placeholder{color:#aabbd1;opacity:1}
:root[data-theme="dark"] :is(select option,select optgroup){background:#1d2a3f;color:#f1f5fd}
:root[data-theme="dark"] :is(input:disabled,select:disabled,textarea:disabled,button:disabled){background:#263247;color:#b4c2d4;opacity:.7}
:root[data-theme="dark"] :is(.btn-outline,.btn-danger,.ghost-btn,.icon-btn,.date-btn,.theme-toggle,.actions-toggle,.actions-btn,.action-btn){background:#24344b;color:#f1f5fd;border-color:#445773}
:root[data-theme="dark"] :is(.btn-outline,.ghost-btn,.icon-btn,.date-btn,.theme-toggle,.actions-toggle,.actions-btn,.action-btn):hover{background:#354d6e;color:#fff;border-color:#7394bc}
:root[data-theme="dark"] :is(.btn-primary,.nav-item.active){background:#366fd3;color:#fff;border-color:#366fd3}
:root[data-theme="dark"] :is(.btn-primary:hover,.nav-item.active:hover){background:#285fbd;color:#fff}
:root[data-theme="dark"] :is(.btn-danger,.cancel-booking){color:#ffaaa5}
:root[data-theme="dark"] :is(.btn-danger:hover,.cancel-booking:hover){background:#62333c;color:#fff}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu,.action-dropdown,.menu-dropdown,.dropdown-content){background:#1d2a3f;color:#f1f5fd;border-color:#445773}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu,.action-dropdown,.menu-dropdown,.dropdown-content) :is(button,a){background:transparent;color:#f1f5fd}
:root[data-theme="dark"] :is(.actions-menu,.action-menu,.actions-dropdown,.dropdown-menu,.action-dropdown,.menu-dropdown,.dropdown-content) :is(button,a):hover{background:#314662;color:#fff}
:root[data-theme="dark"] :is(.badge,.payment,.source-badge){border-color:transparent}
:root[data-theme="dark"] :is(.badge.pending,.payment.unpaid,.badge.on_the_way,.badge.arrived,.badge.in_progress){background:#493820;color:#ffce87}
:root[data-theme="dark"] :is(.badge.accepted,.badge.scheduled){background:#233f68;color:#b9d4ff}
:root[data-theme="dark"] :is(.badge.completed,.payment.paid){background:#18483a;color:#8aebbf}
:root[data-theme="dark"] :is(.badge.cancelled,.badge.rejected,.badge.declined){background:#512e35;color:#ffaaa5}
:root[data-theme="dark"] :is(.source-badge.app,.source-text.app){color:#93bdff}
:root[data-theme="dark"] :is(.source-badge.walk_in,.source-text.walk_in){color:#ffc082}
:root[data-theme="dark"] .source-badge.app{background:#233f68}
:root[data-theme="dark"] .source-badge.walk_in{background:#533a23}
:root[data-theme="dark"] :is(.payment.refunded){background:#39315c;color:#d0baff}
:root[data-theme="dark"] :is(.link-btn,a:not(.nav-item):not(.btn)){color:#9fc1ff}
:root[data-theme="dark"] :is(.link-btn,a:not(.nav-item):not(.btn)):hover{color:#d2e3ff}
:root[data-theme="dark"] :is(.form-divider,hr){border-color:#34445b;background-color:#34445b}
:root[data-theme="dark"] :is(.modal,.payment-modal-overlay,.loading-overlay){color:#f1f5fd}
:root[data-theme="dark"] [style*="background: white"],:root[data-theme="dark"] [style*="background:white"],:root[data-theme="dark"] [style*="background: #fff"],:root[data-theme="dark"] [style*="background:#fff"],:root[data-theme="dark"] [style*="background-color: white"],:root[data-theme="dark"] [style*="background-color:#fff"]{background-color:#182336!important;color:#f1f5fd}
:root[data-theme="dark"] [style*="color: #0f172a"],:root[data-theme="dark"] [style*="color:#0f172a"],:root[data-theme="dark"] [style*="color: #334155"],:root[data-theme="dark"] [style*="color:#334155"]{color:#e0e9f7!important}
:root[data-theme="dark"] ::selection{background:#4066a2;color:#fff}
@media print{:root[data-theme="dark"] :is(body,.app-shell,.main-area,.panel,.table-wrap,table,thead,tbody,tr,td,th){background:#fff!important;color:#152033!important}}

/* Targeted dark-mode contrast fixes across Admin pages */
:root[data-theme="dark"] .booking-source-tabs,
:root[data-theme="dark"] .booking-source-tab,
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tabs,
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab {background:#1c2b40!important;color:#e4ecf8!important;border-color:#40536c!important;}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab:hover {background:#2b405c!important;color:#fff!important;}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab.active {background:#315588!important;color:#fff!important;border-color:#719ad6!important;}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab .source-count {background:#2e405a!important;color:#e4ecf8!important;}
:root[data-theme="dark"] .customer-avatar,
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] [class*="initial-avatar"],
:root[data-theme="dark"] [class*="customer-initial"] {background:#2b4567!important;color:#e6f0ff!important;border-color:#526b8c!important;}
:root[data-theme="dark"] :is(.metric,.metric-card,.metrics>div,.stat,.stat-card,.stat-box,.summary-card,.kpi-card,.technician-card,.tech-card,.job-card,.jobs-card,.settings-row,.settings-section,.settings-item,.setting-card){background-color:#1b2a3f!important;color:#edf3fd!important;border-color:#3c506a!important;}
:root[data-theme="dark"] :is(.metric,.metric-card,.metrics>div,.stat,.stat-card,.stat-box,.summary-card,.kpi-card,.technician-card,.tech-card,.job-card,.jobs-card,.settings-row,.settings-section,.settings-item,.setting-card) :is(strong,small,span,p,h2,h3,h4){color:#e4edfb;}
:root[data-theme="dark"] :is(.btn,.ghost-btn,button,.action-button,.action-btn,.toggle-btn,.disable-btn):not(.btn-primary):not(.booking-source-tab):not(.theme-toggle):not(.booking-action-trigger){border-color:#435772;}
:root[data-theme="dark"] :is(.btn-outline,.ghost-btn,.btn-danger,.disable-btn,.action-btn,.action-button,.booking-action-trigger,.booking-action-dropdown,.booking-action-dropdown .btn){background-color:#243650!important;color:#edf3fd!important;border-color:#526781!important;}
:root[data-theme="dark"] :is(.btn-outline,.ghost-btn,.btn-danger,.disable-btn,.action-btn,.action-button,.booking-action-dropdown .btn):hover{background-color:#354d6b!important;color:#fff!important;}
:root[data-theme="dark"] :is(.btn-danger,.disable-btn,.cancel-booking){color:#ffb3b3!important;}
:root[data-theme="dark"] :is(.btn-danger,.disable-btn,.cancel-booking):hover{background-color:#623b43!important;color:#fff!important;}
:root[data-theme="dark"] :is(.booking-action-dropdown,.booking-actions-menu[open] .booking-action-dropdown){background:#1c2b40!important;border-color:#4d6481!important;}
:root[data-theme="dark"] :is(.booking-action-dropdown .btn,.booking-action-dropdown button){white-space:normal;overflow-wrap:break-word;}
:root[data-theme="dark"] .sidebar-footer{background:#18283e!important;color:#e4edfb!important;}
.sidebar-footer strong{font-size:12px;line-height:1.5;overflow-wrap:break-word;}
:root[data-theme="dark"] .sidebar-brand :is(.brand-name,small){color:#f0f5ff!important;}
/* Consistent header: toggle immediately before user account / Sign Out */
.topbar .theme-toggle{flex-shrink:0;white-space:nowrap;}
.topbar .admin-menu{flex-shrink:0;}
@media(max-width:600px){.topbar .theme-toggle{font-size:11px;padding:7px 9px;}.topbar .admin-menu{gap:6px;}}

/* Final targeted contrast pass: Bookings and Live Tracking only.
   These overrides do not change markup, layouts, interactions, or JavaScript. */
:root[data-theme="dark"] body:has(#bookingsTable) :is(.booking-primary,.booking-id strong,.booking-customer-service-cell strong,.booking-schedule-location-cell strong){color:#f0f5ff!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.booking-detail-text,.booking-secondary,.booking-customer-service-cell small,.booking-schedule-location-cell small){color:#c5d3e6!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.booking-service-badge,.booking-location-badge,.booking-detail-badge){background:transparent!important;border:0!important;box-shadow:none!important;color:#c5d3e6!important}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-id .source-badge.app{background:transparent!important;border:0!important;color:#93bdff!important}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-id .source-badge.walk_in{background:transparent!important;border:0!important;color:#ffc082!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.booking-source-tabs,.booking-source-tab,.booking-source-select){background:#1d2c43!important;color:#e3ecfa!important;border-color:#445c79!important}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab.active{background:#2e5488!important;color:#fff!important}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-source-tab .source-count{background:#304562!important;color:#edf4ff!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.booking-action-trigger,.booking-menu-btn){color:#edf4ff!important}
:root[data-theme="dark"] body:has(#bookingsTable) .booking-action-dropdown .cancel-booking{color:#ffb4b4!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.badge,.payment){filter:none!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.badge.pending,.payment.unpaid){background:#4a3824!important;color:#ffce87!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.badge.accepted,.badge.scheduled){background:#243e62!important;color:#c1d9ff!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.badge.completed,.payment.paid){background:#1d463b!important;color:#a2ecc8!important}
:root[data-theme="dark"] body:has(#bookingsTable) :is(.badge.cancelled,.badge.rejected){background:#502e38!important;color:#ffb6bd!important}

/* Live Tracking page uses inline CSS with hard-coded white tracking cards.
   Scope overrides to this page and override those original light colors. */
:root[data-theme="dark"] body:has(#trackingList) :is(.tracking-panel,.tracking-list){color:#edf3fd!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item{background:#1c2c42!important;color:#edf3fd!important;border:1px solid #465e7c!important;box-shadow:none!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item:hover,
:root[data-theme="dark"] body:has(#trackingList) .tracking-item:focus-visible{background:#293f5d!important;color:#fff!important;border-color:#83a9e4!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item strong{color:#f1f6ff!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item small{color:#c2d2e7!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item .tracking-fresh{color:#89e5b1!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-item .tracking-stale{color:#ffce8c!important}
:root[data-theme="dark"] body:has(#trackingList) :is(.tracking-note,#trackingCount,#trackingMapNote){color:#c2d2e7!important}
:root[data-theme="dark"] body:has(#trackingList) .tracking-error{color:#ffb3b3!important}
/* The map itself uses a light tile provider: preserve map tiles while
   darkening the empty/loading map surface and its surrounding border. */
:root[data-theme="dark"] body:has(#trackingList) #trackingMap{background:#22334a!important;border:1px solid #405775!important}

/* Settings service action: keep Disable legible in dark mode. */
:root[data-theme="dark"] body:has(#serviceCategory) .toggle-service.btn-danger,
:root[data-theme="dark"] body:has(#serviceCategory) button.toggle-service[data-status="true"],
:root[data-theme="dark"] .toggle-service.btn-danger {
  background-color: #4b2733 !important;
  color: #ffe4e6 !important;
  border: 1px solid #b85b6b !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #ffe4e6 !important;
}
:root[data-theme="dark"] .toggle-service.btn-danger:hover,
:root[data-theme="dark"] .toggle-service.btn-danger:focus-visible {
  background-color: #683243 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: #e08091 !important;
}
:root[data-theme="dark"] .toggle-service.btn-success {
  background-color: #173f37 !important;
  color: #d1fae5 !important;
  border: 1px solid #388875 !important;
  -webkit-text-fill-color: #d1fae5 !important;
}
:root[data-theme="dark"] .income-tab{background:#1d2a3f;color:var(--ink);border-color:var(--border)}
:root[data-theme="dark"] .income-tab.active{background:linear-gradient(135deg,rgba(118,167,255,.20),rgba(118,167,255,.06));border-color:var(--primary)}
:root[data-theme="dark"] .income-col-track{background:#202e45}
:root[data-theme="dark"] .donut-legend-row:hover{background:#202e45}
:root[data-theme="dark"] .donut-legend-name,:root[data-theme="dark"] .income-summary span,:root[data-theme="dark"] .income-col-label{color:#c4d2e7}
:root[data-theme="dark"] .donut-center strong,:root[data-theme="dark"] .income-tab strong,:root[data-theme="dark"] .income-summary strong,:root[data-theme="dark"] .donut-legend-val strong{color:#f1f5fd}
:root[data-theme="dark"] .filter-badge{background:#366fd3}
:root[data-theme="dark"] .reports-donuts>.panel:hover{box-shadow:0 10px 26px rgba(0,0,0,.35)}


/* FRIGID performance-safe global theme: animate only major containers. */
:root { --frigid-theme-speed: 135ms; }
html.theme-ready body,
html.theme-ready .sidebar,
html.theme-ready .sidebar-footer,
html.theme-ready .topbar,
html.theme-ready .panel,
html.theme-ready .metric-card,
html.theme-ready .modal-card,
html.theme-ready .auth-card,
html.theme-ready .theme-toggle {
  transition: background-color var(--frigid-theme-speed) ease-out,
              border-color var(--frigid-theme-speed) ease-out,
              color var(--frigid-theme-speed) ease-out !important;
}
/* Avoid mass repaint on complex pages. Leave functional hover effects intact. */
html.theme-ready #trackingMap,
html.theme-ready #trackingMap *,
html.theme-ready .gm-style *,
html.theme-ready canvas,
html.theme-ready .chart *,
html.theme-ready .table-wrap th,
html.theme-ready .table-wrap td {
  transition: none !important;
}
@media(prefers-reduced-motion:reduce){
  html.theme-ready body,
  html.theme-ready .sidebar,
  html.theme-ready .sidebar-footer,
  html.theme-ready .topbar,
  html.theme-ready .panel,
  html.theme-ready .metric-card,
  html.theme-ready .modal-card,
  html.theme-ready .auth-card,
  html.theme-ready .theme-toggle { transition: none !important; }
}
