:root {
    --primary: #0d6efd;
    --success: #198754;
    --info: #0dcaf0;
    --warning: #ffc107;
    --bg: #f5f7fa;
    --sidebar-width: 380px;
    --nav-height: 56px;
}
body { background: var(--bg); font-size: 14px; overflow-x: hidden; }
.navbar-brand { font-weight: 600; letter-spacing: 0.5px; }
.page-content { max-width: 1400px; margin: 0 auto; padding: 0 12px; }

/* ===== Navbar responsive ===== */
.navbar-nav { flex-wrap: wrap; }
.navbar-nav .nav-link { padding: 0.5rem 0.75rem; white-space: nowrap; }
.navbar-collapse { max-height: calc(100vh - var(--nav-height)); overflow-y: auto; }
@media (max-width: 992px) {
    .navbar-nav { flex-direction: row; flex-wrap: wrap; gap: 0; }
    .navbar-nav .nav-item { flex-shrink: 0; }
}

/* Stat cards */
.stat-card { border: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-card .card-body { display: flex; align-items: center; position: relative; }
.stat-icon { font-size: 2.5rem; opacity: 0.3; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; opacity: 0.9; }

/* Charts */
.bar-row { display: flex; align-items: center; margin-bottom: 6px; }
.bar-label { width: 100px; text-align: right; padding-right: 10px; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: #e9ecef; border-radius: 4px; height: 24px; position: relative; }
.bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; color: white; font-size: 0.75rem; font-weight: 600; transition: width 0.5s; min-width: 2px; }

/* Coverage bars */
.coverage-item { margin-bottom: 10px; }
.coverage-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 3px; }
.coverage-track { background: #e9ecef; border-radius: 4px; height: 8px; }
.coverage-fill { height: 100%; border-radius: 4px; }

/* Table */
.table { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.table th { white-space: nowrap; font-size: 0.8rem; }
.table td { font-size: 0.85rem; }
.station-link { color: var(--primary); cursor: pointer; font-weight: 500; text-decoration: none; }
.station-link:hover { text-decoration: underline; }

/* Pagination */
.pagination { justify-content: center; }

/* Detail modal */
.modal-xl { max-width: 1100px; }
.detail-tabs { border-bottom: 2px solid #dee2e6; margin-bottom: 15px; }
.detail-tab { padding: 8px 16px; cursor: pointer; border: none; background: none; font-size: 0.9rem; color: #6c757d; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.detail-tab:hover { color: var(--primary); }
.detail-section { display: none; }
.detail-section.active { display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
.detail-parallel { display: flex; gap: 20px; align-items: flex-start; }
.detail-parallel-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 768px) { .detail-parallel { flex-direction: column; gap: 16px; } }
.detail-item { display: flex; border-bottom: 1px solid #f0f0f0; padding: 4px 0; }
.detail-label { width: 120px; color: #6c757d; font-size: 0.8rem; flex-shrink: 0; }
.detail-value { font-size: 0.85rem; font-weight: 500; word-break: break-all; }
.detail-table { width: 100%; font-size: 0.8rem; }
.detail-table th { background: #f8f9fa; }

/* Photo gallery */
.photo-card { position: relative; overflow: hidden; border-radius: 8px; cursor: pointer; aspect-ratio: 1; background: #f0f0f0; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.photo-card:hover img { transform: scale(1.08); }
.photo-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: white; padding: 20px 8px 6px; font-size: 0.7rem; }
.photo-badge { position: absolute; top: 4px; left: 4px; }

/* Lightbox */
.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 9999; justify-content: center; align-items: center; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.lightbox-close { position: absolute; top: 15px; right: 25px; color: white; font-size: 2.5rem; cursor: pointer; }

/* Loading */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); z-index: 9998; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.loading-overlay .spinner-border { width: 3rem; height: 3rem; }

/* Badge colors */
.badge-勘察 { background: #0d6efd; }
.badge-设计 { background: #6f42c1; }
.badge-并网 { background: #198754; }
.badge-工程 { background: #fd7e14; }
.badge-档案 { background: #6c757d; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1050; overflow: auto; background: rgba(0,0,0,0.5); padding: 20px; }
.modal.show { display: block !important; }
.modal-dialog { max-width: 1100px; margin: 20px auto; }
.modal-content { border: none; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
@media (max-width: 768px) {
    .modal { padding: 0; }
    .modal-dialog { margin: 0; max-width: 100%; }
    .modal-content { border-radius: 0; min-height: 100vh; }
    .modal-dialog-scrollable .modal-body { max-height: calc(100vh - 120px); }
    .modal-header, .modal-footer { padding: 0.5rem 0.75rem; }
}

/* ===== Loading skeleton ===== */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeletonShimmer 1.5s infinite; border-radius: 4px; }
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-row { height: 32px; margin-bottom: 8px; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: #adb5bd; }
.empty-state i { font-size: 3rem; }
.empty-state p { margin-top: 0.5rem; font-size: 0.9rem; }

/* ===== Page transition animation ===== */
.page-content { animation: pageFadeIn 0.2s ease; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Operations page collapsible cards ===== */
.ops-card-toggle { cursor: pointer; user-select: none; transition: filter 0.15s; }
.ops-card-toggle:hover { filter: brightness(1.08); }
.ops-card-toggle:active { filter: brightness(0.95); }
.ops-chevron { transition: transform 0.25s ease; font-size: 0.9rem; margin-top: 2px; }
.ops-card-toggle .bi-chevron-down { transform: rotate(0deg); }
.ops-card-toggle .bi-chevron-up { transform: rotate(0deg); }

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.3rem; }
    .stat-icon { font-size: 2rem; }
    .page-content { padding: 0 8px; }
    .table { font-size: 0.78rem; }
    .table th, .table td { padding: 0.3rem 0.4rem; }
    .btn-sm { padding: 0.2rem 0.5rem; font-size: 0.78rem; }
}

/* ===== Work Order Styles ===== */
.detail-grid-edit { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
@media (max-width: 768px) { .detail-grid-edit { grid-template-columns: 1fr; } }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: #dee2e6; }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-dot { position: absolute; left: -24px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #dee2e6; z-index: 1; }
.timeline-content { background: #f8f9fa; border-radius: 8px; padding: 8px 12px; }

/* WO badges */
.wo-priority-urgent { color: #dc3545; }
.wo-priority-high { color: #fd7e14; }

/* Edit form highlight */
.detail-grid-edit input:focus, .detail-grid-edit textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

/* Modal scroll fix */
.modal-dialog-scrollable .modal-body { max-height: calc(100vh - 200px); overflow-y: auto; }

/* Toast */
.toast-container { z-index: 11000; }

/* ===== Operations Page Styles ===== */
.ops-section { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Video in lightbox */
#lightbox video { border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

/* Video thumbnail in forms */
video.img-thumbnail { object-fit: cover; background: #000; }

/* Role badge in nav */
.navbar .badge { font-size: 0.75rem; }

/* Operations section headers */
.ops-section .card-header { font-weight: 600; }

/* Media preview grid */
#inspMediaPreview video { background: #000; }

/* ===== Report Center Styles ===== */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 15px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-bar .tab-item { padding: 10px 24px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 500; color: #666; transition: all 0.2s; white-space: nowrap; flex-shrink: 0; }
.tab-bar .tab-item:hover { color: #0d6efd; }
.tab-bar .tab-item.active { color: #0d6efd; border-bottom-color: #0d6efd; }
@media (max-width: 576px) {
    .tab-bar .tab-item { padding: 8px 14px; font-size: 0.85rem; }
}

.rc-upload-area { border: 2px dashed #adb5bd; border-radius: 10px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.2s; }
.rc-upload-area:hover { border-color: #0d6efd; background: #f0f6ff; }
.rc-upload-area.dragover { border-color: #198754; background: #e8f5e9; }

.rc-tab-content { animation: fadeIn 0.3s ease; }

/* Performance metric cards */
.metric-card { transition: box-shadow 0.2s; }
.metric-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

#rcChart { max-height: 320px; }

/* Report center stat cards */
#page-report-center .card-body { padding: 0.75rem 1rem; }

/* Stats table compact */
#rcStatsTable { font-size: 0.875rem; }
#rcStatsTable th { background: #f8f9fa; }

/* ===== Dashboard Map & Charts ===== */
.donut-ring { width: 140px; height: 140px; position: relative; display: inline-block; }
.donut-ring canvas { width: 100% !important; height: 100% !important; }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.donut-num { font-size: 1.8rem; font-weight: 700; line-height: 1; color: #333; }
.donut-label { font-size: 0.75rem; color: #888; margin-top: 2px; }

.donut-legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 0.82rem; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-num { margin-left: auto; font-weight: 600; }

/* Weather cards */
.weather-province-card { border: 1px solid #e0e0e0; border-radius: 10px; padding: 10px 12px; text-align: center; transition: all 0.2s; background: #fff; }
.weather-province-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.weather-province-name { font-size: 0.85rem; font-weight: 600; color: #555; }
.weather-province-icon { font-size: 2rem; margin: 4px 0; }
.weather-province-temp { font-size: 1.3rem; font-weight: 700; }
.weather-province-desc { font-size: 0.72rem; color: #888; }
.weather-province-extra { font-size: 0.7rem; color: #aaa; margin-top: 2px; }

/* Map tooltip */
.china-map-tooltip { max-height: 300px; overflow-y: auto; }
.china-map-tooltip .tooltip-city-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 0.8rem; }
.china-map-tooltip .tooltip-city-name { color: #8ab4d9; }
.china-map-tooltip .tooltip-city-count { font-weight: 600; color: #00d4ff; }

/* Dashboard map tooltip dark background already set via ECharts options */

/* ===== Comprehensive Query (综合查询) ===== */
.cq-field-group { border: 1px solid #e0e0e0; border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.cq-field-group-title { font-weight: 600; color: #0d6efd; margin-bottom: 8px; font-size: 0.9rem; border-bottom: 1px dashed #e0e0e0; padding-bottom: 6px; }
.cq-field-group-title .bi { margin-right: 4px; }
.cq-field-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
@media (max-width: 768px) { .cq-field-cols { grid-template-columns: 1fr; } }
.cq-field-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 0.85rem; cursor: pointer; }
.cq-field-item:hover { color: #0d6efd; }
.cq-field-item input[type="checkbox"] { cursor: pointer; }
.cq-field-name { flex: 1; }
.cq-field-key { font-size: 0.7rem; color: #999; margin-left: 4px; }

#cqTable thead th { white-space: nowrap; position: sticky; top: 0; background: #f8f9fa; z-index: 2; font-size: 0.8rem; }
#cqTable tbody td { font-size: 0.82rem; vertical-align: middle; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cqTable tbody tr:hover { background: #f0f8ff !important; }
.cq-tag-pill { display: inline-block; background: #e7f1ff; color: #0d6efd; border: 1px solid #b6d4fe; border-radius: 10px; padding: 1px 8px; font-size: 0.7rem; margin: 1px; }
.cq-tag-pill.muted { background: #f1f3f5; color: #6c757d; border-color: #dee2e6; }
.cq-tag-empty { color: #999; font-style: italic; font-size: 0.78rem; }
.cq-perm-banner { background: #fff3cd; border: 1px solid #ffe69c; border-radius: 6px; padding: 6px 12px; font-size: 0.85rem; color: #856404; margin-bottom: 10px; }
.cq-perm-banner .bi { margin-right: 4px; }

/* ===== Floating draggable CF modal (over station detail) ===== */
.modal.cf-floating {
    background: transparent !important;
    z-index: 1070;
    padding: 0 !important;
    pointer-events: none;
    overflow: visible;
}
.modal.cf-floating .modal-dialog {
    pointer-events: auto;
    position: fixed !important;
    top: 60px;
    left: auto;
    right: 30px;
    margin: 0;
    max-width: 600px;
    width: 600px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
    animation: cfFloatIn 0.2s ease-out;
}
.modal.cf-floating .modal-header {
    cursor: move;
    user-select: none;
}
.modal.cf-floating .modal-header:active {
    cursor: grabbing;
}
@keyframes cfFloatIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Wide detail modal with sidebar layout ===== */
.detail-dialog-wide {
    max-width: 95vw !important;
}
.detail-layout {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0 !important;
    height: calc(100vh - 140px);
    max-height: 750px;
    min-height: 500px;
}
.detail-main {
    flex: 1 1 65%;
    min-width: 0;
    padding: 16px 20px;
    overflow-y: auto;
}
.detail-sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    border-left: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.detail-sidebar.hidden {
    display: none;
}

/* ===== Mobile: stack sidebar below main ===== */
@media (max-width: 992px) {
    .detail-layout {
        flex-direction: column;
        height: auto;
        max-height: none;
        min-height: auto;
    }
    .detail-main {
        flex: 1 1 auto;
        max-height: 60vh;
        padding: 12px 14px;
    }
    .detail-sidebar {
        flex: 0 0 auto;
        width: 100%;
        border-left: none;
        border-top: 1px solid #dee2e6;
        max-height: 40vh;
    }
    .detail-dialog-wide {
        max-width: 100vw !important;
    }
}
@media (max-width: 576px) {
    .detail-main { max-height: 55vh; padding: 10px; }
    .detail-sidebar { max-height: 45vh; }
    .detail-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .detail-tab { padding: 6px 10px; font-size: 0.82rem; white-space: nowrap; }
}
.detail-sidebar .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}
.detail-sidebar .sidebar-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #343a40;
}
.detail-sidebar .sidebar-close {
    font-size: 1rem;
    padding: 0 6px;
    line-height: 1.3;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
}
.detail-sidebar .sidebar-close:hover {
    color: #dc3545;
}
#sidebarContent {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 10px 14px;
}
#sidebarContent::-webkit-scrollbar { width: 4px; }
#sidebarContent::-webkit-scrollbar-thumb { background: #c1c9d0; border-radius: 4px; }

/* Sidebar type tabs */
.sidebar-type-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
    flex-shrink: 0;
    overflow-x: auto;
}
.sidebar-tab {
    padding: 6px 10px;
    border: none;
    background: none;
    font-size: 0.75rem;
    color: #6c757d;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.sidebar-tab:hover { color: #0d6efd; }
.sidebar-tab.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    font-weight: 600;
}

/* Sidebar record cards (shared across CF/Fault/Inspection/Dispatch) */
.sidebar-record-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    transition: box-shadow 0.15s;
    cursor: pointer;
}
.sidebar-record-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-color: #b6d4fe;
}
.sidebar-record-card .rec-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 4px;
    flex-wrap: wrap;
}
.sidebar-record-card .rec-detail {
    color: #495057;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 3px;
}
.sidebar-record-card .rec-footer {
    font-size: 0.72rem;
    color: #868e96;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.sidebar-record-card .rec-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
}

/* Sidebar form styles (shared) */
.sidebar-record-form .form-label {
    font-size: 0.78rem;
    margin-bottom: 2px;
    font-weight: 500;
}
.sidebar-record-form .form-control,
.sidebar-record-form .form-select {
    font-size: 0.8rem;
    padding: 5px 8px;
    border-radius: 4px;
}
.sidebar-record-form textarea.form-control {
    font-size: 0.8rem;
    padding: 5px 8px;
}
.sidebar-record-form .row { --bs-gutter-y: 0.4rem; }
.sidebar-record-form .btn { font-size: 0.78rem; }

/* Sidebar action bar */
.sidebar-action-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* ===== Call feedback records embedded in station detail (tab view) ===== */
.cf-detail-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 4px;
}
.cf-detail-card {
    background: #fff;
    font-size: 0.85rem;
    transition: box-shadow 0.15s;
}
.cf-detail-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.cf-detail-card strong {
    color: #495057;
    font-weight: 600;
}

/* ===== Work Order Management (天枢风格) ===== */
.wo-search-card { border-radius: 8px; border: none; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.wo-search-row .form-control, .wo-search-row .form-select { border-radius: 4px; }
.wo-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wo-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    background: #fff;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s;
}
.wo-cat-btn:hover { background: #f8f9fa; border-color: #dee2e6; }
.wo-cat-btn.active { background: #e6f9f3; border-color: #20c997; color: #0d6efd; font-weight: 600; }
.wo-cat-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background: #f1f3f5;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #6c757d;
}
.wo-cat-btn.active .wo-cat-count { background: #20c997; color: #fff; }
.wo-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wo-status-item {
    flex: 1 1 auto;
    min-width: 90px;
    text-align: center;
    padding: 8px;
    border-right: 1px solid #f0f0f0;
}
.wo-status-item:last-child { border-right: none; }
.wo-status-value { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.wo-status-label { font-size: 0.75rem; color: #6c757d; margin-top: 4px; }
.wo-table-wrap { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); padding: 0 12px; }
.wo-table thead th { background: #f8f9fa; font-weight: 600; font-size: 0.8rem; color: #495057; border-bottom: 2px solid #e9ecef; }
.wo-table tbody td { font-size: 0.85rem; vertical-align: middle; }
.wo-warn-badge { font-size: 0.75rem; }

/* ===== Work Order Import Drop Zone ===== */
.wo-import-dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #f8f9fa;
}
.wo-import-dropzone:hover {
    border-color: #198754;
    background: #e8f5e9;
}
.wo-import-dropzone.dragover {
    border-color: #198754;
    background: #d4edda;
    transform: scale(1.01);
}
.wo-import-dropzone-inner { pointer-events: none; }
.wo-import-preview {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}
.wo-import-preview table {
    width: 100%;
    font-size: 0.8rem;
    margin: 0;
}
.wo-import-preview thead th {
    background: #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}
.wo-import-preview tbody td {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wo-import-img-preview {
    max-width: 100%;
    max-height: 350px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.wo-import-map-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.wo-import-map-row select {
    max-width: 200px;
}
.wo-import-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== Work Order Progress Bar ===== */
.wo-progress { display: flex; justify-content: space-between; position: relative; margin: 20px 0; }
.wo-progress::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 5%;
    right: 5%;
    height: 3px;
    background: #e9ecef;
    z-index: 0;
}
.wo-step { position: relative; z-index: 1; text-align: center; flex: 1; }
.wo-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    color: #adb5bd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.wo-step.done .wo-step-icon { background: #20c997; color: #fff; }
.wo-step.active .wo-step-icon { background: #0d6efd; color: #fff; box-shadow: 0 0 0 3px rgba(13,110,253,0.15); }
.wo-step-label { font-size: 0.75rem; color: #6c757d; }
.wo-step-time { font-size: 0.7rem; color: #adb5bd; margin-top: 2px; }

@media (max-width: 768px) {
    .wo-category-tabs { gap: 6px; }
    .wo-cat-btn { padding: 5px 10px; font-size: 0.8rem; }
    .wo-status-item { min-width: 70px; padding: 6px 4px; }
    .wo-status-value { font-size: 1.1rem; }
    .wo-step-label { font-size: 0.65rem; }
}

/* ===== Mobile responsive filter bars ===== */
@media (max-width: 768px) {
    /* Filter rows: stack on mobile */
    #page-workorders .row.g-2.align-items-end > div,
    #page-operations .row.g-2 > div,
    #page-special-maintenance .row.g-2.align-items-end > div,
    #page-report-center .row.g-2 > div {
        margin-bottom: 0.4rem;
    }
    /* Donut ring smaller on mobile */
    .donut-ring { width: 110px; height: 110px; }
    .donut-num { font-size: 1.4rem; }
    /* Weather cards: 2 per row on mobile */
    .weather-province-card { padding: 6px 8px; }
    .weather-province-icon { font-size: 1.5rem; }
    .weather-province-temp { font-size: 1.1rem; }
    /* China map height */
    #chinaMap { height: 350px !important; }
    /* Floating CF modal: full width on mobile */
    .modal.cf-floating .modal-dialog {
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        top: auto !important;
        bottom: 0 !important;
    }
    /* Report center stat cards */
    #page-report-center .card-body { padding: 0.5rem 0.75rem; }
    /* Pagination: compact */
    .pagination .page-link { padding: 0.3rem 0.6rem; }
    /* Toast: full width on mobile */
    .toast-container { left: 0; right: 0; }
    .toast-container .toast { min-width: auto; }
}

/* ===== Touch-friendly improvements ===== */
@media (max-width: 992px) {
    .station-link, .btn-sm, .nav-link { min-height: 36px; }
    .form-control, .form-select { min-height: 38px; }
    .sidebar-tab { padding: 8px 12px; font-size: 0.8rem; }
}

/* ===== Smooth scrollbar ===== */
.table-responsive { -webkit-overflow-scrolling: touch; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c9d0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a9b0; }

/* ===== Card improvements ===== */
.card { border: none; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border-radius: 10px; }
.card-header { border-radius: 10px 10px 0 0 !important; font-weight: 600; }

/* ===== Badge sizing ===== */
.badge { font-size: 0.72rem; padding: 0.3em 0.6em; }

/* ===== Search input with icon ===== */
.input-group .form-control:focus { box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15); }

/* =========================================================
   Operations Dashboard (dark large-screen style)
   ========================================================= */
.ops-dashboard-page {
    background: linear-gradient(180deg, #030b1e 0%, #061536 100%);
    min-height: 100vh;
    padding: 0;
    color: #c8d6f0;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
.ops-dashboard-page #app { padding-top: 0; }

.ops-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    color: #6fa8dc;
}
.ops-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(111, 168, 220, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: opsSpin 1s linear infinite;
}
@keyframes opsSpin { to { transform: rotate(360deg); } }

/* Cloud sync button spin animation */
.bi.spin {
    animation: opsSpin 0.8s linear infinite;
    display: inline-block;
}
#cloudSyncBtn .sync-label {
    font-size: 0.75rem;
}

/* Header */
.ops-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(90deg, rgba(0,150,255,0.08) 0%, rgba(0,212,255,0.15) 50%, rgba(0,150,255,0.08) 100%);
    border-bottom: 1px solid rgba(0, 212, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.15);
}
.ops-header-left, .ops-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}
.ops-header-right { justify-content: flex-end; }
.ops-header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
}
.ops-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(0, 150, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
}
.ops-btn-text {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: #00d4ff;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
}
.ops-btn-text:hover { background: rgba(0, 212, 255, 0.3); }
.ops-weather { color: #a8d0ff; font-size: 0.9rem; }
.ops-fullscreen {
    color: #00d4ff;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
}
.ops-fullscreen:hover { color: #fff; }

/* Grid */
.ops-grid {
    display: grid;
    grid-template-columns: 1.05fr 1.9fr 1.05fr;
    gap: 14px;
    padding: 14px 16px 0;
}
.ops-col { display: flex; flex-direction: column; gap: 14px; }
.ops-col-center { min-height: 520px; }

/* Panel */
.ops-panel {
    background: linear-gradient(135deg, rgba(8, 28, 68, 0.9) 0%, rgba(5, 18, 45, 0.95) 100%);
    border: 1px solid rgba(0, 150, 255, 0.22);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 0 14px rgba(0, 100, 200, 0.12), inset 0 0 20px rgba(0, 100, 200, 0.04);
    position: relative;
    overflow: hidden;
}
.ops-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00d4ff, transparent);
    opacity: 0.7;
}
.ops-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding-left: 8px;
    border-left: 3px solid #00d4ff;
}
.ops-panel-header i { color: #00d4ff; font-size: 1rem; }

/* Gauges */
.ops-gauge-row { display: flex; justify-content: space-around; gap: 8px; }
.ops-gauge { width: 100%; height: 120px; }

/* KPI list */
.ops-kpi-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ops-kpi-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(0, 100, 200, 0.1);
    border-radius: 6px;
    border-left: 2px solid #0096ff;
}
.ops-kpi-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 150, 255, 0.15);
    border-radius: 6px;
    color: #00d4ff;
    font-size: 1rem;
}
.ops-kpi-info { flex: 1; }
.ops-kpi-label { font-size: 0.78rem; color: #8ab4d9; }
.ops-kpi-value { font-size: 1.15rem; font-weight: 700; color: #00d4ff; }
.ops-kpi-value span { font-size: 0.7rem; color: #6fa8dc; margin-left: 2px; }

/* Donut charts */
.ops-donut-chart { width: 100%; height: 170px; }
.ops-donut-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    font-size: 0.75rem;
    margin-top: -10px;
}
.ops-donut-legend-item { display: flex; align-items: center; gap: 5px; }
.ops-donut-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Map panel */
.ops-map-panel { height: 100%; min-height: 520px; display: flex; flex-direction: column; padding: 8px; }
.ops-map { flex: 1; width: 100%; min-height: 480px; }
.ops-map-info {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    background: rgba(4, 18, 45, 0.92);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 8px;
    padding: 14px;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.25);
    z-index: 10;
}
.ops-map-info-title {
    text-align: center;
    color: #00d4ff;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}
.ops-map-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    text-align: center;
}
.ops-map-info-label { display: block; font-size: 0.68rem; color: #8ab4d9; }
.ops-map-info-value { display: block; font-size: 1rem; font-weight: 700; color: #fff; margin-top: 2px; }

/* Progress rings */
.ops-progress-row { display: flex; justify-content: space-around; gap: 6px; }
.ops-progress-ring { width: 100%; height: 110px; }

/* Time donut */
.ops-time-donut-wrap { display: flex; align-items: center; gap: 10px; }
.ops-time-donut { width: 55%; height: 150px; }
.ops-time-legend { flex: 1; font-size: 0.72rem; display: flex; flex-direction: column; gap: 5px; }
.ops-time-legend-item { display: flex; align-items: center; gap: 5px; }
.ops-time-legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* Bar chart */
.ops-bar-chart { width: 100%; height: 180px; }

/* Alert table */
.ops-alert-panel { margin: 14px 16px; }
.ops-wo-warn-panel { margin: 14px 16px; }
.ops-wo-warn-panel .ops-table-wrap { max-height: 240px; }
.ops-table-wrap { max-height: 200px; overflow-y: auto; }
.ops-table {
    width: 100%;
    color: #c8d6f0;
    font-size: 0.82rem;
    border-collapse: collapse;
}
.ops-table thead { position: sticky; top: 0; z-index: 2; }
.ops-table th {
    background: rgba(0, 100, 180, 0.35);
    color: #a8d0ff;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 150, 255, 0.25);
}
.ops-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ops-table tbody tr:hover { background: rgba(0, 150, 255, 0.08); }
.ops-alert-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
    border: 1px solid rgba(255, 170, 0, 0.3);
    font-size: 0.72rem;
}
.ops-alert-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255, 70, 70, 0.15);
    color: #ff5e5e;
    border: 1px solid rgba(255, 70, 70, 0.3);
    font-size: 0.72rem;
}

/* Dark dashboard badge overrides for assessment warnings */
.ops-wo-warn-panel .badge { font-size: 0.7rem; padding: 3px 7px; border: none; }
.ops-wo-warn-panel .badge.bg-danger { background: rgba(255, 70, 70, 0.25) !important; color: #ff6b6b; }
.ops-wo-warn-panel .badge.bg-warning { background: rgba(255, 200, 0, 0.25) !important; color: #ffd43b; }
.ops-wo-warn-panel .badge.bg-success { background: rgba(80, 200, 100, 0.25) !important; color: #51cf66; }
.ops-wo-warn-panel .badge.bg-secondary { background: rgba(150, 150, 150, 0.25) !important; color: #adb5bd; }

/* Scrollbar dark */
.ops-dashboard-page ::-webkit-scrollbar { width: 5px; height: 5px; }
.ops-dashboard-page ::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.ops-dashboard-page ::-webkit-scrollbar-thumb { background: rgba(0, 150, 255, 0.35); border-radius: 3px; }
.ops-dashboard-page ::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.5); }

/* Responsive */
@media (max-width: 1200px) {
    .ops-grid { grid-template-columns: 1fr; }
    .ops-col-center { min-height: 420px; }
    .ops-map { min-height: 400px; }
    .ops-map-info { width: 220px; padding: 10px; }
    .ops-header-title { position: static; transform: none; font-size: 1.3rem; }
    .ops-header { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 768px) {
    .ops-header { padding: 10px; flex-direction: column; align-items: stretch; }
    .ops-header-left, .ops-header-right { justify-content: center; flex: none; }
    .ops-header-title { font-size: 1.1rem; letter-spacing: 2px; margin: 8px 0; }
    .ops-grid { padding: 10px; gap: 10px; }
    .ops-map-info { display: none; }
    .ops-progress-row { flex-wrap: wrap; }
    .ops-progress-ring { height: 100px; }
}

/* Fullscreen helper */
.ops-dashboard-page:fullscreen {
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
}
.ops-dashboard-page:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
}

/* Hide normal nav on dashboard (optional visual polish) */
.ops-dashboard-page ~ nav.navbar,
.ops-dashboard-page ~ .navbar { border-bottom-color: rgba(0,150,255,0.2); }

/* Override app container background when dashboard active */
body:has(#page-dashboard:not([style*="display: none"])) {
    background: #030b1e;
}

