/* =============================================
   京锋环境监测云平台 · 全局样式表
   包含：登录页 / 公共头部 / 管理首页仪表盘
   ============================================= */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #161c28;
    --bg-card-hover: #1c2435;
    --border-color: #1e2d45;
    --border-active: #2a4a7f;
    --text-primary: #e0e6f0;
    --text-secondary: #a0b0c8;
    --text-muted: #6b7d95;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --glow-blue: rgba(59, 130, 246, 0.3);
    --glow-green: rgba(16, 185, 129, 0.3);
    --glow-red: rgba(239, 68, 68, 0.3);
    --glow-purple: rgba(139, 92, 246, 0.25);
    --font-mono: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.04) inset;
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(ellipse at 15% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 60%, rgba(6, 182, 212, 0.03) 0%, transparent 55%),
    radial-gradient(ellipse at 40% 85%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

/* 登录页专用布局 */
body.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 后台页面（admin / home）基础布局 */
body.page-admin {
    overflow-x: hidden;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a3a55;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3b5070;
}

/* ========== 登录页背景元素 ========== */
.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: linear-gradient(rgba(30, 45, 69, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 45, 69, 0.25) 1px, transparent 1px);
    background-size: 55px 55px;
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5) 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5) 30%, transparent 70%);
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    animation: float-glow 8s ease-in-out infinite;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: rgba(59, 130, 246, 0.12);
    top: -15%;
    left: -10%;
    animation-delay: 0s;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: rgba(6, 182, 212, 0.10);
    bottom: -12%;
    right: -8%;
    animation-delay: -4s;
}

.bg-glow-3 {
    width: 350px;
    height: 350px;
    background: rgba(139, 92, 246, 0.10);
    top: 50%;
    left: 55%;
    animation-delay: -6s;
}

@keyframes float-glow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -25px) scale(1.08);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.94);
    }
    75% {
        transform: translate(-35px, -15px) scale(1.04);
    }
}

/* ========== 登录卡片 ========== */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 430px;
    padding: 20px;
}

.login-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 40px 36px 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
    transition: var(--transition);
    animation: card-enter 0.6s ease-out;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card:hover {
    border-color: #2a4060;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
}

/* 卡片发光条 */
.card-glow-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
    transparent 0%,
    var(--accent-blue) 20%,
    var(--accent-cyan) 50%,
    var(--accent-purple) 80%,
    transparent 100%);
    opacity: 0.7;
    animation: bar-shimmer 3s ease-in-out infinite;
}

@keyframes bar-shimmer {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 16px rgba(59, 130, 246, 0.5), 0 0 32px rgba(6, 182, 212, 0.3);
    }
}

/* 登录 Logo */
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.4);
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% {
        box-shadow: 0 0 24px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.65), 0 0 60px rgba(6, 182, 212, 0.3);
    }
}

.logo-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    margin-bottom: 4px;
}

.logo-title span {
    color: var(--accent-cyan);
    font-weight: 400;
}

.logo-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* 错误提示 */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    margin-bottom: 20px;
    font-size: 0.82rem;
    color: #fca5a5;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.error-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.error-text {
    flex: 1;
    line-height: 1.4;
}

/* 登录表单 */
.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.label-icon {
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    letter-spacing: 0.3px;
    transition: var(--transition);
    outline: none;
    position: relative;
    z-index: 1;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.input-wrapper input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 0 12px rgba(59, 130, 246, 0.15);
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 1.5px;
    background: var(--accent-blue);
    border-radius: 1px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    pointer-events: none;
}

.input-wrapper input:focus ~ .input-border {
    transform: translateX(-50%) scaleX(1);
}

/* 登录按钮 */
.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(59, 130, 246, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.login-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.login-btn.loading .btn-text {
    visibility: hidden;
}

.login-btn.loading .btn-loader {
    display: block;
}

/* 登录页底部 */
.login-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.footer-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 10px 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.footer-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 5px var(--glow-green);
    flex-shrink: 0;
}

.footer-hint {
    margin-top: 8px;
    font-size: 0.68rem;
    color: #5a6a80;
    letter-spacing: 0.2px;
}

/* ========== 后台（admin / home）公共头部 ========== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-left .logo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
}

.logo-text span {
    color: var(--accent-cyan);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-time {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #c0d0e0;
    letter-spacing: 1px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.header-avatar {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .login-card {
        padding: 28px 20px 24px;
        border-radius: var(--radius);
    }

    .login-logo .logo-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        border-radius: 10px;
    }

    .logo-title {
        font-size: 1.15rem;
    }

    .login-btn {
        padding: 12px;
        font-size: 0.9rem;
    }

    .input-wrapper input {
        padding: 11px 13px;
        font-size: 0.85rem;
    }

    .bg-glow-1,
    .bg-glow-2,
    .bg-glow-3 {
        opacity: 0.3;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 14px;
        height: 50px;
    }
}

/* =============================================
   以下为管理首页（仪表盘）样式
   完全复用上述变量，不修改原有任何代码
   ============================================= */

/* 主容器 */
.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 通用面板卡片 */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: var(--transition);
}

.panel-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.panel-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot.green {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--glow-green);
}

.dot.blue {
    background: var(--accent-blue);
    box-shadow: 0 0 6px var(--glow-blue);
}

.panel-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.panel-body {
    padding: 20px 24px;
}

.device-table-wrap {
    height: 320px;
    overflow-y: auto;
    overflow-x: auto;
}

.device-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.device-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.device-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-card);
}

.device-table th:nth-child(3),
.device-table th:nth-child(4) {
    white-space: nowrap;
}

.device-table td:nth-child(3),
.device-table td:nth-child(4) {
    white-space: nowrap;
}

.device-table td {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.device-table tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

.device-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.device-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.device-pagination .btn {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.device-page-info {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* 地图面板 */
.map-panel .panel-body {
    padding: 0;
    flex: 1;
    min-height: 0;
}

.map-container {
    height: 100%;
    min-height: 420px;
    width: 100%;
    background: #0d1321;
    position: relative;
    overflow: hidden;
}

.map-loading-mask {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 23, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-loading-text {
    margin-top: 16px;
    color: var(--text-muted);
}

/* 图例区域（含统计数值） */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 14px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    align-items: center;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.leg-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.leg-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px var(--glow-green);
}

.leg-dot.alarm {
    background: #ef4444;
    box-shadow: 0 0 8px var(--glow-red);
}

.leg-dot.offline {
    background: #9ca3af;
}

.leg-dot.total {
    background: var(--accent-blue);
    box-shadow: 0 0 6px var(--glow-blue);
}

.leg-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: #fff;
    margin-left: 2px;
    min-width: 18px;
    text-align: center;
}

.legend-total {
    margin-left: auto; /* 将总数推到右侧 */
    font-weight: 500;
}

/* ========== 左右分栏布局 ========== */
.dashboard-row {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

.device-list-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.map-panel {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}

.device-list-panel .panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .dashboard-row {
        flex-direction: column;
        align-items: stretch;
    }

    .device-list-panel .panel-body {
        flex: none;
        max-height: 300px;
    }

    .map-container {
        height: 350px;
        min-height: 350px;
    }

    .legend-total {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 16px;
        gap: 16px;
    }

    .map-container {
        height: 300px;
    }
}

/* =============================================
   设备详情区（实时数据 / 图表 / 历史表 / 设置 / 保留期）
   复用全局变量，保持暗色科技风
   ============================================= */

/* 通用按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn:disabled,
.btn.busy {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-color: transparent;
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    color: #fff;
    background: linear-gradient(135deg, #4f8ff8, #7c7ef3);
}

/* 选中行高亮 */
.device-table tbody tr.active {
    background: rgba(59, 130, 246, 0.12);
    box-shadow: inset 3px 0 0 var(--accent-blue);
}

/* 详情面板 */
.device-detail-panel {
    min-height: 200px;
}

.device-detail-panel .panel-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.detail-placeholder .ph-icon {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 花粉等级卡片 */
.pollen-grade-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    transition: var(--transition);
}

.pollen-grade-card.grade-1 {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.12);
}

.pollen-grade-card.grade-2 {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.12);
}

.pollen-grade-card.grade-3 {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.14);
}

.pollen-grade-card.grade-4 {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 28px rgba(239, 68, 68, 0.16);
}

.pollen-grade-card.grade-5 {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 28px rgba(139, 92, 246, 0.18);
}

.pollen-grade-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.pollen-grade-icon.grade-1 {
    background: rgba(16, 185, 129, 0.15);
}

.pollen-grade-icon.grade-2 {
    background: rgba(245, 158, 11, 0.15);
}

.pollen-grade-icon.grade-3 {
    background: rgba(249, 115, 22, 0.15);
}

.pollen-grade-icon.grade-4 {
    background: rgba(239, 68, 68, 0.15);
}

.pollen-grade-icon.grade-5 {
    background: rgba(139, 92, 246, 0.15);
}

.pollen-grade-info {
    flex: 1;
    min-width: 0;
}

/* 花粉四列网格 */
.pollen-grid-row {
    display: flex;
    gap: 44px;
    margin-bottom: 8px;
    align-items: flex-end;
}

.pollen-grid-col {
    text-align: center;
    min-width: 70px;
}

.pollen-grid-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
}

.pollen-grid-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    font-family: var(--font-mono);
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
}

.pollen-grid-unit {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    font-family: var(--font-sans);
}

.pollen-grid-value .grade-1 { color: #10b981; }
.pollen-grid-value .grade-2 { color: #f59e0b; }
.pollen-grid-value .grade-3 { color: #f97316; }
.pollen-grid-value .grade-4 { color: #ef4444; }
.pollen-grid-value .grade-5 { color: #8b5cf6; }

.pollen-grade-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.pollen-grade-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    white-space: nowrap;
}

.pollen-grade-tag.grade-1 { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.pollen-grade-tag.grade-2 { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.pollen-grade-tag.grade-3 { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.pollen-grade-tag.grade-4 { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.pollen-grade-tag.grade-5 { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.pollen-grade-advice {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 实时指标网格 */
.realtime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.realtime-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: var(--transition);
}

.realtime-card:hover {
    border-color: var(--border-active);
}

.card-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
    line-height: 1.1;
}

.card-unit {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* 区块标题 */
.section-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.section-title .st-bar {
    width: 3px;
    height: 14px;
    background: var(--accent-blue);
    border-radius: 2px;
}

/* 图表区 */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.chart-btn {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.chart-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
}

.chart-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.5);
}

.chart-granularity-select {
    padding: 5px 24px 5px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2389a8c8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.chart-granularity-select:focus {
    border-color: var(--accent-blue);
}

.chart-date-range {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-date-sep {
    color: var(--text-muted);
    font-size: 0.85rem;
    user-select: none;
}

.chart-date-range input[type="date"],
.chart-date-range input[type="number"] {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color-scheme: dark;
    cursor: pointer;
    transition: var(--transition);
    min-height: 32px;
}

.chart-date-range input[type="date"]:hover,
.chart-date-range input[type="date"]:focus {
    border-color: var(--border-active);
    outline: none;
}

/* 统一日期选择器的日历图标颜色 */
.chart-date-range input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chart-date-range input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.chart-date-range input[type="date"]::-webkit-datetime-edit {
    color: var(--text-primary);
}

.chart-query-btn {
    font-size: 0.78rem;
}

.chart-factor-select {
    padding: 7px 28px 7px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2389a8c8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.chart-factor-select:focus {
    border-color: var(--accent-blue);
}

.chart-container {
    width: 100%;
    height: 360px;
    background: #0d1321;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    position: relative;
}

.chart-loading-mask {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 23, 0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: var(--radius);
}

.chart-loading-mask.show {
    display: flex;
}

/* 历史数据工具条 */
.history-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.history-toolbar input[type="date"],
.history-toolbar input[type="number"],
.history-toolbar input[type="text"] {
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    font-family: var(--font-mono);
    color-scheme: dark;
    transition: var(--transition);
    height: 34px;
    box-sizing: border-box;
}

.history-toolbar input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.85;
    filter: brightness(1.3);
}

.history-toolbar input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    filter: brightness(1.6);
}

.history-toolbar input:focus {
    border-color: var(--accent-blue);
}

.history-toolbar .btn {
    height: 34px;
    box-sizing: border-box;
}

.toolbar-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.toolbar-spacer {
    flex: 1;
}

/* 历史表格 */
.history-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 480px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.history-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-card);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.82rem;
}

.history-table th {
    text-align: left;
    padding: 11px 14px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.history-table td {
    padding: 10px 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-family: var(--font-mono);
}

.history-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.history-table td.valert-cell {
    color: #ef4444;
    font-weight: 600;
}

.history-table .row-del-btn {
    padding: 3px 9px;
    font-size: 0.72rem;
    border-radius: 5px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    cursor: pointer;
    transition: var(--transition);
}

.history-table .row-del-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

.empty-state {
    text-align: center;
    padding: 36px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* 分页 */
.pagination {
    display: none;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination.show {
    display: flex;
}

.pagination button {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    font-family: var(--font-mono);
}

/* 设置面板 */
.settings-panel {
    display: flex;
    gap: 20px;
    padding: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    align-items: stretch;
}

.settings-power {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 20px;
    border-right: 1px solid var(--border-color);
    min-width: 100px;
}

.power-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.power-switch {
    transform: scale(1.2);
}

.power-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.power-status.on {
    color: #34d399;
}

.power-status.off {
    color: #6b7280;
}

.settings-params {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    flex: 1;
    flex-wrap: wrap;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.settings-field label {
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.settings-field input, .settings-field select {
    padding: 9px 28px 9px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-mono);
    outline: none;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    color-scheme: dark;
}

.settings-field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2389a8c8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.settings-field input:focus, .settings-field select:focus {
    border-color: var(--accent-blue);
}

.settings-field input:disabled, .settings-field select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-field:has(.number-input) {
    width: 150px;
}

.settings-field:has(select) {
    width: 120px;
}

.settings-action {
    flex-shrink: 0;
    margin-left: auto;
}

.settings-action .btn {
    height: 38px;
}

/* number input 自定义微调 */
.number-input {
    display: flex;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

/* 全局隐藏 number input 原生 spin button */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.number-input input[type="number"] {
    text-align: center;
    padding: 9px 4px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    flex: 1;
    min-width: 0;
}

.num-btn {
    width: 32px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.num-btn:hover {
    background: var(--bg-card-hover);
    color: var(--accent-cyan);
    border-color: var(--accent-blue);
}

.num-btn:active {
    transform: scale(0.92);
}

.num-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.num-btn:disabled:hover {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.num-btn.num-down {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.num-btn.num-up {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.number-input input[type="number"]:focus {
    border-color: var(--accent-blue);
}

.number-input input[type="number"]:focus + .num-btn {
    border-color: var(--accent-blue);
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #2a3a55;
    border-radius: 24px;
    transition: var(--transition);
}

.switch .slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}

.switch input:checked + .slider {
    background: var(--accent-green);
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
}

.switch input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 220px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-blue);
    color: var(--text-primary);
    font-size: 0.84rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.3s ease;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast.error {
    border-left-color: var(--accent-red);
}

.toast.warn {
    border-left-color: var(--accent-orange);
}

.toast.info {
    border-left-color: var(--accent-cyan);
}

.toast.toast-out {
    opacity: 0;
    transform: translateX(20px);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .chart-container {
        height: 280px;
    }

    .pollen-grade-value {
        font-size: 1.8rem;
    }
}

/* =============================================
   设备列表圆点
   ============================================= */
.row-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.row-dot.dot-green {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.row-dot.dot-red {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
    animation: dot-pulse 1.5s infinite;
}

.row-dot.dot-gray {
    background: #4b5563;
}

@keyframes dot-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* =============================================
   设备列表 GPS 单元格（上下两行）
   ============================================= */
.gps-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}

.gps-cell .gps-lat, .gps-cell .gps-lon {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.gps-cell .gps-lat {
    color: var(--text-primary);
}

/* =============================================
   设备列表状态标签（圆点+文字）
   ============================================= */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    line-height: 1.4;
}

.status-tag .row-dot {
    width: 7px;
    height: 7px;
}

.status-tag.tag-green {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-tag.tag-red {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-tag.tag-gray {
    color: #9ca3af;
    background: rgba(156, 163, 175, 0.1);
    border: 1px solid rgba(156, 163, 175, 0.2);
}

/* =============================================
   历史趋势图表增强
   ============================================= */
.chart-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chart-stat-item {
    flex: 1;
    min-width: 110px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.chart-stat-item:hover {
    border-color: var(--border-active);
}

.chart-stat-item .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.chart-stat-item .stat-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.chart-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.chart-stat-value {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.2;
}

.chart-stat-value.stat-max {
    color: #f87171;
}

.chart-stat-value.stat-min {
    color: #60a5fa;
}

.chart-stat-value.stat-avg {
    color: #34d399;
}

.chart-stat-value.stat-count {
    color: var(--accent-cyan);
}

.chart-stat-item.stat-max-item .stat-icon {
    background: rgba(239, 68, 68, 0.12);
}

.chart-stat-item.stat-min-item .stat-icon {
    background: rgba(96, 165, 250, 0.12);
}

.chart-stat-item.stat-avg-item .stat-icon {
    background: rgba(52, 211, 153, 0.12);
}

.chart-stat-item.stat-count-item .stat-icon {
    background: rgba(6, 182, 212, 0.12);
}

.chart-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.chart-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
    background: var(--bg-card-hover);
}

.chart-icon-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.5);
}

/* =============================================
   日期快捷导航
   ============================================= */
.date-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.date-nav-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.date-nav-btn:hover:not(:disabled) {
    color: var(--accent-cyan);
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}

.date-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.date-nav-btn.date-prev {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
}

.date-nav-btn.date-next {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
}

.date-today-btn {
    padding: 7px 14px;
    height: 34px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: var(--transition);
    box-sizing: border-box;
}

.date-today-btn:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-blue);
}

/* 日期输入框恢复独立样式 */
.history-toolbar input[type="date"] {
    border-radius: var(--radius-sm);
}

/* =============================================
   设备列表汇总条
   ============================================= */
.device-summary {
    display: flex;
    gap: 16px;
    padding: 10px 24px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.device-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.device-summary-item .sum-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.device-summary-item .sum-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}


/* =============================================
   超级管理员后台专属样式
   追加到 style.css 末尾，复用全局变量
   ============================================= */

/* ---------- 头部管理员标签 ---------- */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #c4b5fd;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-left: 6px;
}

/* ---------- 统计卡片行 ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

/* 单个统计卡片 */
.stat-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
    transition: var(--transition);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

/* 卡片发光底纹 */
.stat-glow {
    position: absolute;
    top: -30%;
    right: -20%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.15;
    pointer-events: none;
    transition: opacity 0.4s;
}

.stat-card:hover .stat-glow {
    opacity: 0.25;
}

.stat-users .stat-glow {
    background: var(--accent-blue);
}

.stat-online .stat-glow {
    background: var(--accent-green);
}

.stat-devices .stat-glow {
    background: var(--accent-cyan);
}

.stat-devices-online .stat-glow {
    background: var(--accent-purple);
}

/* 图标容器 */
.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.stat-users .stat-icon-wrap {
    background: rgba(59, 130, 246, 0.15);
}

.stat-online .stat-icon-wrap {
    background: rgba(16, 185, 129, 0.15);
}

.stat-devices .stat-icon-wrap {
    background: rgba(6, 182, 212, 0.15);
}

.stat-devices-online .stat-icon-wrap {
    background: rgba(139, 92, 246, 0.15);
}

/* 文字区域 */
.stat-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #fff;
    line-height: 1.1;
}

/* ---------- 管理员双面板布局 ---------- */
.admin-main {
    gap: 24px;
}

.admin-panels-row {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

/* 筛选标签栏（面板内） */
.filter-bar {
    display: flex;
    gap: 4px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}

.filter-tab {
    padding: 4px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.filter-tab.active {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--border-active);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    line-height: 1;
}

.filter-tab.active .filter-count {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.15);
}

.admin-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-panel .panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px 20px;
}

/* ---------- 面板头部操作区 ---------- */
.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---------- 搜索框 ---------- */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0.6;
}

.search-input {
    padding: 7px 12px 7px 32px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    width: 180px;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.search-input:focus {
    border-color: var(--accent-blue);
    width: 220px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

/* ---------- 小按钮 ---------- */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

/* ---------- 表格容器 ---------- */
.table-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-height: 420px;
}

/* ---------- 管理员表格 ---------- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.82rem;
}

.admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    padding: 11px 14px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.admin-table tbody td {
    padding: 10px 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-family: var(--font-mono);
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* 在线状态指示 */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.status-dot.offline {
    background: #4b5563;
}

/* 操作按钮组 */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btns .btn {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

/* ---------- 表格底部 ---------- */
.table-footer {
    padding: 10px 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 8px;
}

.table-count {
    font-family: var(--font-mono);
}

/* ---------- 模态弹窗 ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s;
    overflow: hidden;
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.modal-header-danger {
    background: rgba(239, 68, 68, 0.08);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.modal-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

/* ---------- 通用表单元素（模态弹窗内） ---------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.required {
    color: var(--accent-red);
    font-weight: 600;
}

.form-input {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.form-select {
    cursor: pointer;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2389a8c8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.form-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: -8px;
}

/* ---------- 确认文本 ---------- */
.confirm-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- 危险按钮 ---------- */
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .admin-panels-row {
        flex-direction: column;
    }

    .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .search-input {
        width: 140px;
    }

    .search-input:focus {
        width: 170px;
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .stat-icon-wrap {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .panel-header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-input {
        width: 120px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .modal-card {
        width: 95%;
        max-width: none;
    }
}

/* ---------- 表格底部分页控件 ---------- */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 8px;
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-pagination .btn-sm {
    padding: 4px 12px;
}

.table-pagination .page-info {
    font-family: var(--font-mono);
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
}

/* 如果表格包装器高度需要限制，可保留以下规则 */
.table-wrap {
    max-height: 450px;  /* 可根据需要调整 */
}

/* ========== Hijack 横幅（管理员接管提示） ========== */
.hijack-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    padding: 10px 24px;
    font-size: 0.9rem;
    position: sticky;
    top: 60px;
    z-index: 99;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
    animation: hijackSlideIn 0.3s ease-out;
}

@keyframes hijackSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.hijack-banner-text {
    font-weight: 500;
    letter-spacing: 0.3px;
}

.hijack-banner-text b {
    color: #fbbf24;
}

.hijack-release-btn {
    padding: 6px 18px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.hijack-release-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.hijack-release-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 设备信息弹窗（地图点击） ========== */
.device-info-popup {
    position: fixed;
    top: 80px;
    right: 24px;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-active);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    z-index: 1000;
    animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.device-info-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.device-info-popup-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.device-info-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.device-info-popup-close:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.device-info-popup-body {
    padding: 12px 16px;
}

.popup-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.popup-info-row:last-child {
    border-bottom: none;
}

.popup-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-right: 12px;
}

.popup-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    font-family: var(--font-mono);
}

/* ========== 改密按钮 ========== */
.btn-change-password {
    padding: 6px 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
}
.btn-change-password:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
    background: rgba(255,255,255,0.03);
}


