/*
 * Global light-lock UX contract for GPS Singburi.
 * Locks visual baseline to light mode even when legacy dark-mode flags are present.
 */
body.app-shell.light-theme-lock {
    color-scheme: light;
    --bg-primary: #f0f9ff;
    --bg-secondary: #ffffff;
    --bg-surface: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --border-color: #dbeafe;
    --surface-shadow: none;
}

/* Normalize if dark-mode accidentally remains on html. */
body.app-shell.light-theme-lock.dark-mode {
    background: #f0f9ff !important;
    color: #0f172a !important;
    --bg-primary: #f0f9ff !important;
    --bg-secondary: #ffffff !important;
    --bg-surface: #f8fafc !important;
    --text-primary: #0f172a !important;
    --text-secondary: #334155 !important;
    --border-color: #dbeafe !important;
    --surface-shadow: none !important;
}

/* Content surfaces never inherit a forced dark canvas. */
body.app-shell.light-theme-lock .main-content-wrapper,
body.app-shell.light-theme-lock .page-content,
body.app-shell.light-theme-lock .main-page,
body.app-shell.light-theme-lock .report-shell,
body.app-shell.light-theme-lock .app-footer {
    background: #f0f9ff !important;
    color: #0f172a !important;
}

/* Keep card/table blocks flat and readable across every page. */
body.app-shell.light-theme-lock .page-content :is(
    .dash-card,
    .stat-card,
    .content-card,
    .card,
    .card-body,
    .card-header,
    .table-section,
    .main-content-container,
    .report-card,
    .report-table-wrapper,
    .dataTables_wrapper,
    .sys-notify-shell,
    .line-reports-card,
    .line-ctn-card,
    .report-table,
    .report-page
) {
    background: #ffffff !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--surface-shadow) !important;
    color: #0f172a !important;
}

body.app-shell.light-theme-lock .page-content :is(
    .dash-card,
    .stat-card,
    .content-card,
    .card,
    .table-section,
    .main-content-container,
    .report-card,
    .report-table-wrapper,
    .dataTables_wrapper,
    .sys-notify-shell,
    .line-reports-card,
    .line-ctn-card
) :is(
    [style*="box-shadow: 0 10px 15px -3px"],
    [style*="box-shadow:0 10px 15px -3px"],
    [style*="box-shadow: 0 4px 6px"],
    [style*="box-shadow:0 4px 6px"],
    [style*="box-shadow: 0 10px 30px"]
) {
    box-shadow: none !important;
}

/* Inputs and select controls always readable. */
body.app-shell.light-theme-lock .page-content :is(input, select, textarea, .custom-input, .custom-select, .form-control, .form-select) {
    background: #ffffff !important;
    border-color: #bfdbfe !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* Flat, consistent buttons everywhere (no raised shadows). */
body.app-shell.light-theme-lock .page-content :is(button, input[type="button"], input[type="submit"], a.btn, .report-btn, .action-btn, .btn-action, .save-btn, .filter-btn, .page-btn, .btn-pg, .admin-replay-search-btn, .admin-replay-control-btn, .admin-replay-play-btn, .layer-toggle-btn, .map-type-btn) {
    box-shadow: none !important;
    transform: none !important;
}

/* Keep map/detail buttons readable and blue by default contract. */
body.app-shell.light-theme-lock .page-content :is(button, input[type="button"], input[type="submit"], a.btn, .report-btn, .action-btn, .btn-action):not(:where(.btn-link, .btn-close, .logout-btn, [class*="danger"], [class*="delete"])) {
    background: #0369a1 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: #38bdf8 !important;
}

/* Disabled controls remain legible without looking like enabled actions. */
body.app-shell.light-theme-lock .page-content :is(
    button:disabled, button.disabled, button[aria-disabled="true"],
    input[type="button"]:disabled, input[type="submit"]:disabled,
    a.btn.disabled, a.btn[aria-disabled="true"],
    .page-btn.disabled, .btn-pg.disabled,
    .page-item.disabled .page-link, .paginate_button.disabled
),
body.app-shell.light-theme-lock .page-content :is(
    button:disabled, button.disabled, button[aria-disabled="true"],
    .page-btn.disabled, .btn-pg.disabled,
    .page-item.disabled .page-link, .paginate_button.disabled
):hover {
    background: #e2e8f0 !important;
    color: #475569 !important;
    -webkit-text-fill-color: #475569 !important;
    border-color: #94a3b8 !important;
    opacity: 1 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

body.app-shell.light-theme-lock .page-content :is(
    button:disabled, button.disabled, button[aria-disabled="true"],
    .page-btn.disabled, .btn-pg.disabled, .page-item.disabled .page-link
) :is(span, i) {
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    opacity: 1 !important;
}

/* Icon-only badges in report headings should not have dark chips. */
body.app-shell.light-theme-lock .page-content .report-page h2 > span:first-child,
body.app-shell.light-theme-lock .page-content .report-header h2 > span:first-child,
body.app-shell.light-theme-lock .page-content .report-header h3 > span:first-child,
body.app-shell.light-theme-lock .page-content .report-card h2 > span:first-child,
body.app-shell.light-theme-lock .page-content .dashboard-header h2 > span:first-child {
    background: transparent !important;
    color: #0284c7 !important;
}

/* Admin replay: clean cards, controls and timeline text visibility. */
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-layout,
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-sidebar,
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-map {
    background: transparent !important;
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-admin_replay .admin-replay-sidebar .sidebar-section,
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-summary,
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-route-list,
body.app-shell.light-theme-lock.page-admin_replay #vehicle-detail-panel,
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-controls,
body.app-shell.light-theme-lock.page-admin_replay #map-control-panel {
    background: #ffffff !important;
    border: 1px solid #dbeafe !important;
    box-shadow: none !important;
    border-radius: 12px !important;
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-admin_replay .admin-replay-route-list,
body.app-shell.light-theme-lock.page-admin_replay #summary-card,
body.app-shell.light-theme-lock.page-admin_replay #vehicle-detail-panel,
body.app-shell.light-theme-lock.page-admin_replay #route-list {
    border-color: #e2e8f0 !important;
}

body.app-shell.light-theme-lock.page-admin_replay .admin-replay-speed,
body.app-shell.light-theme-lock.page-admin_replay .replay-input,
body.app-shell.light-theme-lock.page-admin_replay .replay-date-cell,
body.app-shell.light-theme-lock.page-admin_replay .replay-time-cell {
    background: #ffffff !important;
    border-color: #bfdbfe !important;
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-admin_replay .admin-replay-route-list [style*="color:#f8fafc"],
body.app-shell.light-theme-lock.page-admin_replay .admin-replay-route-list [style*="color:#94a3b8"] {
    color: #334155 !important;
}

body.app-shell.light-theme-lock.page-admin_replay #route-list > div {
    color: #475569 !important;
}

body.app-shell.light-theme-lock.page-admin_replay .admin-replay-route-list .timeline-item,
body.app-shell.light-theme-lock.page-admin_replay .timeline-item,
body.app-shell.light-theme-lock.page-admin_replay .timeline-event {
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-admin_replay .timeline-event {
    background: #f8fafc !important;
}

body.app-shell.light-theme-lock.page-admin_replay .timeline-path-location,
body.app-shell.light-theme-lock.page-admin_replay .timeline-event-desc,
body.app-shell.light-theme-lock.page-admin_replay .timeline-event-time,
body.app-shell.light-theme-lock.page-admin_replay .event-type-label {
    color: #334155 !important;
}

body.app-shell.light-theme-lock.page-admin_replay #panel-speed,
body.app-shell.light-theme-lock.page-admin_replay #panel-location-text,
body.app-shell.light-theme-lock.page-admin_replay #panel-license,
body.app-shell.light-theme-lock.page-admin_replay #panel-latlng,
body.app-shell.light-theme-lock.page-admin_replay #panel-time,
body.app-shell.light-theme-lock.page-admin_replay #panel-sat,
body.app-shell.light-theme-lock.page-admin_replay #panel-gsm,
body.app-shell.light-theme-lock.page-admin_replay #panel-extv,
body.app-shell.light-theme-lock.page-admin_replay #panel-batv,
body.app-shell.light-theme-lock.page-admin_replay #panel-fuel,
body.app-shell.light-theme-lock.page-admin_replay #panel-temp,
body.app-shell.light-theme-lock.page-admin_replay #total-distance {
    color: #0f172a !important;
    opacity: 1 !important;
}

/* POI map page (admin) explicit dark inline fix. */
body.app-shell.light-theme-lock.page-poi .poi-map-page,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-page,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-page {
    color: #0f172a !important;
    background: transparent !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-head,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-head,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-head {
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-head h1,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-head h1,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-head h1 {
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-head h1 i,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-head h1 i,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-head h1 i {
    color: #0284c7 !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-status,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-status,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-status {
    background: #f1f5f9 !important;
    border: 1px solid #dbeafe !important;
    color: #334155 !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-legend,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-legend,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-legend {
    color: #334155 !important;
}

body.app-shell.light-theme-lock.page-poi .poi-coverage-map,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-coverage-map,
body.app-shell.light-theme-lock.page-admin_poi .poi-coverage-map {
    background: #ffffff !important;
    border: 1px solid #dbeafe !important;
    box-shadow: none !important;
}

body.app-shell.light-theme-lock.page-poi .poi-map-popup,
body.app-shell.light-theme-lock.page-admin_poi_map .poi-map-popup,
body.app-shell.light-theme-lock.page-admin_poi .poi-map-popup {
    color: #0f172a !important;
}

body.app-shell.light-theme-lock.page-poi .leaflet-control,
body.app-shell.light-theme-lock.page-admin_poi_map .leaflet-control,
body.app-shell.light-theme-lock.page-admin_poi .leaflet-control {
    color: #0f172a !important;
}

/* Report pages: enforce light shells and readable table text. */
body.app-shell.light-theme-lock [class*='page-report'] .report-page,
body.app-shell.light-theme-lock [class*='page-report'] .report-form,
body.app-shell.light-theme-lock [class*='page-report'] .user-report-shell {
    background: #ffffff !important;
    border-color: #dbeafe !important;
    color: #0f172a !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .report-card,
body.app-shell.light-theme-lock [class*='page-report'] .report-table-wrapper,
body.app-shell.light-theme-lock [class*='page-report'] .dataTables_wrapper,
body.app-shell.light-theme-lock [class*='page-report'] .report-filter-card,
body.app-shell.light-theme-lock [class*='page-report'] .trip-table-scroll {
    background: #ffffff !important;
    border-color: #dbeafe !important;
    box-shadow: none !important;
}

body.app-shell.light-theme-lock.report-surface :is(
    .trip-table-scroll,
    .distance-table-scroll,
    .legacy-report-scroll
) {
    background: #ffffff !important;
    border-color: #dbeafe !important;
    box-shadow: none !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .report-table,
body.app-shell.light-theme-lock [class*='page-report'] .trip-table,
body.app-shell.light-theme-lock [class*='page-report'] .dataTable {
    color: #0f172a !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .report-table thead th,
body.app-shell.light-theme-lock [class*='page-report'] .trip-table thead th,
body.app-shell.light-theme-lock [class*='page-report'] .dataTables_wrapper table th,
body.app-shell.light-theme-lock [class*='page-report'] table th,
body.app-shell.light-theme-lock [class*='page-report'] th {
    color: #0f172a !important;
    background: #eff6ff !important;
    border-bottom: 1px solid #dbeafe !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .report-table td,
body.app-shell.light-theme-lock [class*='page-report'] .trip-table td,
body.app-shell.light-theme-lock [class*='page-report'] .dataTable td,
body.app-shell.light-theme-lock [class*='page-report'] table td {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .status-map-dialog,
body.app-shell.light-theme-lock [class*='page-report'] .status-map-footer,
body.app-shell.light-theme-lock [class*='page-report'] .longstop-map-dialog,
body.app-shell.light-theme-lock [class*='page-report'] .longstop-map-footer {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #dbeafe !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .status-map-canvas,
body.app-shell.light-theme-lock [class*='page-report'] #status-map-canvas,
body.app-shell.light-theme-lock [class*='page-report'] .longstop-map-canvas {
    background: #e2e8f0 !important;
}

body.app-shell.light-theme-lock [class*='page-report'] .status-location-btn,
body.app-shell.light-theme-lock [class*='page-report'] .longstop-location-btn,
body.app-shell.light-theme-lock [class*='page-report'] #status-location-btn {
    background: transparent !important;
    color: #0284c7 !important;
}

/* 2026 light shell: a quiet navigation rail that belongs to the content theme. */
body.app-shell.light-theme-lock .sidebar {
    background: #f8fbff !important;
    color: #0f172a !important;
    border-right: 1px solid #dbeafe !important;
    box-shadow: none !important;
}

body.app-shell.light-theme-lock .sidebar-menu {
    padding: 10px 9px 18px !important;
    scrollbar-color: #bfdbfe transparent;
}

body.app-shell.light-theme-lock .sidebar-menu::-webkit-scrollbar-thumb {
    background: #bfdbfe !important;
}

body.app-shell.light-theme-lock .sidebar-menu a,
body.app-shell.light-theme-lock .sidebar-menu button.sidebar-action {
    min-height: 40px;
    margin: 2px 0 !important;
    padding: 9px 13px;
    color: #334155 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    transform: none !important;
    font-size: 0.86rem;
    font-weight: 550;
}

body.app-shell.light-theme-lock .sidebar-menu a i,
body.app-shell.light-theme-lock .sidebar-menu button.sidebar-action i {
    color: #0284c7 !important;
    opacity: 0.9;
    transform: none !important;
}

body.app-shell.light-theme-lock .sidebar-menu a:hover,
body.app-shell.light-theme-lock .sidebar-menu button.sidebar-action:hover {
    color: #075985 !important;
    background: #eff6ff !important;
    border-color: #dbeafe !important;
    box-shadow: none !important;
    transform: none !important;
}

body.app-shell.light-theme-lock .sidebar-menu a.active {
    color: #075985 !important;
    background: #e0f2fe !important;
    border-color: #bae6fd !important;
    box-shadow: inset 3px 0 0 #0284c7 !important;
    font-weight: 700;
}

body.app-shell.light-theme-lock .sidebar-menu a.active i {
    color: #0284c7 !important;
    opacity: 1;
    transform: none !important;
}

body.app-shell.light-theme-lock .sidebar-menu a.is-navigating {
    color: #075985 !important;
    background: #dbeafe !important;
}

body.app-shell.light-theme-lock .menu-category {
    padding: 15px 13px 5px;
    color: #64748b !important;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.09em;
}

body.app-shell.light-theme-lock .sidebar.collapsed {
    width: 64px;
}

body.app-shell.light-theme-lock .sidebar.collapsed .sidebar-menu a,
body.app-shell.light-theme-lock .sidebar.collapsed .sidebar-menu button.sidebar-action {
    width: 44px;
    min-height: 42px;
    margin: 3px auto !important;
    padding: 9px 0;
    justify-content: center;
}

/* Dashboard surfaces share one flat, low-noise visual hierarchy. */
body.app-shell.light-theme-lock.page-home .admin-dashboard-container {
    background: #f4f8fd !important;
}

body.app-shell.light-theme-lock.page-home .command-health-grid,
body.app-shell.light-theme-lock.page-home .primary-kpi-rail,
body.app-shell.light-theme-lock.page-home .operations-ribbon,
body.app-shell.light-theme-lock.page-home .analytics-workspace .dashboard-analytics-grid,
body.app-shell.light-theme-lock.page-home .operations-rail {
    background: #ffffff !important;
    border-color: #dbeafe !important;
    box-shadow: none !important;
}

body.app-shell.light-theme-lock.page-home .section-header {
    background: #f8fbff !important;
    border-color: #dbeafe !important;
}

body.app-shell.light-theme-lock.page-home .command-health-icon,
body.app-shell.light-theme-lock.page-home .primary-kpi-rail .metric-icon {
    background: #eff6ff !important;
    color: #0369a1 !important;
    box-shadow: none !important;
}

@media (max-width: 767px) {
    body.app-shell.light-theme-lock .sidebar,
    body.app-shell.light-theme-lock .sidebar.mobile-open {
        width: min(286px, 86vw) !important;
        background: #f8fbff !important;
        box-shadow: 18px 0 44px rgba(15, 23, 42, 0.16) !important;
    }

    body.app-shell.light-theme-lock .sidebar .sidebar-menu a,
    body.app-shell.light-theme-lock .sidebar .sidebar-menu button.sidebar-action {
        width: 100%;
        min-height: 44px;
        margin: 2px 0 !important;
        padding: 10px 14px;
        justify-content: flex-start;
    }
}

/* Topbar icon/readability polish for light-lock shell. */
body.app-shell.light-theme-lock .main-header .topbar-notification,
body.app-shell.light-theme-lock .main-header .logout-btn,
body.app-shell.light-theme-lock .main-header .hamburger-btn,
body.app-shell.light-theme-lock .main-header .status-summary-btn {
    box-shadow: none !important;
    transform: none !important;
}

body.app-shell.light-theme-lock .topbar-notification .fa-bell,
body.app-shell.light-theme-lock .main-header .fa-solid,
body.app-shell.light-theme-lock .main-header .fa-regular,
body.app-shell.light-theme-lock .main-header .logout-btn i,
body.app-shell.light-theme-lock .main-header .hamburger-btn i {
    color: currentColor !important;
    opacity: 1 !important;
}

body.app-shell.light-theme-lock .topbar-notification-wrap {
    position: relative !important;
}
