/* ===================================================================
   站点电巡平台 - 企业级数据驾驶舱风格 v8
   Design: B端中后台 Dashboard | 电信蓝主色 | 浅色数据驾驶舱
   =================================================================== */

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 13px; color: #1e293b; background: #f0f2f5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: var(--primary); }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; font-size: 13px; outline: none; }
img { max-width: 100%; display: block; }

/* ===== Design Tokens ===== */
:root {
    /* Primary - 电信蓝 */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-light: #dbeafe;
    --primary-lighter: #eff6ff;
    --primary-rgb: 37, 99, 235;
    /* Sidebar */
    --sidebar-from: #0f172a;
    --sidebar-to: #1e293b;
    --sidebar-item-hover: rgba(255,255,255,0.06);
    --sidebar-item-active: rgba(37,99,235,0.85);
    /* Semantic */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-dark: #dc2626;
    --info: #6366f1;
    --info-light: #eef2ff;
    /* Text */
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: rgba(255,255,255,0.85);
    /* Surface */
    --surface-card: #ffffff;
    --surface-page: #f0f2f5;
    --surface-hover: #f8fafc;
    --surface-raised: #ffffff;
    /* Border */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    /* Shape */
    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    /* Shadow */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-primary: 0 8px 16px -4px rgba(37,99,235,0.25);
    /* Layout */
    --header-h: 48px;
    --sidebar-w: 180px;
    --sidebar-w-collapsed: 56px;
    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.2s;
    --transition: all var(--duration) var(--ease);
}

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--surface-page); position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 50%, #1e1b4b 100%);
}
.login-page::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(37,99,235,0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(99,102,241,0.1) 0%, transparent 50%);
}
.login-deco { display: none; }
.login-box {
    background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
    border-radius: 20px; padding: 48px 44px; width: 420px; max-width: 92vw;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.1);
    position: relative; z-index: 1;
    animation: loginFadeIn 0.6s var(--ease-out);
}
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-box .login-logo { text-align: center; margin-bottom: 40px; }
.login-box .login-logo .logo-icon {
    width: 60px; height: 60px; margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 28px; box-shadow: var(--shadow-primary);
}
.login-box .login-logo h2 { font-size: 20px; color: var(--text-main); font-weight: 700; letter-spacing: 0.5px; }
.login-box .login-logo p { font-size: 12px; color: var(--text-muted); margin-top: 6px; letter-spacing: 0.5px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form .form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.login-form .form-group .input-wrap { position: relative; }
.login-form .form-group .input-wrap .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; }
.login-form .form-group input {
    width: 100%; height: 44px; border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 0 14px 0 14px; transition: var(--transition); background: var(--surface-hover); font-size: 14px;
}
.login-form .form-group input:focus {
    border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}
.login-form .btn-login {
    width: 100%; height: 46px; background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: var(--transition); letter-spacing: 1px;
}
.login-form .btn-login:hover {
    background: linear-gradient(135deg, var(--primary-hover), #4338ca);
    transform: translateY(-1px); box-shadow: var(--shadow-primary);
}
.login-form .btn-login:active { transform: translateY(0); }
.login-form .btn-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.login-tip {
    margin-top: 24px; padding: 12px 16px; background: var(--primary-lighter);
    border-radius: var(--radius); font-size: 12px; color: var(--text-secondary);
    text-align: center; line-height: 1.8; border: 1px solid rgba(var(--primary-rgb),0.08);
}

/* ===== Main Layout ===== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar - 浅色系 */
.app-sidebar {
    width: var(--sidebar-w); background: var(--surface-card);
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 99;
    overflow-y: auto; overflow-x: hidden; transition: width var(--duration) var(--ease);
    border-right: 1px solid var(--border-light);
}
.app-sidebar::-webkit-scrollbar { width: 0; }
.app-sidebar .sidebar-logo {
    height: var(--header-h); display: flex; align-items: center; padding: 0 16px;
    color: var(--text-main); font-size: 14px; font-weight: 700; gap: 10px;
    border-bottom: 1px solid var(--border-light); white-space: nowrap; overflow: hidden;
}
.app-sidebar .sidebar-logo .logo-icon {
    width: 30px; height: 30px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.app-sidebar .sidebar-logo .logo-text { transition: opacity var(--duration); }
.app-sidebar .menu-group-label {
    padding: 20px 16px 6px; font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700;
}
.app-sidebar .menu-item {
    height: 38px; display: flex; align-items: center; padding: 0 14px; margin: 1px 6px;
    color: var(--text-secondary); cursor: pointer; transition: var(--transition); gap: 10px;
    font-size: 13px; border-radius: var(--radius-sm); white-space: nowrap; overflow: hidden;
    position: relative;
}
.app-sidebar .menu-item:hover { background: var(--primary-lighter); color: var(--primary); }
.app-sidebar .menu-item.active {
    background: var(--primary); color: #fff;
    box-shadow: var(--shadow-primary);
}
.app-sidebar .menu-item.active::before {
    content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.app-sidebar .menu-item .menu-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.app-sidebar .menu-item .menu-badge {
    margin-left: auto; background: var(--danger); color: #fff; font-size: 10px;
    padding: 1px 7px; border-radius: 10px; font-weight: 700; line-height: 16px; flex-shrink: 0;
}
/* Collapsed */
.app-sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.app-sidebar.collapsed .sidebar-logo .logo-text { opacity: 0; width: 0; }
.app-sidebar.collapsed .menu-item { padding: 0; justify-content: center; margin: 1px 4px; }
.app-sidebar.collapsed .menu-item .menu-icon { margin: 0; }
.app-sidebar.collapsed .menu-item span:not(.menu-icon) { opacity: 0; width: 0; overflow: hidden; }
.app-sidebar.collapsed .menu-item .menu-badge { display: none; }
.app-sidebar.collapsed .menu-item.active::before { display: none; }
.sidebar-toggle {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 32px; height: 32px; border-radius: 8px; background: var(--surface-hover);
    color: var(--text-muted); border: 1px solid var(--border); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: var(--transition);
    font-size: 12px; z-index: 2;
}
.sidebar-toggle:hover { background: var(--primary-lighter); color: var(--primary); border-color: var(--primary); }

/* Header */
.app-header {
    height: var(--header-h); background: var(--surface-card); display: flex;
    align-items: center; justify-content: space-between; padding: 0 20px;
    position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 100;
    transition: left var(--duration) var(--ease);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}
.app-header.shifted { left: var(--sidebar-w-collapsed); }
.app-header .header-left { display: flex; align-items: center; gap: 16px; }
.breadcrumb {
    display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted);
}
.breadcrumb .bc-sep { color: var(--border-dark); font-size: 10px; }
.breadcrumb .bc-current { color: var(--text-main); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-bell {
    position: relative; width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: transparent; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); font-size: 15px; color: var(--text-secondary);
}
.header-bell:hover { background: var(--primary-lighter); color: var(--primary); }
.header-bell .bell-badge {
    position: absolute; top: 1px; right: 1px; min-width: 14px; height: 14px; border-radius: 7px;
    background: var(--danger); color: #fff; font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; line-height: 1;
    border: 2px solid var(--surface-card); padding: 0 2px;
}
.header-user {
    display: flex; align-items: center; gap: 8px; margin-left: 4px;
    padding-left: 12px; border-left: 1px solid var(--border-light);
}
.header-user .user-info { display: flex; align-items: center; gap: 8px; cursor: default; }
.header-user .user-avatar {
    width: 28px; height: 28px; border-radius: var(--radius-xs);
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.header-user .user-name { font-size: 12px; color: var(--text-main); font-weight: 600; }
.header-user .user-role { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.btn-logout {
    color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 5px 12px;
    border-radius: var(--radius-xs); transition: var(--transition); border: 1px solid transparent;
}
.btn-logout:hover { color: var(--danger); background: var(--danger-light); border-color: rgba(239,68,68,0.15); }

/* Content */
.app-content {
    flex: 1; margin-left: var(--sidebar-w); margin-top: var(--header-h);
    padding: 18px 20px; min-height: calc(100vh - var(--header-h));
    transition: margin-left var(--duration) var(--ease); background: var(--surface-page);
}
.app-content.shifted { margin-left: var(--sidebar-w-collapsed); }

/* ===== Components ===== */

/* Card */
.card {
    background: var(--surface-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px;
    border: 1px solid var(--border-light); transition: box-shadow var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
    font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 20px;
    display: flex; align-items: center; justify-content: space-between;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-card); color: var(--text-main);
    font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; box-shadow: var(--shadow-primary); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-dark); color: #fff; }
.btn-text { border: none; background: none; color: var(--primary); padding: 0 8px; height: auto; font-size: 12px; font-weight: 500; border-radius: var(--radius-xs); }
.btn-text:hover { background: var(--primary-lighter); color: var(--primary-hover); }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: var(--danger-light); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { height: 40px; padding: 0 24px; font-size: 14px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group label .required { color: var(--danger); margin-right: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%; height: 36px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: 0 12px; transition: var(--transition);
    background: var(--surface-card); color: var(--text-main);
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-dark); }
.form-textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.6; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.08);
    background: var(--surface-card);
}
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* Filter Bar (sticky) */
.filter-bar-sticky {
    position: sticky; top: var(--header-h); z-index: 10;
    padding: 12px 20px; background: var(--surface-card);
    border: 1px solid var(--border-light); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); margin-bottom: 16px;
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    transition: border-radius 0.15s ease, box-shadow 0.15s ease, padding 0.15s ease, border 0.15s ease;
}
/* Sticky bar merged into header when scrolled */
.filter-bar-sticky.is-stuck {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 8px 20px;
    margin: 0 -20px 12px;
    padding-left: 20px;
    padding-right: 20px;
}
/* Header: remove bottom border/shadow when filter bar is stuck to it */
.app-header.has-stuck-bar {
    box-shadow: none;
    border-bottom: none;
}
.filter-bar-sticky .filter-item { display: flex; align-items: center; gap: 6px; }
.filter-bar-sticky .filter-item label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; font-weight: 600; }
.filter-bar-sticky .filter-item .form-input, .filter-bar-sticky .filter-item .form-select { width: auto; min-width: 120px; height: 32px; }
.filter-bar-sticky .filter-actions { margin-left: auto; display: flex; gap: 8px; }

/* Filter Bar (legacy inside-card variant, kept for compat) */
.filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px;
    padding: 16px 20px; background: var(--surface-hover); border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.filter-bar .filter-item { display: flex; align-items: center; gap: 6px; }
.filter-bar .filter-item label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; font-weight: 600; }
.filter-bar .filter-item .form-input, .filter-bar .filter-item .form-select { width: auto; min-width: 120px; height: 32px; }
.filter-bar .filter-actions { margin-left: auto; display: flex; gap: 8px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-light); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
    background: var(--surface-hover); color: var(--text-secondary); font-weight: 600; text-align: left;
    padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table tbody td {
    padding: 12px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-main);
    transition: background 0.12s;
}
.data-table tbody tr:nth-child(even) { background: rgba(248,250,252,0.5); }
.data-table tbody tr:hover { background: var(--primary-lighter); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .table-actions { display: flex; gap: 4px; flex-wrap: nowrap; }
.data-table .col-center { text-align: center; }
.data-table .col-nowrap { white-space: nowrap; }

/* Pagination */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 16px; }
.pagination .page-info { font-size: 12px; color: var(--text-muted); margin-right: 8px; }
.pagination .page-btn {
    min-width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-xs);
    background: var(--surface-card); cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: var(--transition); padding: 0 6px; color: var(--text-main);
}
.pagination .page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.pagination .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pagination .page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Tags */
.tag {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-xs);
    font-size: 11px; font-weight: 600; line-height: 18px; letter-spacing: 0.2px;
}
.tag-success { background: var(--success-light); color: var(--success-dark); }
.tag-warning { background: var(--warning-light); color: var(--warning-dark); }
.tag-danger { background: var(--danger-light); color: var(--danger-dark); }
.tag-info { background: var(--info-light); color: #4f46e5; }
.tag-default { background: var(--surface-hover); color: var(--text-secondary); }

/* ===== KPI Cards (Dashboard) ===== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.kpi-card {
    background: var(--surface-card); border-radius: var(--radius-lg); padding: 22px 24px;
    position: relative; overflow: hidden; border: 1px solid var(--border-light);
    transition: var(--transition); cursor: default;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-card.kpi-blue::before { background: linear-gradient(90deg, var(--primary), #818cf8); }
.kpi-card.kpi-teal::before { background: linear-gradient(90deg, #0d9488, #2dd4bf); }
.kpi-card.kpi-orange::before { background: linear-gradient(90deg, #f59e0b, #fb923c); }
.kpi-card.kpi-red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.kpi-card.kpi-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card .kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-card .kpi-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.kpi-card .kpi-icon-wrap {
    width: 42px; height: 42px; border-radius: var(--radius); display: flex; align-items: center;
    justify-content: center; font-size: 20px;
}
.kpi-card.kpi-blue .kpi-icon-wrap { background: var(--primary-light); color: var(--primary); }
.kpi-card.kpi-teal .kpi-icon-wrap { background: #ccfbf1; color: #0d9488; }
.kpi-card.kpi-orange .kpi-icon-wrap { background: var(--warning-light); color: var(--warning); }
.kpi-card.kpi-red .kpi-icon-wrap { background: var(--danger-light); color: var(--danger); }
.kpi-card.kpi-green .kpi-icon-wrap { background: var(--success-light); color: var(--success); }
.kpi-card .kpi-value { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-card.kpi-blue .kpi-value { color: var(--primary); }
.kpi-card.kpi-teal .kpi-value { color: #0d9488; }
.kpi-card.kpi-orange .kpi-value { color: #b45309; }
.kpi-card.kpi-red .kpi-value { color: var(--danger); }
.kpi-card.kpi-green .kpi-value { color: var(--success-dark); }
.kpi-card .kpi-value .kpi-unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.kpi-card .kpi-trend {
    display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600;
    margin-top: 6px; padding: 2px 8px; border-radius: 12px;
}
.kpi-card .kpi-trend.up { color: var(--success-dark); background: var(--success-light); }
.kpi-card .kpi-trend.down { color: var(--danger-dark); background: var(--danger-light); }
.kpi-card .kpi-bg-icon {
    position: absolute; right: -8px; bottom: -8px; font-size: 80px; opacity: 0.03; pointer-events: none;
}

/* Charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-container {
    background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 20px 24px; border: 1px solid var(--border-light);
}
.chart-container .chart-title {
    font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-main);
    display: flex; align-items: center; gap: 8px;
}
.chart-container .chart-title::before {
    content: ''; width: 3px; height: 14px; background: var(--primary); border-radius: 2px;
}
.chart-box { width: 100%; height: 280px; }

/* Map */
.map-container {
    background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 0; overflow: hidden; margin-bottom: 18px; border: 1px solid var(--border-light);
}
.map-container .chart-title {
    font-size: 14px; font-weight: 700; padding: 16px 24px 10px; color: var(--text-main);
    display: flex; align-items: center; gap: 8px;
}
.map-container .chart-title::before {
    content: ''; width: 3px; height: 14px; background: var(--primary); border-radius: 2px;
}
#mapCanvas { width: 100%; height: 400px; }

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 1000;
    justify-content: center; align-items: flex-start; padding-top: 60px; overflow-y: auto;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; animation: modalBgIn 0.15s var(--ease); }
@keyframes modalBgIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface-card); border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 600px; max-width: 95vw; max-height: 85vh; display: flex; flex-direction: column;
    animation: modalSlideIn 0.25s var(--ease-out);
}
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(-16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal.modal-lg { width: 1280px; max-width: 96vw; }
.modal.modal-md { width: 800px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-main); }
.modal-header .modal-close {
    width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center;
    justify-content: center; font-size: 18px; color: var(--text-muted); cursor: pointer;
    transition: var(--transition); border: none; background: none;
}
.modal-header .modal-close:hover { background: var(--surface-hover); color: var(--text-main); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px;
    border-top: 1px solid var(--border-light); background: var(--surface-hover);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Station Detail Popup */
.station-detail-header {
    display: flex; align-items: center; gap: 20px; margin-bottom: 20px;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--primary-lighter) 0%, #f8fafc 100%);
    border-radius: var(--radius); border: 1px solid rgba(var(--primary-rgb),0.08);
}
.station-detail-header .sdh-info { flex-shrink: 0; }
.station-detail-header .sdh-info h3 { font-size: 16px; margin: 0; }
.station-detail-header .sdh-info .sdh-sub { color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.station-detail-header .completeness-bar { flex: 1; min-width: 120px; }
.station-detail-header .completeness-bar .bar-track { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.station-detail-header .completeness-bar .bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s var(--ease); }
.station-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Detail Section */
.detail-section {
    background: var(--surface-hover); border-radius: var(--radius); padding: 16px;
    border: 1px solid var(--border-light);
}
.detail-section h4 {
    font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* Detail Fields */
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0; row-gap: 0; }
.detail-field {
    display: flex; align-items: baseline; padding: 6px 10px; font-size: 12px;
    border-bottom: 1px solid var(--border-light); min-height: 28px;
}
.detail-field:nth-child(odd) { border-right: 1px solid var(--border-light); }
.detail-field.full { grid-column: 1 / -1; border-right: none; }
.detail-field .df-label { color: var(--text-muted); font-size: 11px; flex-shrink: 0; margin-right: 8px; white-space: nowrap; }
.detail-field .df-value { color: var(--text-main); font-weight: 500; flex: 1; min-width: 0; word-break: break-all; }

.detail-field.money .df-value { color: var(--primary); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.detail-field.money-loss .df-value { color: var(--danger); font-weight: 700; font-size: 13px; }

/* Bool Group */
.bool-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 8px; grid-column: 1 / -1; border-bottom: 1px solid var(--border-light); padding-bottom: 8px; }
.bool-item { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.bool-item .bi-label { color: var(--text-muted); white-space: nowrap; }
.bool-item .bi-val { display: inline-block; padding: 1px 7px; border-radius: var(--radius-xs); font-weight: 700; font-size: 10px; line-height: 16px; }
.bool-item .bi-val.yes { background: #dcfce7; color: #15803d; }
.bool-item .bi-val.no { background: #f1f5f9; color: #94a3b8; }

.detail-field .df-value .tag { vertical-align: middle; }

/* Photo Grid */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.photo-card { background: var(--surface-card); border: 1px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; }
.photo-card .pc-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--surface-hover); border-bottom: 1px solid var(--border-light); }
.photo-card .pc-title { font-size: 11px; font-weight: 600; color: var(--text-main); }
.photo-card .pc-count { font-size: 10px; color: var(--text-muted); }
.photo-card .pc-body { min-height: 64px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.photo-card .pc-body .pc-empty { font-size: 10px; color: var(--text-muted); text-align: center; }
.photo-card .pc-body .pc-thumbs { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; }
.photo-card .pc-body .pc-thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border-light); cursor: zoom-in; transition: var(--transition); }
.photo-card .pc-body .pc-thumbs img:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: scale(1.05); }
.photo-card .pc-footer { border-top: 1px solid var(--border-light); padding: 6px 10px; text-align: center; }
.photo-card .pc-footer .btn-upload {
    background: var(--primary-lighter); border: 1px dashed var(--primary); color: var(--primary);
    border-radius: var(--radius-xs); padding: 3px 12px; font-size: 11px; cursor: pointer;
    transition: var(--transition); width: 100%;
}
.photo-card .pc-footer .btn-upload:hover { background: var(--primary); color: #fff; border-style: solid; }

/* Legacy compat */
.detail-section .detail-row { display: flex; padding: 7px 0; font-size: 12px; }
.detail-section .detail-row .detail-label { width: 100px; color: var(--text-muted); flex-shrink: 0; }
.detail-section .detail-row .detail-value { color: var(--text-main); flex: 1; }

/* Image Upload Grid */
.image-upload-section { margin-bottom: 14px; }
.image-upload-section .upload-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.image-upload-section .upload-header .upload-title { font-size: 13px; font-weight: 600; }
.image-upload-section .upload-header .upload-count { font-size: 11px; color: var(--text-muted); }
.image-upload-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.image-upload-grid .image-item { width: 96px; height: 96px; border-radius: var(--radius-sm); overflow: hidden; position: relative; border: 1px solid var(--border); transition: var(--transition); }
.image-upload-grid .image-item:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.image-upload-grid .image-item img { width: 100%; height: 100%; object-fit: cover; }
.image-upload-grid .image-item .image-delete { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(239,68,68,0.9); color: #fff; border: none; cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; transition: var(--transition); opacity: 0; }
.image-upload-grid .image-item:hover .image-delete { opacity: 1; }
.image-upload-grid .upload-add { width: 96px; height: 96px; border: 2px dashed var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); font-size: 26px; transition: var(--transition); background: var(--surface-hover); }
.image-upload-grid .upload-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }

/* Toast */
.toast-container { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 2000; }
.toast {
    padding: 10px 20px; border-radius: var(--radius); color: #fff; font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-lg); margin-bottom: 8px;
    animation: toastIn 0.3s var(--ease-spring); display: flex; align-items: center; gap: 6px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Loading */
.loading-mask { position: fixed; inset: 0; background: rgba(255,255,255,0.65); z-index: 3000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.loading-mask.show { display: flex; }
.loading-spinner { width: 36px; height: 36px; border: 3px solid var(--border-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-xs); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 12px; margin-bottom: 8px; border-radius: var(--radius-xs); }
.skeleton-text.w80 { width: 80%; }
.skeleton-text.w60 { width: 60%; }
.skeleton-text.w40 { width: 40%; }

/* Empty State */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }
.empty-state .empty-text { font-size: 13px; line-height: 1.6; }

/* Progress Bar */
.progress-bar { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-bar .progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s var(--ease); }
.progress-bar .progress-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-bar .progress-fill.orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-bar .progress-fill.red { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Config Section */
.config-section { margin-bottom: 24px; }
.config-section h4 {
    font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 16px;
    padding-left: 12px; border-left: 3px solid var(--primary);
}
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.config-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.config-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
    background: var(--primary-lighter); border: 1px solid rgba(var(--primary-rgb),0.15);
    border-radius: 14px; font-size: 12px; color: var(--primary); transition: var(--transition);
}
.config-chip:hover { background: var(--primary-light); }
.config-chip .chip-delete { cursor: pointer; font-size: 14px; color: var(--text-muted); transition: var(--transition); }
.config-chip .chip-delete:hover { color: var(--danger); }

/* Electricity - Month Tags */
.elec-month-tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.elec-month-tag {
    display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 4px 9px; border-radius: var(--radius-xs); font-size: 11px;
    background: var(--surface-hover); border: 1px solid var(--border-light); line-height: 1.3;
}
.elec-month-tag .emt-month { color: var(--text-muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.elec-month-tag .emt-value { color: var(--text-main); font-weight: 700; font-size: 11px; white-space: nowrap; }
.elec-month-tag .emt-trend { font-size: 9px; font-weight: 600; }
.elec-month-tag.trend-rise { border-color: rgba(16,185,129,0.2); background: #ecfdf5; }
.elec-month-tag.trend-rise .emt-value { color: var(--success-dark); }
.elec-month-tag.trend-rise .emt-trend { color: var(--success-dark); }
.elec-month-tag.trend-fall { border-color: rgba(239,68,68,0.2); background: #fef2f2; }
.elec-month-tag.trend-fall .emt-value { color: var(--danger-dark); }
.elec-month-tag.trend-fall .emt-trend { color: var(--danger-dark); }

.trend-badge { display: inline-flex; align-items: center; gap: 2px; padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.trend-rise-badge { background: var(--success-light); color: var(--success-dark); }
.trend-fall-badge { background: var(--danger-light); color: var(--danger-dark); }
.trend-stable-badge { background: var(--surface-hover); color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
    .station-detail-grid { grid-template-columns: 1fr; }
    .config-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .app-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .app-sidebar.show { transform: translateX(0); }
    .app-header { left: 0; padding: 0 16px; }
    .app-content { margin-left: 0; padding: 16px; }
    .kpi-row { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .filter-actions { margin-left: 0; }
    .modal { width: 95vw; }
    .login-box { padding: 32px 24px; }
}
