* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background-color: #E8F4F8; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== Header ===== */
.header { background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%); color: white; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.header h1 { font-size: 20px; font-weight: 600; }
.header-right span { font-size: 14px; opacity: 0.9; }

/* ===== Container & Sidebar ===== */
.container { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 220px; background-color: #1F4E79; color: white; padding: 16px 0; overflow-y: auto; flex-shrink: 0; }
.sidebar-title { font-size: 18px; font-weight: 600; padding: 14px 20px; color: #7eb8ea; border-bottom: 1px solid #2d5a82; margin-bottom: 8px; }
.nav-item { padding: 14px 24px; cursor: pointer; transition: all 0.3s ease; font-size: 16px; }
.nav-item:hover { background-color: #2E75B6; }
.nav-item.active { background-color: #2E75B6; border-left: 4px solid #4facfe; }

/* ===== Main Content ===== */
.main-content { flex: 1; padding: 20px; overflow-y: auto; background-color: #E8F4F8; }
.page { display: block; }

/* ===== Page Header ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-title { font-size: 22px; font-weight: 700; color: #1F4E79; position: relative; padding-left: 14px; }
.page-title::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 5px; height: 22px; background: #2E75B6; border-radius: 3px; }
.filter-status { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #4b5563; background: white; padding: 8px 16px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.btn-refresh { background: none; border: 1px solid #d1d5db; border-radius: 4px; cursor: pointer; font-size: 16px; padding: 2px 8px; transition: all 0.3s; }
.btn-refresh:hover { background: #E8F4F8; border-color: #2E75B6; }

/* ===== Stats Cards ===== */
.stats-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: white; padding: 18px 20px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 16px; border-left: 4px solid #2E75B6; }
.stat-card-1 { border-left-color: #2E75B6; }
.stat-card-2 { border-left-color: #10b981; }
.stat-card-3 { border-left-color: #f59e0b; }
.stat-card-4 { border-left-color: #8b5cf6; }
.stat-icon { font-size: 36px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: #E8F4F8; border-radius: 10px; }
.stat-body { flex: 1; }
.stat-card .label { font-size: 14px; color: #6b7280; margin-bottom: 4px; }
.stat-card .value { font-size: 30px; font-weight: 700; color: #1F4E79; line-height: 1.2; }
.stat-card .value .unit { font-size: 14px; font-weight: 500; color: #6b7280; margin-left: 4px; }
.stat-card .sub { font-size: 12px; color: #9ca3af; margin-top: 4px; }

/* ===== Filter Bar ===== */
.filter-bar { background: white; padding: 16px 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px; }
.filter-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.filter-row + .filter-row { margin-top: 12px; }
.search-box { flex: 1; min-width: 280px; position: relative; }
.search-box input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; transition: border-color 0.3s; }
.search-box input:focus { outline: none; border-color: #2E75B6; box-shadow: 0 0 0 2px rgba(46,117,182,0.15); }
.search-box::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; }
.filter-item { display: flex; align-items: center; gap: 6px; }
.filter-item label { font-size: 13px; color: #4b5563; white-space: nowrap; font-weight: 500; }
.filter-item select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; color: #374151; background: white; cursor: pointer; }
.filter-item select:focus { outline: none; border-color: #2E75B6; }

/* ===== Buttons ===== */
.btn { padding: 8px 18px; border-radius: 4px; font-size: 14px; cursor: pointer; border: none; transition: all 0.3s; white-space: nowrap; font-weight: 500; }
.btn-primary { background-color: #2E75B6; color: white; }
.btn-primary:hover { background-color: #1F4E79; }
.btn-secondary { background-color: white; color: #4b5563; border: 1px solid #d1d5db; }
.btn-secondary:hover { background-color: #f0f4f8; border-color: #2E75B6; }

/* ===== Device Tab Bar (充电设备/换电设备 大Tab) ===== */
.device-tab-bar { display: flex; gap: 0; margin-bottom: 16px; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 1px solid #2E75B6; }
.device-tab-item { flex: 1; padding: 16px 32px; cursor: pointer; font-size: 16px; color: #6b7280; border-right: 1px solid #d1d5db; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; background: #f0f4f8; }
.device-tab-item:last-child { border-right: none; }
.device-tab-item:hover { color: #2E75B6; background: #e8f0fa; }
.device-tab-item.active { color: white; background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%); font-weight: 700; font-size: 17px; border-bottom: none; }
.device-tab-icon { font-size: 20px; }

/* ===== Old Tab Bar (deprecated, kept for compatibility) ===== */
.tab-bar { display: flex; gap: 0; margin-bottom: 0; background: white; border-radius: 8px 8px 0 0; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.tab-item { padding: 12px 28px; cursor: pointer; font-size: 14px; color: #6b7280; border-bottom: 3px solid transparent; transition: all 0.3s; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.tab-item:hover { color: #2E75B6; background: #E8F4F8; }
.tab-item.active { color: #1F4E79; border-bottom-color: #2E75B6; background: #E8F4F8; font-weight: 600; }
.tab-count { font-size: 12px; background: #e5e7eb; color: #6b7280; padding: 2px 8px; border-radius: 10px; }
.tab-item.active .tab-count { background: #2E75B6; color: white; }

/* ===== Panel ===== */
.panel { background: white; border-radius: 0 0 8px 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 0; }

/* ===== Table Container ===== */
.table-container { overflow-x: auto; overflow-y: visible; max-height: calc(100vh - 420px); min-height: 300px; }

/* ===== Data Table ===== */
.cp-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1400px; }
.cp-table th, .cp-table td { padding: 12px 12px; text-align: left; border-bottom: 1px solid #e5e7eb; white-space: nowrap; height: 48px; }
.cp-table thead th { background-color: #1F4E79; color: white; font-weight: 600; position: sticky; top: 0; z-index: 10; white-space: nowrap; font-size: 13px; }
.cp-table thead th.sortable { cursor: pointer; user-select: none; }
.cp-table thead th.sortable:hover { background-color: #2E75B6; }
.sort-icon { font-size: 11px; opacity: 0.5; }
.sort-icon.asc::after { content: ' ▲'; opacity: 1; color: #4facfe; }
.sort-icon.desc::after { content: ' ▼'; opacity: 1; color: #4facfe; }
.cp-table tbody tr:hover { background-color: #f0f7ff; }
.cp-table tbody tr:nth-child(even) { background-color: #F7FBFF; }
.cp-table tbody tr:nth-child(even):hover { background-color: #f0f7ff; }

/* ===== Frozen Left Columns ===== */
/* col-1: 序号 60px, col-2: 编号 130px, col-3: 站名称 180px */
.cp-table th.frozen-col-1, .cp-table td.frozen-col-1 { position: sticky; left: 0; z-index: 5; width: 60px; min-width: 60px; max-width: 60px; background-color: #1F4E79; }
.cp-table td.frozen-col-1 { background-color: white; z-index: 2; }
.cp-table tbody tr:nth-child(even) td.frozen-col-1 { background-color: #F7FBFF; }
.cp-table tbody tr:hover td.frozen-col-1 { background-color: #f0f7ff; }

.cp-table th.frozen-col-2, .cp-table td.frozen-col-2 { position: sticky; left: 60px; z-index: 5; width: 130px; min-width: 130px; max-width: 130px; }
.cp-table td.frozen-col-2 { z-index: 2; background-color: white; }
.cp-table tbody tr:nth-child(even) td.frozen-col-2 { background-color: #F7FBFF; }
.cp-table tbody tr:hover td.frozen-col-2 { background-color: #f0f7ff; }

.cp-table th.frozen-col-3, .cp-table td.frozen-col-3 { position: sticky; left: 190px; z-index: 5; width: 180px; min-width: 180px; max-width: 180px; box-shadow: 4px 0 6px -4px rgba(0,0,0,0.15); }
.cp-table td.frozen-col-3 { z-index: 2; background-color: white; }
.cp-table tbody tr:nth-child(even) td.frozen-col-3 { background-color: #F7FBFF; }
.cp-table tbody tr:hover td.frozen-col-3 { background-color: #f0f7ff; }

/* Header frozen columns need higher z-index */
.cp-table thead th.frozen-col-1 { z-index: 15; }
.cp-table thead th.frozen-col-2 { z-index: 15; }
.cp-table thead th.frozen-col-3 { z-index: 15; }

/* Frozen right column (操作) */
.cp-table th.frozen-col-right, .cp-table td.frozen-col-right { position: sticky; right: 0; z-index: 5; width: 130px; min-width: 130px; max-width: 130px; background-color: #1F4E79; box-shadow: -4px 0 6px -4px rgba(0,0,0,0.15); }
.cp-table td.frozen-col-right { z-index: 2; background-color: white; }
.cp-table tbody tr:nth-child(even) td.frozen-col-right { background-color: #F7FBFF; }
.cp-table tbody tr:hover td.frozen-col-right { background-color: #f0f7ff; }
.cp-table thead th.frozen-col-right { z-index: 15; }

/* ===== Tags & Badges ===== */
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.tag-level-1 { background-color: #fee2e2; color: #991b1b; }
.tag-level-2 { background-color: #dbeafe; color: #1e40af; }
.tag-level-3 { background-color: #f3f4f6; color: #4b5563; }
.tag-type-swap { background-color: #d1fae5; color: #065f46; }
.tag-type-charge { background-color: #dbeafe; color: #1e40af; }
.tag-swap-back { background-color: #dbeafe; color: #3182CE; }
.tag-swap-bottom { background-color: #d1fae5; color: #38A169; }

/* ===== Battery Progress Bar ===== */
.battery-wrap { display: flex; align-items: center; gap: 6px; }
.battery-text { font-size: 13px; min-width: 36px; }
.battery-bar { width: 40px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.battery-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* ===== Direction Icon ===== */
.dir-up { color: #10b981; }
.dir-down { color: #f59e0b; }

/* ===== Fault Rate Colors ===== */
.fault-good { color: #10b981; font-weight: 600; }
.fault-warn { color: #f59e0b; font-weight: 600; }
.fault-bad { color: #ef4444; font-weight: 700; }

/* ===== Inspection Date Overdue ===== */
.inspection-overdue { color: #ef4444; font-weight: 600; }

/* ===== Efficiency Progress Bar ===== */
.efficiency-wrap { display: flex; align-items: center; gap: 8px; }
.efficiency-text { font-size: 13px; font-weight: 600; color: #1F4E79; min-width: 42px; }
.efficiency-bar { width: 50px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.efficiency-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* ===== Compatible Car Icon ===== */
.car-yes { font-size: 16px; }
.car-no { font-size: 16px; opacity: 0.4; }

/* ===== Fee Link ===== */
.fee-link { color: #2E75B6; cursor: pointer; text-decoration: none; font-size: 13px; }
.fee-link:hover { text-decoration: underline; }

/* ===== Video Link Button ===== */
.video-link { background: none; border: none; cursor: pointer; font-size: 18px; text-decoration: none; }
.video-link:hover { opacity: 0.8; }

/* ===== Action Links ===== */
.action-link { color: #2E75B6; cursor: pointer; text-decoration: none; font-size: 13px; display: block; margin-bottom: 4px; }
.action-link:hover { text-decoration: underline; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-top: 1px solid #e5e7eb; }
.pagination-info { font-size: 13px; color: #6b7280; }
.pagination-btns { display: flex; gap: 6px; }
.pagination-btns button { padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 4px; background: white; cursor: pointer; font-size: 13px; transition: all 0.3s; }
.pagination-btns button:hover:not(:disabled) { border-color: #2E75B6; color: #2E75B6; }
.pagination-btns button.active { background-color: #2E75B6; color: white; border-color: #2E75B6; }
.pagination-btns button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Fee Popover ===== */
.fee-popover { position: fixed; z-index: 9999; background: white; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); border: 1px solid #e5e7eb; width: 420px; }
.fee-popover-header { background: #1F4E79; color: white; padding: 10px 16px; border-radius: 8px 8px 0 0; display: flex; justify-content: space-between; align-items: center; }
.fee-popover-title { font-size: 14px; font-weight: 600; }
.fee-popover-close { background: none; border: none; color: white; font-size: 20px; cursor: pointer; line-height: 1; }
.fee-popover-body { padding: 12px; }
.fee-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fee-table th, .fee-table td { padding: 8px 10px; text-align: center; border: 1px solid #e5e7eb; }
.fee-table th { background: #E8F4F8; color: #1F4E79; font-weight: 600; }
.fee-table td.peak { color: #ef4444; }
.fee-table td.valley { color: #10b981; }
.fee-table tfoot td { background: #f9fafb; font-weight: 600; }

/* ===== Slide Panel ===== */
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 998; display: none; }
.overlay.show { display: block; }
.slide-panel { position: fixed; top: 0; right: -520px; width: 500px; height: 100vh; background: white; z-index: 999; box-shadow: -4px 0 20px rgba(0,0,0,0.15); transition: right 0.3s ease; overflow-y: auto; }
.slide-panel.show { right: 0; }
.slide-panel-header { background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%); color: white; padding: 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.slide-panel-header h3 { font-size: 16px; }
.close-btn { background: none; border: none; color: white; font-size: 24px; cursor: pointer; }
.slide-panel-body { padding: 20px; }
.info-section { margin-bottom: 24px; }
.info-section-title { font-size: 14px; font-weight: 600; color: #1F4E79; margin-bottom: 12px; padding-left: 10px; border-left: 4px solid #2E75B6; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item { display: flex; flex-direction: column; }
.info-item .label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.info-item .value { font-size: 14px; color: #1F4E79; font-weight: 500; }

/* ===== Embedded Mode ===== */
html, body.embedded { height: 100%; min-height: 0; max-height: 100%; overflow: hidden; }
body.embedded .header { display: none; }
body.embedded .sidebar { display: none; }
body.embedded .container { flex: 1; min-height: 0; height: 100%; overflow: hidden; }
body.embedded .container > .main-content { flex: 1; min-height: 0; min-width: 0; height: 100%; overflow-y: auto; overflow-x: hidden; overflow-anchor: none; padding: 16px; }
