/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
    color: #ffffff;
    min-height: 100vh;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    display: block;
    width: min(224px, 100%);
    height: auto;
    margin: 0 auto 22px;
    object-fit: contain;
}

.login-title h1 {
    font-size: 24px;
    color: #00d4ff;
    margin-bottom: 10px;
}

.login-title p {
    color: #8b9ab0;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #b0c4de;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.switch-link {
    text-align: center;
    color: #8b9ab0;
    font-size: 14px;
}

.switch-link a {
    color: #00d4ff;
    text-decoration: none;
}

/* 导航栏 */
.navbar {
    background: rgba(10, 22, 40, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 260px;
}

.brand-logo {
    display: block;
    width: min(180px, 16vw);
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    color: inherit;
    text-decoration: none;
}

.brand-system-name {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.navbar-brand h2 {
    color: #00d4ff;
    font-size: 22px;
}

.hero-logo {
    display: block;
    width: min(521px, 86vw);
    height: auto;
    margin: 0 auto 34px;
    object-fit: contain;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.navbar-menu a {
    color: #8b9ab0;
    text-decoration: none;
    font-size: 16px;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-right .mode-switch-link {
    color: #8b9ab0;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 14px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-right .mode-switch-link:hover {
    color: #00d4ff;
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.logout-btn {
    color: #ff6b6b;
    text-decoration: none;
    font-size: 14px;
}

/* 主容器 */
.container {
    padding: 14px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* 页面标题 */
.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 24px;
    color: #ffffff;
    margin-bottom: 5px;
}

.page-header p {
    color: #8b9ab0;
    font-size: 14px;
}

/* 池子卡片 */
.pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.pool-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pool-card:hover {
    transform: translateY(-5px);
    border-color: #00d4ff;
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.2);
}

.pool-model {
    height: 180px;
    background: linear-gradient(180deg, #0d2137 0%, #1a3a5c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.pool-model svg {
    width: 120px;
    height: 120px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.water-effect {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 212, 255, 0.2) 100%);
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.pool-info {
    padding: 20px;
}

.pool-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #ffffff;
}

.pool-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #00d4ff;
}

.stat-label {
    font-size: 12px;
    color: #8b9ab0;
}

.pool-status {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border-radius: 20px;
    font-size: 12px;
}

/* 数据展板 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-bottom: 0;
}

.card-subtitle {
    margin-left: auto;
    font-size: 13px;
    color: #8b9ab0;
    font-weight: normal;
}

.right-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    grid-row: span 2;
}

.right-stack .video-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.right-stack .video-section .video-container {
    flex: 1;
    display: flex;
    min-height: 200px;
}

.right-stack .video-section .video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.card-water {
    grid-column: 1;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.data-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 20px;
}

.data-card h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #00d4ff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-card h3 .refresh-indicator {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* 主要指标网格 */
.main-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.metric-box {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.metric-box:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.02);
}

.metric-label {
    font-size: 15px;
    color: #00ff88;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 30px;
    font-weight: 700;
    color: #ffffff;
}

.metric-unit {
    font-size: 16px;
    color: #00d4ff;
    margin-left: 4px;
}

.metric-trend {
    font-size: 12px;
    margin-top: 5px;
}

.main-metrics .metric-trend {
    display: none !important;
}

.trend-up {
    color: #00ff88;
}

.trend-down {
    color: #ff6b6b;
}

/* 区间数据 */
.interval-data {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.interval-item {
    text-align: center;
    padding: 12px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.interval-name {
    font-size: 14px;
    color: #8b9ab0;
    margin-bottom: 4px;
}

.interval-count {
    font-size: 20px;
    font-weight: 700;
    color: #00d4ff;
}

.interval-area {
    font-size: 13px;
    color: #b0c4de;
}

/* 侧边指标列表 */
.side-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.side-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.side-metric:hover {
    background: rgba(255, 255, 255, 0.08);
}

.side-metric-name {
    font-size: 16px;
    color: #00ff88;
}

.side-metric-value {
    font-size: 20px;
    color: #ffffff;
    font-weight: 600;
}

.side-metric-value {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.side-metric-unit {
    font-size: 13px;
    color: #8b9ab0;
    margin-left: 3px;
}

/* 视频流区域 */
.video-section {
    /* gap handled by .right-stack */
}

.video-container {
    background: #0a1628;
    border-radius: 12px;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.live-video {
    width: 100%;
    height: auto;
    min-height: 260px;
    display: block;
    object-fit: fill;
    background: #0a1628;
    pointer-events: none;
}

.camera-control-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    min-height: 34px;
    min-width: 0;
}

.camera-control-panel[hidden] {
    display: none;
}

.camera-control-btn {
    --camera-control-bg: rgba(0, 212, 255, 0.12);
    --camera-control-bg-hover: rgba(0, 212, 255, 0.2);
    --camera-control-border: rgba(0, 212, 255, 0.45);
    --camera-control-border-hover: rgba(0, 212, 255, 0.65);
    --camera-control-text: #dff8ff;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--camera-control-border);
    border-radius: 6px;
    background: var(--camera-control-bg);
    color: var(--camera-control-text);
    font-size: 13px;
    cursor: pointer;
}

.camera-control-btn:hover {
    background: var(--camera-control-bg-hover);
    border-color: var(--camera-control-border-hover);
}

.camera-control-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.camera-control-status {
    color: #8b9ab0;
    font-size: 12px;
    line-height: 1.4;
    min-width: 0;
    overflow-wrap: anywhere;
}

html[data-theme="glacier"] .camera-control-btn {
    --camera-control-bg: #A6E3E9;
    --camera-control-bg-hover: #71C9CE;
    --camera-control-border: rgba(113, 201, 206, 0.75);
    --camera-control-border-hover: #3d8a8e;
    --camera-control-text: #1a4040;
}

html[data-theme="glacier"] .camera-control-status {
    color: #3d6a6a;
}

html[data-theme="violet"] .camera-control-btn {
    --camera-control-bg: #ACA8FF;
    --camera-control-bg-hover: #AC73FF;
    --camera-control-border: rgba(122, 58, 238, 0.45);
    --camera-control-border-hover: #7a3aee;
    --camera-control-text: #2a1a4a;
}

html[data-theme="violet"] .camera-control-status {
    color: #4a2a6a;
}

html[data-theme="galaxy"] .camera-control-btn {
    --camera-control-bg: #F5C7F7;
    --camera-control-bg-hover: #e7a7ef;
    --camera-control-border: rgba(245, 199, 247, 0.75);
    --camera-control-border-hover: #27296D;
    --camera-control-text: #27296D;
}

html[data-theme="galaxy"] .camera-control-status {
    color: #27296D;
}

html[data-theme="ocean2"] .camera-control-btn {
    --camera-control-bg: #1591DC;
    --camera-control-bg-hover: #2C5EAD;
    --camera-control-border: rgba(21, 145, 220, 0.65);
    --camera-control-border-hover: #2C5EAD;
    --camera-control-text: #ffffff;
}

html[data-theme="ocean2"] .camera-control-status {
    color: #1a3a5a;
}

html[data-theme="deepblue"] .camera-control-btn {
    --camera-control-bg: rgba(44, 116, 179, 0.24);
    --camera-control-bg-hover: rgba(44, 116, 179, 0.36);
    --camera-control-border: rgba(44, 116, 179, 0.65);
    --camera-control-border-hover: #2C74B3;
    --camera-control-text: #ffffff;
}

html[data-theme="deepblue"] .camera-control-status {
    color: #ccd6f6;
}

html[data-theme="cyber"] .camera-control-btn {
    --camera-control-bg: rgba(0, 216, 255, 0.12);
    --camera-control-bg-hover: rgba(0, 216, 255, 0.22);
    --camera-control-border: rgba(0, 216, 255, 0.35);
    --camera-control-border-hover: rgba(0, 216, 255, 0.65);
    --camera-control-text: #00D8FF;
}

html[data-theme="cyber"] .camera-control-status {
    color: #6B7F95;
}

html[data-theme="lightcyber"] .camera-control-btn {
    --camera-control-bg: linear-gradient(135deg, #0B5CFF, #00AEEF);
    --camera-control-bg-hover: linear-gradient(135deg, #0849d8, #0098d1);
    --camera-control-border: rgba(11, 92, 255, 0.38);
    --camera-control-border-hover: rgba(0, 174, 239, 0.72);
    --camera-control-text: #ffffff;
}

html[data-theme="lightcyber"] .camera-control-status {
    color: #516B86;
}

.live-video-frame {
    width: 100%;
    min-height: 260px;
    border: 0;
    display: block;
    background: #0a1628;
}

.video-placeholder {
    text-align: center;
    color: #8b9ab0;
}

.video-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* 图表容器 */
.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 18px;
    color: #ffffff;
}

.time-selector {
    display: flex;
    gap: 8px;
}

.time-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #8b9ab0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-btn:hover,
.time-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
}

.chart-area {
    height: 300px;
    position: relative;
}

/* 管理页面表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table th {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    font-weight: 600;
    font-size: 13px;
}

.admin-table td {
    color: #b0c4de;
    font-size: 14px;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #ffffff;
}

.btn-success {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #ffffff;
}

.btn-warning {
    background: linear-gradient(135deg, #ffa502 0%, #ff7f00 100%);
    color: #ffffff;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 添加按钮 */
.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 20px;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

/* 角色标签 */
.role-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.role-admin {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
}

.role-user {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-online {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.status-offline {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.status-success {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.status-error {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* 表单样式 */
.config-form {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group-full {
    margin-bottom: 20px;
}

.form-group-full label {
    display: block;
    margin-bottom: 8px;
    color: #b0c4de;
    font-size: 14px;
}

.form-group-full input,
.form-group-full select,
.form-group-full textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
}

.form-group-full input:focus,
.form-group-full select:focus,
.form-group-full textarea:focus {
    outline: none;
    border-color: #00d4ff;
}

.form-group-full select option {
    background: #ffffff;
    color: #111827;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.save-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.cancel-btn {
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #00d4ff;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: #8b9ab0;
    font-size: 24px;
    cursor: pointer;
}

/* 池子选择器 */
.pool-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pool-tab {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #8b9ab0;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.pool-tab:hover,
.pool-tab.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
}

/* 权限分配 */
.permission-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
}

.user-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.user-list h4 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 14px;
}

.user-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.user-item:hover,
.user-item.active {
    background: rgba(0, 212, 255, 0.1);
}

.pool-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.pool-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.pool-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 日志条目 */
.log-entry {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    font-size: 12px;
    color: #8b9ab0;
    margin-bottom: 5px;
}

.log-message {
    font-size: 14px;
    color: #b0c4de;
}

.log-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 10px;
}

.log-info {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
}

.log-warning {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa502;
}

.log-error {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        min-width: 0;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px;
    }

    .navbar-brand,
    .brand-link {
        width: 100%;
        min-width: 0;
        gap: 10px;
        align-items: center;
    }

    .brand-logo {
        width: min(132px, 34vw);
    }

    .brand-system-name {
        font-size: 14px;
        white-space: normal;
        line-height: 1.35;
    }

    .navbar-menu {
        position: static;
        transform: none;
        display: flex;
        width: 100%;
        gap: 6px;
        padding: 0;
    }

    .navbar-menu a {
        flex: 1 1 0;
        text-align: center;
        white-space: nowrap;
        background: rgba(255, 255, 255, 0.06);
        font-size: 14px;
        padding: 8px 0;
        border-radius: 6px;
    }

    .navbar-right {
        display: contents;
    }

    .navbar-right .mode-switch-link,
    .desktop-only {
        display: none !important;
    }

    .user-info {
        justify-content: space-between;
        width: 100%;
    }

    .container {
        padding: 14px;
    }

    .page-header h1 {
        font-size: 22px;
        line-height: 1.3;
    }

    .page-header p {
        line-height: 1.6;
    }

    .pool-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .right-stack {
        display: contents;
    }
    .right-stack .data-card {
        order: 3;
    }
    .right-stack .video-section {
        order: 2;
    }
    .card-water {
        grid-column: auto;
        order: 1;
    }
    .side-metrics {
        grid-template-columns: 1fr 1fr;
    }
    .main-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .pool-selector {
        gap: 8px;
        margin-bottom: 14px;
        padding-bottom: 6px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .pool-selector::-webkit-scrollbar {
        display: none;
    }

    .pool-tab {
        flex: 0 0 auto;
        padding: 9px 14px;
        font-size: 13px;
        max-width: min(42vw, 156px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pool-card,
    .data-card,
    .chart-container,
    .modal-content {
        border-radius: 14px;
    }

    .data-card,
    .chart-container {
        padding: 16px;
    }

    .history-page .chart-container {
        padding: 12px;
        margin-bottom: 12px;
    }

    .history-page .chart-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    .history-page .chart-title {
        font-size: 15px;
        line-height: 1.35;
    }

    .pool-stats {
        justify-content: space-between;
        gap: 10px;
    }

    .stat-item {
        flex: 1;
    }

    .metric-value,
    .side-metric-value {
        overflow-wrap: anywhere;
    }

    .interval-data {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
    }

    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .time-selector {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .time-selector::-webkit-scrollbar {
        display: none;
    }

    .time-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 6px 12px;
    }

    .chart-area {
        height: 248px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .history-page .chart-area {
        height: 206px;
    }

    .chart-area canvas {
        width: 680px;
        max-width: none;
        height: auto;
    }

    .modal {
        padding: 12px;
        align-items: center;
    }

    .modal-content {
        width: min(100%, 560px);
        max-width: calc(100vw - 24px);
        max-height: 86vh;
        padding: 16px 14px 18px;
    }

    .dashboard-page #historyModal {
        align-items: center;
    }

    .dashboard-page #historyModal .modal-content {
        width: 100%;
        max-width: calc(100vw - 16px);
        max-height: min(88vh, 640px);
        padding: 14px 12px 16px;
        border-radius: 18px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .dashboard-page #historyModal .chart-area {
        height: 240px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin: 0 auto;
    }

    .dashboard-page #historyModal .chart-area canvas {
        display: block;
        width: 100%;
        min-width: 0;
        margin: 0 auto;
    }

    .dashboard-page #historyModal .modal-header {
        width: 100%;
        justify-content: center;
        position: relative;
        text-align: center;
    }

    .dashboard-page #historyModal .modal-header h3 {
        width: 100%;
        text-align: center;
    }

    .dashboard-page #historyModal .modal-close {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    .dashboard-page #historyModal .modal-history-range {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .modal-header {
        margin-bottom: 14px;
    }

    .modal-header h3 {
        font-size: 16px;
        line-height: 1.45;
    }

    .modal-history-range {
        font-size: 12px;
        padding: 8px 10px;
        overflow-wrap: anywhere;
    }

    .video-container {
        min-height: 190px;
    }

    .live-video {
        min-height: 190px;
        object-fit: contain;
    }

    .camera-control-panel {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .camera-control-btn {
        min-width: 96px;
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }

    .camera-control-status {
        flex: 1 1 150px;
        padding-top: 7px;
    }

    .refresh-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .container {
        padding: 10px;
    }

    .chart-container {
        padding: 14px 12px;
    }

    .history-page .chart-container {
        padding: 10px;
    }

    .interval-data {
        grid-template-columns: 1fr;
    }

    .pool-stats {
        flex-direction: column;
        align-items: stretch;
    }

    .pool-tab {
        max-width: 148px;
        padding: 8px 12px;
    }

    .chart-area {
        height: 224px;
    }

    .history-page .chart-area {
        height: 188px;
    }

    .chart-area canvas {
        width: 560px;
    }

    .modal {
        padding: 8px;
    }

    .modal-content {
        max-width: calc(100vw - 16px);
        padding: 14px 12px 16px;
    }

    .dashboard-page #historyModal .modal-content {
        max-width: calc(100vw - 10px);
        padding: 12px 10px 14px;
    }

    .dashboard-page #historyModal .chart-area {
        height: 212px;
    }
}

/* 刷新提示 */
.refresh-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 255, 136, 0.9);
    color: #0a1628;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.refresh-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.hero-logo-link,
.login-logo-link {
    display: inline-flex;
    justify-content: center;
    text-decoration: none;
}

.mode-switch-link {
    border: 1px solid rgba(0, 212, 255, 0.35);
    color: #00d4ff;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.field-map-table input {
    width: 100%;
    min-width: 120px;
}

.field-map-table .field-map-actions {
    white-space: nowrap;
}

/* ── AI Analysis Modals ── */

/* Default modal body heights (was inline, now CSS) */
#aiAnomalyBody, #aiRootCauseBody, #aiPredictBody {
    max-height: 500px;
}
#aiReportBody {
    max-height: 550px;
}

#aiAnomalyBody, #aiReportBody, #aiResultArea {
    font-family: 'Segoe UI', 'Microsoft YaHei', '微软雅黑', Tahoma, sans-serif;
    line-height: 1.7;
    color: #ccd6f6;
}
#aiAnomalyBody ai-result-card, #aiResultArea .ai-result-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}
#aiReportBody h3, #aiReportBody h4, #aiReportBody h5 {
    font-family: inherit;
    color: #e6f1ff;
}
#aiReportBody strong {
    color: #fff;
}
#aiReportBody li {
    color: #ccd6f6;
    margin-left: 20px;
}
.ai-btn {
    font-family: inherit;
}
.ai-btn:hover {
    opacity: 0.85;
}

.history-analysis-btn {
    --history-analysis-bg: rgba(0, 184, 169, 0.16);
    --history-analysis-bg-hover: rgba(0, 184, 169, 0.28);
    --history-analysis-border: rgba(0, 212, 255, 0.45);
    --history-analysis-border-hover: #00b8a9;
    --history-analysis-text: #dff8ff;
    --history-analysis-text-hover: var(--history-analysis-text);
    --history-analysis-focus: rgba(0, 184, 169, 0.24);
    margin-left: 8px;
    padding: 6px 16px;
    border: 1px solid var(--history-analysis-border);
    border-radius: 6px;
    background: var(--history-analysis-bg);
    color: var(--history-analysis-text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.history-analysis-btn:hover {
    border-color: var(--history-analysis-border-hover);
    background: var(--history-analysis-bg-hover);
    color: var(--history-analysis-text-hover);
}

.history-analysis-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--history-analysis-focus);
}

html[data-theme="glacier"] .history-analysis-btn {
    --history-analysis-bg: #A6E3E9;
    --history-analysis-bg-hover: #71C9CE;
    --history-analysis-border: rgba(113, 201, 206, 0.78);
    --history-analysis-border-hover: #3d8a8e;
    --history-analysis-text: #183f42;
    --history-analysis-focus: rgba(113, 201, 206, 0.28);
}

html[data-theme="violet"] .history-analysis-btn {
    --history-analysis-bg: #ACA8FF;
    --history-analysis-bg-hover: #AC73FF;
    --history-analysis-border: rgba(122, 58, 238, 0.48);
    --history-analysis-border-hover: #7a3aee;
    --history-analysis-text: #291946;
    --history-analysis-focus: rgba(172, 115, 255, 0.28);
}

html[data-theme="galaxy"] .history-analysis-btn {
    --history-analysis-bg: #F5C7F7;
    --history-analysis-bg-hover: #e7a7ef;
    --history-analysis-border: rgba(245, 199, 247, 0.78);
    --history-analysis-border-hover: #5E63B6;
    --history-analysis-text: #27296D;
    --history-analysis-focus: rgba(94, 99, 182, 0.24);
}

html[data-theme="ocean2"] .history-analysis-btn {
    --history-analysis-bg: #1591DC;
    --history-analysis-bg-hover: #2C5EAD;
    --history-analysis-border: rgba(21, 145, 220, 0.68);
    --history-analysis-border-hover: #2C5EAD;
    --history-analysis-text: #0a1a2a;
    --history-analysis-text-hover: #ffffff;
    --history-analysis-focus: rgba(21, 145, 220, 0.28);
}

html[data-theme="deepblue"] .history-analysis-btn {
    --history-analysis-bg: rgba(44, 116, 179, 0.24);
    --history-analysis-bg-hover: rgba(44, 116, 179, 0.38);
    --history-analysis-border: rgba(44, 116, 179, 0.68);
    --history-analysis-border-hover: #5ca8e8;
    --history-analysis-text: #ffffff;
    --history-analysis-focus: rgba(44, 116, 179, 0.3);
}

html[data-theme="cyber"] .history-analysis-btn {
    --history-analysis-bg: rgba(0, 216, 255, 0.12);
    --history-analysis-bg-hover: rgba(0, 216, 255, 0.22);
    --history-analysis-border: rgba(0, 216, 255, 0.38);
    --history-analysis-border-hover: rgba(0, 216, 255, 0.68);
    --history-analysis-text: #00D8FF;
    --history-analysis-focus: rgba(0, 216, 255, 0.22);
}

html[data-theme="lightcyber"] .history-analysis-btn {
    --history-analysis-bg: linear-gradient(135deg, #0B5CFF, #006FAE);
    --history-analysis-bg-hover: linear-gradient(135deg, #0849d8, #005f96);
    --history-analysis-border: rgba(11, 92, 255, 0.4);
    --history-analysis-border-hover: rgba(0, 174, 239, 0.76);
    --history-analysis-text: #ffffff;
    --history-analysis-focus: rgba(11, 92, 255, 0.22);
}

.histogram-modal-content {
    --histogram-accent: #00d4ff;
    --histogram-accent-text: #071527;
    --histogram-run: #1677d2;
    --histogram-run-hover: #0f65b6;
    --histogram-run-text: #ffffff;
    --histogram-bar-primary: #00d4ff;
    --histogram-bar-secondary: #ff9f43;
    --histogram-mean-line: #ffd166;
    --histogram-safety-line: #ff4757;
    --histogram-chart-text: #eaf6ff;
    --histogram-grid: rgba(255, 255, 255, 0.12);
    --histogram-surface: rgba(120, 145, 180, 0.06);
    --histogram-border: rgba(128, 155, 190, 0.25);
    --histogram-tooltip-bg: rgba(8, 18, 34, 0.96);
    --histogram-tooltip-text: #ffffff;
    width: min(920px, calc(100vw - 32px));
    max-width: 920px;
    max-height: 90vh;
    padding: 22px;
}

html[data-theme="glacier"] .histogram-modal-content {
    --histogram-accent: #A6E3E9;
    --histogram-accent-text: #183f42;
    --histogram-run: #2f7074;
    --histogram-run-hover: #245c60;
    --histogram-bar-primary: #3d8a8e;
    --histogram-bar-secondary: #2C74B3;
    --histogram-mean-line: #c56a00;
    --histogram-safety-line: #d63031;
    --histogram-chart-text: #183f42;
    --histogram-grid: rgba(24, 63, 66, 0.13);
    --histogram-surface: rgba(166, 227, 233, 0.2);
    --histogram-border: rgba(61, 138, 142, 0.32);
    --histogram-tooltip-bg: rgba(227, 253, 253, 0.97);
    --histogram-tooltip-text: #183f42;
}

html[data-theme="violet"] .histogram-modal-content {
    --histogram-accent: #ACA8FF;
    --histogram-accent-text: #291946;
    --histogram-run: #7a3aee;
    --histogram-run-hover: #6428cf;
    --histogram-bar-primary: #7a3aee;
    --histogram-bar-secondary: #AC73FF;
    --histogram-mean-line: #b85c00;
    --histogram-safety-line: #d63031;
    --histogram-chart-text: #291946;
    --histogram-grid: rgba(41, 25, 70, 0.13);
    --histogram-surface: rgba(172, 168, 255, 0.13);
    --histogram-border: rgba(122, 58, 238, 0.28);
    --histogram-tooltip-bg: rgba(213, 253, 255, 0.97);
    --histogram-tooltip-text: #291946;
}

html[data-theme="galaxy"] .histogram-modal-content {
    --histogram-accent: #F5C7F7;
    --histogram-accent-text: #27296D;
    --histogram-run: #A393EB;
    --histogram-run-hover: #8c79df;
    --histogram-run-text: #27296D;
    --histogram-bar-primary: #F5C7F7;
    --histogram-bar-secondary: #A393EB;
    --histogram-chart-text: #F5C7F7;
    --histogram-grid: rgba(245, 199, 247, 0.18);
    --histogram-surface: rgba(163, 147, 235, 0.16);
    --histogram-border: rgba(245, 199, 247, 0.34);
    --histogram-tooltip-bg: rgba(39, 41, 109, 0.97);
    --histogram-tooltip-text: #F5C7F7;
}

html[data-theme="ocean2"] .histogram-modal-content {
    --histogram-accent: #2C5EAD;
    --histogram-accent-text: #ffffff;
    --histogram-run: #2C5EAD;
    --histogram-run-hover: #234d91;
    --histogram-bar-primary: #2C5EAD;
    --histogram-bar-secondary: #1591DC;
    --histogram-mean-line: #a95700;
    --histogram-safety-line: #d63031;
    --histogram-chart-text: #0a1a2a;
    --histogram-grid: rgba(10, 26, 42, 0.13);
    --histogram-surface: rgba(21, 145, 220, 0.1);
    --histogram-border: rgba(44, 94, 173, 0.3);
    --histogram-tooltip-bg: rgba(232, 242, 250, 0.97);
    --histogram-tooltip-text: #0a1a2a;
}

html[data-theme="deepblue"] .histogram-modal-content {
    --histogram-accent: #2C74B3;
    --histogram-accent-text: #ffffff;
    --histogram-run: #2C74B3;
    --histogram-run-hover: #235f94;
    --histogram-bar-primary: #5ca8e8;
    --histogram-bar-secondary: #2C74B3;
}

html[data-theme="cyber"] .histogram-modal-content {
    --histogram-accent: #00D8FF;
    --histogram-accent-text: #06111F;
    --histogram-run: #0078D4;
    --histogram-run-hover: #0063b0;
    --histogram-bar-primary: #00D8FF;
    --histogram-bar-secondary: #2F80ED;
    --histogram-chart-text: #EAF6FF;
    --histogram-grid: rgba(0, 216, 255, 0.14);
    --histogram-surface: rgba(0, 216, 255, 0.05);
    --histogram-border: rgba(0, 216, 255, 0.24);
}

html[data-theme="lightcyber"] .histogram-modal-content {
    --histogram-accent: #0B5CFF;
    --histogram-accent-text: #ffffff;
    --histogram-run: #006FAE;
    --histogram-run-hover: #005f96;
    --histogram-bar-primary: #0B5CFF;
    --histogram-bar-secondary: #00AEEF;
    --histogram-mean-line: #a95700;
    --histogram-safety-line: #d63031;
    --histogram-chart-text: #0B1F3A;
    --histogram-grid: rgba(11, 92, 255, 0.12);
    --histogram-surface: rgba(11, 92, 255, 0.04);
    --histogram-border: rgba(11, 92, 255, 0.2);
    --histogram-tooltip-bg: rgba(248, 252, 255, 0.98);
    --histogram-tooltip-text: #0B1F3A;
}

.histogram-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px 18px;
    margin-bottom: 16px;
}

.histogram-control-group {
    display: grid;
    gap: 7px;
}

.histogram-control-label {
    color: inherit;
    font-size: 12px;
    opacity: 0.72;
}

.histogram-segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.histogram-segmented button,
.histogram-run-btn {
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--histogram-border, rgba(128, 155, 190, 0.35));
    border-radius: 5px;
    background: var(--histogram-surface, rgba(120, 145, 180, 0.12));
    color: inherit;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.histogram-segmented button.active {
    border-color: var(--histogram-accent, #00b8a9);
    background: var(--histogram-accent, #00b8a9);
    color: var(--histogram-accent-text, #fff);
}

.histogram-run-btn {
    border-color: var(--histogram-run, #1677d2);
    background: var(--histogram-run, #1677d2);
    color: var(--histogram-run-text, #fff);
}

.histogram-run-btn:hover:not(:disabled) {
    border-color: var(--histogram-run-hover, #0f65b6);
    background: var(--histogram-run-hover, #0f65b6);
}

.histogram-run-btn:disabled {
    cursor: wait;
    opacity: 0.65;
}

.histogram-custom-range {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.histogram-custom-range[hidden] {
    display: none;
}

.histogram-custom-range label {
    display: grid;
    gap: 5px;
    color: inherit;
    font-size: 12px;
}

.histogram-custom-range input {
    width: 158px;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid var(--histogram-border, rgba(128, 155, 190, 0.35));
    border-radius: 5px;
    background: var(--histogram-surface, rgba(120, 145, 180, 0.12));
    color: inherit;
    color-scheme: dark;
    cursor: pointer;
}

html[data-theme="glacier"] .histogram-custom-range input,
html[data-theme="violet"] .histogram-custom-range input,
html[data-theme="ocean2"] .histogram-custom-range input,
html[data-theme="lightcyber"] .histogram-custom-range input,
html[data-theme="glacier"] .history-custom-range-form input,
html[data-theme="violet"] .history-custom-range-form input,
html[data-theme="ocean2"] .history-custom-range-form input,
html[data-theme="lightcyber"] .history-custom-range-form input {
    color-scheme: light;
}

.history-custom-range-modal-content {
    width: min(460px, calc(100vw - 24px));
    max-width: 460px;
}

.history-custom-range-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.history-custom-range-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.history-custom-range-form input {
    width: 100%;
    min-height: 38px;
    padding: 6px 9px;
    border: 1px solid rgba(128, 155, 190, 0.35);
    border-radius: 5px;
    background: rgba(120, 145, 180, 0.12);
    color: inherit;
    color-scheme: dark;
    cursor: pointer;
}

.history-custom-range-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.history-custom-cancel-btn {
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid rgba(128, 155, 190, 0.35);
    border-radius: 5px;
    background: rgba(120, 145, 180, 0.12);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.histogram-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.histogram-stat {
    min-width: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--histogram-accent, #00b8a9);
    background: var(--histogram-surface, rgba(120, 145, 180, 0.1));
}

.histogram-stat span {
    display: block;
    font-size: 11px;
    opacity: 0.7;
}

.histogram-stat strong {
    display: block;
    margin-top: 3px;
    overflow-wrap: anywhere;
    font-size: 16px;
    letter-spacing: 0;
}

.histogram-chart-wrap {
    position: relative;
    min-height: 340px;
    border: 1px solid var(--histogram-border, rgba(128, 155, 190, 0.22));
    background: var(--histogram-surface, rgba(120, 145, 180, 0.06));
    overflow: hidden;
}

.histogram-chart-wrap canvas {
    display: block;
    width: 100%;
    height: 340px;
}

.histogram-tooltip {
    position: absolute;
    z-index: 2;
    max-width: 210px;
    padding: 7px 9px;
    border: 1px solid var(--histogram-border, rgba(128, 155, 190, 0.38));
    border-radius: 4px;
    background: var(--histogram-tooltip-bg, rgba(8, 18, 34, 0.94));
    color: var(--histogram-tooltip-text, #fff);
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
}

.histogram-status {
    min-height: 20px;
    padding-top: 8px;
    color: inherit;
    font-size: 12px;
    opacity: 0.72;
}

.comprehensive-analysis-modal-content {
    --analysis-accent: #00d4ff;
    --analysis-accent-text: #071527;
    --analysis-text: #eaf6ff;
    --analysis-muted: #8ea8c3;
    --analysis-grid: rgba(255, 255, 255, 0.12);
    --analysis-border: rgba(128, 155, 190, 0.26);
    --analysis-surface: rgba(120, 145, 180, 0.08);
    --analysis-tooltip-bg: rgba(8, 18, 34, 0.97);
    --analysis-tooltip-text: #ffffff;
    --analysis-series-1: #00d4ff;
    --analysis-series-2: #ff9f1c;
    --analysis-series-3: #2ecf86;
    --analysis-series-4: #b388ff;
    --analysis-series-5: #ff5d73;
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 100%);
    border-color: var(--analysis-border);
    width: min(1120px, calc(100vw - 24px));
    max-width: 1120px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 22px;
}

.floc-pi-modal-content {
    --floc-pi-series: #ffd166;
    width: min(1240px, calc(100vw - 20px));
    max-width: 1240px;
}

html[data-theme="glacier"] .floc-pi-modal-content {
    --floc-pi-series: #9c4f00;
}

html[data-theme="violet"] .floc-pi-modal-content {
    --floc-pi-series: #9a4b00;
}

html[data-theme="galaxy"] .floc-pi-modal-content {
    --floc-pi-series: #ffd166;
}

html[data-theme="ocean2"] .floc-pi-modal-content {
    --floc-pi-series: #9c4f00;
}

html[data-theme="lightcyber"] .floc-pi-modal-content {
    --floc-pi-series: #9a4b00;
}

.floc-pi-toolbar {
    margin-top: 14px;
}

.floc-pi-status {
    min-height: 34px;
    padding: 10px 0 8px;
}

.floc-pi-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.floc-pi-chart-panel {
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.floc-pi-chart-panel .chart-header {
    min-height: 54px;
    padding: 12px 14px 8px;
}

.floc-pi-chart-panel .chart-title {
    font-size: 16px;
}

.floc-pi-chart-panel .history-range-label {
    display: block;
    flex-basis: 100%;
    margin: 4px 0 0 !important;
    color: var(--analysis-muted) !important;
}

.floc-pi-chart-panel .chart-area {
    margin: 0 12px 12px;
}

.floc-pi-chart-panel .chart-area canvas {
    display: block;
    width: 100%;
}

html[data-theme="glacier"] .comprehensive-analysis-modal-content {
    --analysis-accent: #A6E3E9;
    --analysis-accent-text: #183f42;
    --analysis-text: #183f42;
    --analysis-muted: #3d6a6a;
    --analysis-grid: rgba(24, 63, 66, 0.13);
    --analysis-border: rgba(61, 138, 142, 0.3);
    --analysis-surface: rgba(166, 227, 233, 0.2);
    --analysis-tooltip-bg: rgba(227, 253, 253, 0.98);
    --analysis-tooltip-text: #183f42;
    --analysis-series-1: #176b87;
    --analysis-series-2: #c44e00;
    --analysis-series-3: #1f7a4d;
    --analysis-series-4: #7137b8;
    --analysis-series-5: #c2185b;
    background: #E3FDFD;
}

html[data-theme="violet"] .comprehensive-analysis-modal-content {
    --analysis-accent: #ACA8FF;
    --analysis-accent-text: #291946;
    --analysis-text: #291946;
    --analysis-muted: #4a2a6a;
    --analysis-grid: rgba(41, 25, 70, 0.13);
    --analysis-border: rgba(122, 58, 238, 0.28);
    --analysis-surface: rgba(172, 168, 255, 0.14);
    --analysis-tooltip-bg: rgba(213, 253, 255, 0.98);
    --analysis-tooltip-text: #291946;
    --analysis-series-1: #6f2dbd;
    --analysis-series-2: #c44e00;
    --analysis-series-3: #007a5e;
    --analysis-series-4: #0057b8;
    --analysis-series-5: #c2185b;
    background: #D5FDFF;
}

html[data-theme="galaxy"] .comprehensive-analysis-modal-content {
    --analysis-accent: #F5C7F7;
    --analysis-accent-text: #27296D;
    --analysis-text: #F5C7F7;
    --analysis-muted: #d9b6ed;
    --analysis-grid: rgba(245, 199, 247, 0.18);
    --analysis-border: rgba(245, 199, 247, 0.34);
    --analysis-surface: rgba(163, 147, 235, 0.16);
    --analysis-tooltip-bg: rgba(39, 41, 109, 0.98);
    --analysis-tooltip-text: #F5C7F7;
    --analysis-series-1: #f5c7f7;
    --analysis-series-2: #ffd166;
    --analysis-series-3: #5ee6a8;
    --analysis-series-4: #7fdbff;
    --analysis-series-5: #ff6b7a;
    background: rgba(39, 41, 109, 0.98);
}

html[data-theme="ocean2"] .comprehensive-analysis-modal-content {
    --analysis-accent: #2C5EAD;
    --analysis-accent-text: #ffffff;
    --analysis-text: #0a1a2a;
    --analysis-muted: #1a3a5a;
    --analysis-grid: rgba(10, 26, 42, 0.13);
    --analysis-border: rgba(44, 94, 173, 0.3);
    --analysis-surface: rgba(21, 145, 220, 0.1);
    --analysis-tooltip-bg: rgba(232, 242, 250, 0.98);
    --analysis-tooltip-text: #0a1a2a;
    --analysis-series-1: #174ea6;
    --analysis-series-2: #c44e00;
    --analysis-series-3: #007a5e;
    --analysis-series-4: #7137b8;
    --analysis-series-5: #c2185b;
    background: #C4E2F5;
}

html[data-theme="cyber"] .comprehensive-analysis-modal-content {
    --analysis-accent: #00D8FF;
    --analysis-accent-text: #06111F;
    --analysis-text: #EAF6FF;
    --analysis-muted: #8EA8C3;
    --analysis-grid: rgba(0, 216, 255, 0.14);
    --analysis-border: rgba(0, 216, 255, 0.24);
    --analysis-surface: rgba(0, 216, 255, 0.05);
    --analysis-series-1: #00d8ff;
    --analysis-series-2: #ffb000;
    --analysis-series-3: #52e08a;
    --analysis-series-4: #b388ff;
    --analysis-series-5: #ff5d73;
    background: linear-gradient(180deg, #10233d, #0a1a2e);
}

html[data-theme="lightcyber"] .comprehensive-analysis-modal-content {
    --analysis-accent: #0B5CFF;
    --analysis-accent-text: #ffffff;
    --analysis-text: #0B1F3A;
    --analysis-muted: #516B86;
    --analysis-grid: rgba(11, 92, 255, 0.12);
    --analysis-border: rgba(11, 92, 255, 0.2);
    --analysis-surface: rgba(11, 92, 255, 0.05);
    --analysis-tooltip-bg: rgba(248, 252, 255, 0.98);
    --analysis-tooltip-text: #0B1F3A;
    --analysis-series-1: #0057d9;
    --analysis-series-2: #d55e00;
    --analysis-series-3: #007a5e;
    --analysis-series-4: #7137b8;
    --analysis-series-5: #c2185b;
    background: #F8FCFF;
}

.analysis-tabs {
    display: flex;
    gap: 4px;
    margin: 14px 0 16px;
    border-bottom: 1px solid var(--analysis-border);
}

.analysis-tabs button,
.analysis-segmented button,
.analysis-run-btn {
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid var(--analysis-border);
    border-radius: 5px;
    background: var(--analysis-surface);
    color: var(--analysis-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.analysis-tabs button {
    border-width: 0 0 3px;
    border-radius: 0;
    background: transparent;
}

.analysis-tabs button.active,
.analysis-segmented button.active,
.analysis-run-btn {
    border-color: var(--analysis-accent);
    background: var(--analysis-accent);
    color: var(--analysis-accent-text);
}

.analysis-run-btn:disabled {
    cursor: wait;
    opacity: 0.62;
}

.analysis-range-toolbar,
.analysis-panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.analysis-range-toolbar {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--analysis-border);
}

.analysis-panel {
    padding-top: 16px;
}

.analysis-panel[hidden],
.analysis-date-range[hidden] {
    display: none;
}

.analysis-control-group,
.analysis-select-label,
.analysis-date-range label {
    display: grid;
    gap: 6px;
}

.analysis-control-label,
.analysis-select-label,
.analysis-date-range label {
    color: var(--analysis-muted);
    font-size: 12px;
}

.analysis-segmented,
.analysis-date-range,
.analysis-metric-options,
.analysis-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.analysis-date-range input,
.analysis-select-label input,
.analysis-select-label select {
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid var(--analysis-border);
    border-radius: 5px;
    background: var(--analysis-surface);
    color: var(--analysis-text);
}

.analysis-metric-group {
    flex: 1 1 520px;
}

.analysis-metric-options label,
.analysis-check-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid var(--analysis-border);
    border-radius: 5px;
    background: var(--analysis-surface);
    color: var(--analysis-text);
    font-size: 12px;
    cursor: pointer;
}

.analysis-legend {
    min-height: 30px;
    padding: 10px 0 6px;
}

.analysis-legend button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 7px;
    border: 0;
    background: transparent;
    color: var(--analysis-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.analysis-legend button[aria-pressed="false"] {
    opacity: 0.42;
}

.analysis-legend-swatch {
    width: 18px;
    height: 3px;
    background: var(--legend-color);
}

.analysis-chart-wrap {
    position: relative;
    min-height: 390px;
    border: 1px solid var(--analysis-border);
    background: var(--analysis-surface);
    overflow: hidden;
}

.analysis-chart-wrap canvas {
    display: block;
    width: 100%;
    height: 390px;
}

.analysis-tooltip {
    position: absolute;
    z-index: 3;
    max-width: 260px;
    padding: 8px 10px;
    border: 1px solid var(--analysis-border);
    border-radius: 4px;
    background: var(--analysis-tooltip-bg);
    color: var(--analysis-tooltip-text);
    font-size: 12px;
    line-height: 1.55;
    pointer-events: none;
}

.analysis-status,
.analysis-caveat {
    min-height: 20px;
    padding-top: 8px;
    color: var(--analysis-muted);
    font-size: 12px;
}

.analysis-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.analysis-stat-item {
    min-width: 0;
    padding: 9px 10px;
    border-left: 3px solid var(--analysis-accent);
    background: var(--analysis-surface);
}

.analysis-stat-item span {
    display: block;
    color: var(--analysis-muted);
    font-size: 11px;
}

.analysis-stat-item strong {
    display: block;
    margin-top: 3px;
    color: var(--analysis-text);
    font-size: 15px;
}

@media (max-width: 680px) {
    .histogram-modal-content {
        width: calc(100vw - 16px);
        padding: 14px;
    }

    .comprehensive-analysis-modal-content {
        width: calc(100vw - 12px);
        padding: 13px;
    }

    .floc-pi-modal-content {
        width: calc(100vw - 8px);
        padding: 12px;
    }

    .floc-pi-chart-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .floc-pi-chart-panel .chart-area {
        overflow-x: auto;
    }

    .analysis-range-toolbar,
    .analysis-panel-toolbar,
    .analysis-date-range {
        align-items: stretch;
        flex-direction: column;
    }

    .analysis-metric-group {
        flex-basis: auto;
    }

    .analysis-date-range input,
    .analysis-select-label input,
    .analysis-select-label select,
    .analysis-run-btn {
        width: 100%;
    }

    .analysis-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analysis-chart-wrap,
    .analysis-chart-wrap canvas {
        min-height: 300px;
        height: 300px;
    }

    .histogram-toolbar,
    .histogram-custom-range {
        align-items: stretch;
        flex-direction: column;
    }

    .histogram-custom-range input {
        width: 100%;
    }

    .history-custom-range-form {
        grid-template-columns: 1fr;
    }

    .histogram-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .histogram-chart-wrap,
    .histogram-chart-wrap canvas {
        min-height: 280px;
        height: 280px;
    }
}
.ai-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(102,126,234,0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes ai-spin {
    to { transform: rotate(360deg); }
}
.ai-error {
    color: #ff6b6b;
    background: rgba(255,107,107,0.08);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
}

/* ── Dark Select Dropdown ── */
select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: #1a1a2e;
    color: #e6f1ff;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}
select option {
    background: #1a1a2e;
    color: #e6f1ff;
}
select:focus {
    border-color: #667eea;
}

/* ── AI Modal Responsive ── */
#aiAnomalyModalContent,
#aiReportModalContent,
#aiRootCauseModalContent,
#aiPredictModalContent {
    max-width: 700px;
    width: 95vw;
    margin: 20px auto;
}
/* ── AI Report Modal ── */
.ai-report-header {
    position: relative;
    flex-direction: column;
    gap: 12px;
    padding-right: 0;
}
.ai-report-header h3 {
    font-size: 20px;
    margin: 0;
    padding-right: 40px;
}
.ai-report-header .modal-close {
    position: absolute;
    top: -6px;
    right: -6px;
    flex-shrink: 0;
    z-index: 1;
}
.ai-report-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.ai-report-controls p {
    color: #8892b0;
    font-size: 12px;
    margin: 0;
    flex: 1;
    min-width: 180px;
}
.ai-report-controls select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1a2e;
    color: #fff;
    font-size: 13px;
}
#aiReportModal .ai-report-gen-btn {
    padding: 6px 14px !important;
    background: linear-gradient(135deg,#667eea,#764ba2) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer;
    font-size: 13px !important;
    flex: 0 0 auto;
}
#aiReportModal .ai-report-copy-btn,
#aiReportModal .ai-report-export-btn {
    padding: 6px 14px !important;
    background: rgba(255,255,255,0.06) !important;
    color: #8892b0 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 8px !important;
    cursor: pointer;
    font-size: 13px !important;
    flex: 0 0 auto;
}

/* ── AI Query Page Mobile ── */
.ai-query-container {
    max-width: 850px;
    width: 95vw;
    margin: 0 auto;
}
.ai-chat-footer .ai-input-row {
    flex-wrap: nowrap;
}
.ai-chat-footer .ai-input-row input {
    min-width: 0;
}
.ai-chat-msg .bubble {
    max-width: 85%;
    word-break: break-word;
}

/* ── Mobile breakpoints ── */
@media (max-width: 768px) {
    #aiAnomalyModalContent,
    #aiReportModalContent,
    #aiRootCauseModalContent,
    #aiPredictModalContent {
        max-width: 98vw;
        width: 98vw;
        margin: 10px auto;
        border-radius: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .ai-report-header {
        padding-right: 0;
        gap: 10px;
    }
    .ai-report-header h3 {
        font-size: 17px;
        text-align: center;
        width: 100%;
        padding-right: 36px;
    }
    .ai-report-header .modal-close {
        top: -6px;
        right: -4px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    .ai-report-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .ai-report-controls p {
        width: 100%;
        text-align: center;
        font-size: 11px;
        min-width: 0;
        flex: none;
    }
    .ai-report-controls select {
        text-align: center;
        font-size: 13px;
        padding: 8px;
        border-radius: 6px;
        flex: 0 0 auto;
    }
    #aiReportModal .ai-report-gen-btn {
        font-size: 13px !important;
        padding: 8px 14px !important;
        text-align: center;
        background: linear-gradient(135deg,#667eea,#764ba2) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 8px !important;
        flex: 0 0 auto;
    }
    #aiReportModal .ai-report-copy-btn,
    #aiReportModal .ai-report-export-btn {
        font-size: 13px !important;
        padding: 8px 14px !important;
        text-align: center;
        background: rgba(255,255,255,0.06) !important;
        color: #8892b0 !important;
        border: 1px solid rgba(255,255,255,0.12) !important;
        border-radius: 8px !important;
        flex: 0 0 auto;
    }
    #aiReportBody, #aiAnomalyBody {
        max-height: 65vh;
        overflow-y: auto;
        padding: 12px;
        font-size: 13px;
    }
    .ai-query-container {
        width: 100vw;
        padding: 0 8px;
    }
    .ai-chat-messages {
        max-height: 50vh;
    }
    .ai-chat-msg .bubble {
        max-width: 90%;
        font-size: 13px;
    }
    .ai-chat-footer .ai-site-select select {
        font-size: 12px;
        padding: 6px 10px;
    }
    .ai-chat-footer .ai-input-row input {
        font-size: 13px;
        padding: 8px 12px;
    }
    .ai-chat-footer .ai-input-row button {
        padding: 8px 14px;
        font-size: 13px;
    }
    .ai-hints span {
        font-size: 11px;
        padding: 4px 10px;
        margin: 2px;
    }
    .ai-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
}

@media (max-width: 420px) {
    .ai-report-controls {
        gap: 5px;
    }
    #aiReportModal .ai-report-gen-btn {
        font-size: 12px !important;
        padding: 7px 12px !important;
        background: linear-gradient(135deg,#667eea,#764ba2) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 8px !important;
    }
    #aiReportModal .ai-report-copy-btn,
    #aiReportModal .ai-report-export-btn {
        font-size: 12px !important;
        padding: 7px 12px !important;
        background: rgba(255,255,255,0.06) !important;
        color: #8892b0 !important;
        border: 1px solid rgba(255,255,255,0.12) !important;
        border-radius: 8px !important;
    }
    .ai-chat-msg .bubble {
        max-width: 92%;
    }
    .ai-chat-footer .ai-input-row {
        gap: 6px;
    }
}

.ai-chart-wrap {
    margin-top: 12px;
    background: rgba(8,18,34,0.54);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid rgba(102,126,234,0.15);
}
.ai-chart-wrap canvas {
    display: block;
    border-radius: 6px;
}
@media (max-width: 768px) {
    .ai-chart-wrap canvas {
        max-width: 100% !important;
        height: 200px !important;
    }
}

html[data-theme="glacier"] .ai-chart-wrap,
html[data-theme="violet"] .ai-chart-wrap,
html[data-theme="ocean2"] .ai-chart-wrap,
html[data-theme="lightcyber"] .ai-chart-wrap {
    background: #ffffff;
    border-color: rgba(21,145,220,0.18);
    box-shadow: 0 6px 18px rgba(44,94,173,0.08);
}

html[data-theme="galaxy"] .ai-chart-wrap {
    background: #F4EEFF;
    border-color: rgba(245,199,247,0.35);
}

/* ── Dark Scrollbar ── */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102,126,234,0.3);
    border-radius: 3px;
}
.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102,126,234,0.5);
}
/* Firefox */
.ai-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(102,126,234,0.3) transparent;
}

#aiRootCauseBody, #aiPredictBody {
    font-family: "Segoe UI", "Microsoft YaHei", Tahoma, sans-serif;
    line-height: 1.7;
}
@media (max-width: 768px) {
    #aiRootCauseBody, #aiPredictBody {
        max-height: 65vh !important;
    }
}

#aiAnomalyBody::-webkit-scrollbar,
#aiReportBody::-webkit-scrollbar,
#aiRootCauseBody::-webkit-scrollbar,
#aiPredictBody::-webkit-scrollbar {
    width: 5px;
}
#aiAnomalyBody::-webkit-scrollbar-track,
#aiReportBody::-webkit-scrollbar-track,
#aiRootCauseBody::-webkit-scrollbar-track,
#aiPredictBody::-webkit-scrollbar-track {
    background: transparent;
}
#aiAnomalyBody::-webkit-scrollbar-thumb,
#aiReportBody::-webkit-scrollbar-thumb,
#aiRootCauseBody::-webkit-scrollbar-thumb,
#aiPredictBody::-webkit-scrollbar-thumb {
    background: rgba(102,126,234,0.3);
    border-radius: 3px;
}
#aiAnomalyBody::-webkit-scrollbar-thumb:hover,
#aiReportBody::-webkit-scrollbar-thumb:hover,
#aiRootCauseBody::-webkit-scrollbar-thumb:hover,
#aiPredictBody::-webkit-scrollbar-thumb:hover {
    background: rgba(102,126,234,0.5);
}
#aiAnomalyBody, #aiReportBody, #aiRootCauseBody, #aiPredictBody {
    scrollbar-width: thin;
    scrollbar-color: rgba(102,126,234,0.3) transparent;
}


/* ── Mobile Fixes ── */

/* Override inline max-height on modal bodies for mobile */
@media (max-width: 768px) {
    #aiReportBody, #aiAnomalyBody, #aiRootCauseBody, #aiPredictBody {
        max-height: 55vh !important;
        font-size: 13px;
    }
    /* Dashboard AI buttons: stack below title on mobile */
    .card-water h3 .ai-btn {
        display: inline-block;
        margin-left: 0 !important;
        margin-top: 4px;
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    #aiChatModal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: min(76vh, 640px) !important;
        max-height: calc(100vh - 12px) !important;
    }

    #aiChatModal > div:last-child {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    #aiChatInput {
        min-width: 0 !important;
        font-size: 13px !important;
    }

    #aiChatVoiceBtn,
    #aiChatSendBtn {
        flex: 0 0 auto;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    /* Report modal header: allow buttons to wrap */
    .ai-report-controls {
        gap: 5px;
    }
    #aiReportModal .ai-report-gen-btn {
        font-size: 11px !important;
        padding: 5px 10px !important;
        background: linear-gradient(135deg,#667eea,#764ba2) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 8px !important;
    }
    #aiReportModal .ai-report-copy-btn,
    #aiReportModal .ai-report-export-btn {
        font-size: 11px !important;
        padding: 5px 10px !important;
        background: rgba(255,255,255,0.06) !important;
        color: #8892b0 !important;
        border: 1px solid rgba(255,255,255,0.12) !important;
        border-radius: 8px !important;
    }
    /* Anomaly modal header */
    #aiAnomalyModal .modal-header h3,
    #aiRootCauseModal .modal-header h3,
    #aiPredictModal .modal-header h3 {
        font-size: 15px;
    }
    #aiAnomalyModal .modal-header,
    #aiRootCauseModal .modal-header,
    #aiPredictModal .modal-header {
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 420px) {
    .ai-report-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    .ai-report-controls select,
    .ai-report-controls button {
        text-align: center;
        flex: 0 0 auto;
    }
    #aiReportModal .ai-report-gen-btn {
        background: linear-gradient(135deg,#667eea,#764ba2) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 8px !important;
    }
    /* Hide h3 text on very narrow screens, keep buttons */
    .card-water h3 {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }
}


/* ═══════════════════════════════════════════
   UI Polish - hover effects, transitions, glow
   ═══════════════════════════════════════════ */

/* Buttons - smooth hover */
button, .btn, .save-btn, .ai-btn {
    transition: all 0.2s ease;
}
button:hover, .btn:hover, .save-btn:hover, .ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    filter: brightness(1.1);
}
button:active, .btn:active, .save-btn:active, .ai-btn:active {
    transform: translateY(0);
}

/* Cards - subtle border glow on hover */
.data-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.data-card:hover {
    border-color: rgba(102,126,234,0.3);
    box-shadow: 0 2px 20px rgba(102,126,234,0.06);
}

/* Table rows - hover highlight */
.admin-table tbody tr {
    transition: background 0.15s ease;
}
.admin-table tbody tr:hover {
    background: rgba(102,126,234,0.08);
}

/* Form inputs - focus glow */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
    outline: none;
}

/* Navbar - active tab underline */
.navbar-menu a {
    transition: color 0.2s ease;
    position: relative;
}
.navbar-menu a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #667eea;
    transition: all 0.25s ease;
    transform: translateX(-50%);
}
.navbar-menu a:hover::after,
.navbar-menu a.active::after {
    width: 100%;
}

/* Modal - smoother open */
.modal {
    transition: opacity 0.25s ease;
}
.modal-content {
    transition: transform 0.25s ease;
}

/* Pool cards - lift on hover */
.pool-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.pool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,212,255,0.1);
    border-color: rgba(0,212,255,0.3);
}

/* Scrollbar for all scrollable areas */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(102,126,234,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(102,126,234,0.4); }
* { scrollbar-width: thin; scrollbar-color: rgba(102,126,234,0.2) transparent; }


/* ═══════════════════════════════════════════
   Card & Modal Enhancement
   ═══════════════════════════════════════════ */

/* Cards - glassmorphism + left accent */
.data-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px;
}
.data-card:hover {
    border-color: rgba(102,126,234,0.7);
    box-shadow: 0 0 28px rgba(102,126,234,0.2), 0 0 0 1px rgba(102,126,234,0.3);
}
.data-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}


/* Modal - backdrop blur + entrance animation */
.modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(5, 10, 25, 0.85) !important;
}
.modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(102,126,234,0.1);
    border: 1px solid rgba(255,255,255,0.08);
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal close button */
.modal-close {
    width: 26px; height: 26px;
    position: relative;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}
.modal-close::before, .modal-close::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 12px; height: 1.5px;
    background: #8892b0;
    border-radius: 1px;
    transition: background 0.2s ease;
}
.modal-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.modal-close::after  { transform: translate(-50%,-50%) rotate(-45deg); }
.modal-close:hover::before, .modal-close:hover::after {
    background: #ff6b6b;
}
.modal-close:hover {
    background: rgba(255,107,107,0.15);
    border-color: rgba(255,107,107,0.3);
}

/* Card header row (title + actions) */
.card-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.card-header-row h3 { margin-bottom: 0; }

/* Metric boxes - glass */
.metric-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s, background 0.2s;
}
.metric-box:hover {
    border-color: rgba(102,126,234,0.35);
    background: rgba(102,126,234,0.04);
    box-shadow: 0 0 16px rgba(102,126,234,0.1);
}

/* Pool cards enhancement */
.pool-card {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.pool-card:hover {
    border-color: rgba(0,212,255,0.5);
    box-shadow: 0 12px 40px rgba(0,212,255,0.15);
}

/* Toast notification polish */
.refresh-toast {
    border-radius: 12px;
    padding: 12px 20px;
    background: rgba(102,126,234,0.95);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(102,126,234,0.3);
    backdrop-filter: blur(8px);
}





/* ═══════════════════════════════════════════
   轻智主题 — 浅色工业AI平台
   ═══════════════════════════════════════════ */
html[data-theme="lightcyber"] body {
    background: radial-gradient(circle at 12% 6%, rgba(0,174,239,0.05), transparent 38%),
                radial-gradient(circle at 88% 18%, rgba(11,92,255,0.03), transparent 35%),
                linear-gradient(180deg, #F8FCFF 0%, #EEF8FF 48%, #F4F9FD 100%);
    color: #0B1F3A; position: relative;
}
html[data-theme="lightcyber"] body::after {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: linear-gradient(rgba(0,139,255,0.025) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0,139,255,0.025) 1px, transparent 1px);
    background-size: 56px 56px;
}
html[data-theme="lightcyber"] .container { position: relative; z-index: 1; }
html[data-theme="lightcyber"] .navbar {
    background: linear-gradient(180deg, #0B1F3A 0%, #0F2A4D 100%) !important;
    border-bottom: 1px solid rgba(0,174,239,0.35) !important;
    position: relative; z-index: 100;
}
html[data-theme="lightcyber"] .navbar-menu a { color: #8EA8C3 !important; }
html[data-theme="lightcyber"] .navbar-menu a:hover { color: #ffffff !important; }
html[data-theme="lightcyber"] .navbar-menu a.active { color: #00AEEF !important; background: rgba(0,174,239,0.12) !important; }
html[data-theme="lightcyber"] .brand-system-name { color: #ffffff !important; }
html[data-theme="lightcyber"] .navbar-right .mode-switch-link,
html[data-theme="lightcyber"] .navbar-right .theme-switch-link {
    color: #ffffff !important; border-color: rgba(255,255,255,0.2) !important; background: rgba(255,255,255,0.06) !important;
}
html[data-theme="lightcyber"] .navbar-right .mode-switch-link:hover,
html[data-theme="lightcyber"] .navbar-right .theme-switch-link:hover { color: #00AEEF !important; border-color: #00AEEF !important; }
html[data-theme="lightcyber"] .logout-btn,
html[data-theme="lightcyber"] .user-info { color: #8EA8C3 !important; }
html[data-theme="lightcyber"] .page-header h1 { color: #083B74 !important; font-weight: 700; }
html[data-theme="lightcyber"] .page-header p,
html[data-theme="lightcyber"] .page-header label { color: #516B86 !important; }
html[data-theme="lightcyber"] .data-card {
    background: rgba(255,255,255,0.84) !important;
    border: 1px solid rgba(0,139,255,0.14) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 10px rgba(15,84,140,0.05), inset 0 0 0 1px rgba(255,255,255,0.7) !important;
    color: #0B1F3A !important;
    backdrop-filter: blur(10px);
}
html[data-theme="lightcyber"] .data-card:hover { border-color: rgba(0,139,255,0.26) !important; }
html[data-theme="lightcyber"] .data-card h3,
html[data-theme="lightcyber"] .chart-title { color: #083B74 !important; font-weight: 700; }
html[data-theme="lightcyber"] .metric-label,
html[data-theme="lightcyber"] .side-metric-name,
html[data-theme="lightcyber"] .interval-name { color: #516B86 !important; }
html[data-theme="lightcyber"] .metric-value,
html[data-theme="lightcyber"] .side-metric-value { color: #083B74 !important; font-weight: 700; }
html[data-theme="lightcyber"] .metric-unit,
html[data-theme="lightcyber"] .side-metric-unit { color: #0B5CFF !important; }
html[data-theme="lightcyber"] .metric-box {
    background: linear-gradient(180deg, #F8FCFF 0%, #EEF7FF 100%) !important;
    border: 1px solid rgba(0,139,255,0.10) !important; border-radius: 10px !important;
}
html[data-theme="lightcyber"] .side-metric,
html[data-theme="lightcyber"] .interval-item {
    background: linear-gradient(180deg, #F8FCFF 0%, #EEF7FF 100%) !important;
    border-color: rgba(0,139,255,0.10) !important;
}
html[data-theme="lightcyber"] .pool-tab { background: rgba(255,255,255,0.6) !important; color: #516B86 !important; border: 1px solid rgba(0,139,255,0.14) !important; }
html[data-theme="lightcyber"] .pool-tab.active {
    background: linear-gradient(135deg, #0B5CFF, #00AEEF) !important; color: #fff !important;
    border-color: rgba(0,174,239,0.45) !important; box-shadow: 0 0 10px rgba(0,174,239,0.18) !important;
}
html[data-theme="lightcyber"] input,
html[data-theme="lightcyber"] select { background: rgba(255,255,255,0.8) !important; color: #0B1F3A !important; border-color: rgba(0,139,255,0.16) !important; }
html[data-theme="lightcyber"] .modal-content {
    background: rgba(255,255,255,0.94) !important; border: 1px solid rgba(0,139,255,0.2) !important;
    color: #0B1F3A !important; border-radius: 14px; backdrop-filter: blur(14px);
}
html[data-theme="lightcyber"] .modal-header h3 { color: #083B74 !important; }
html[data-theme="lightcyber"] .admin-table th { color: #0B5CFF !important; }
html[data-theme="lightcyber"] .admin-table td { color: #0B1F3A !important; border-color: rgba(0,139,255,0.08) !important; }
html[data-theme="lightcyber"] .chart-container,
html[data-theme="lightcyber"] .chart-area { background: rgba(248,252,255,0.6) !important; border-color: rgba(0,139,255,0.10) !important; }
html[data-theme="lightcyber"] #aiFloatBtn {
    background: linear-gradient(135deg, #0B5CFF, #00AEEF) !important;
    border-color: rgba(255,255,255,0.5) !important;
    box-shadow: 0 0 18px rgba(0,174,239,0.28), 0 0 36px rgba(11,92,255,0.10) !important;
}
html[data-theme="lightcyber"] #aiFloatBtn:hover { box-shadow: 0 0 26px rgba(0,174,239,0.40) !important; }
html[data-theme="lightcyber"] #aiFloatBtn span { color: #fff !important; }
html[data-theme="lightcyber"] .refresh-indicator { background: linear-gradient(135deg, #0B5CFF, #00AEEF) !important; }
html[data-theme="lightcyber"] .ai-chat-area {
    background: rgba(255,255,255,0.86) !important; border: 1px solid rgba(0,139,255,0.16) !important;
    border-radius: 14px; backdrop-filter: blur(12px);
}
html[data-theme="lightcyber"] .ai-chat-msg.assistant .bubble { color: #0B1F3A !important; background: rgba(255,255,255,0.88) !important; border-color: rgba(0,139,255,0.2) !important; }
html[data-theme="lightcyber"] .ai-chat-msg.user .bubble { color: #0B1F3A !important; background: rgba(11,92,255,0.10) !important; }
html[data-theme="lightcyber"] .ai-chat-bubble.assistant { color: #0B1F3A !important; background: rgba(255,255,255,0.88) !important; border-color: rgba(0,139,255,0.2) !important; }
html[data-theme="lightcyber"] .ai-chat-bubble.user { color: #0B1F3A !important; background: rgba(11,92,255,0.10) !important; }

html[data-theme="glacier"] .ai-chat-msg.assistant .bubble,
html[data-theme="glacier"] .ai-chat-bubble.assistant {
    color: #123F46 !important;
    background: #F7FFFF !important;
    border-color: rgba(113,201,206,0.45) !important;
}
html[data-theme="glacier"] .ai-chat-msg.user .bubble,
html[data-theme="glacier"] .ai-chat-bubble.user {
    color: #123F46 !important;
    background: #D9F8FA !important;
    border-color: rgba(113,201,206,0.55) !important;
}

html[data-theme="violet"] .ai-chat-msg.assistant .bubble,
html[data-theme="violet"] .ai-chat-bubble.assistant {
    color: #24134C !important;
    background: #F4FDFF !important;
    border-color: rgba(172,168,255,0.55) !important;
}
html[data-theme="violet"] .ai-chat-msg.user .bubble,
html[data-theme="violet"] .ai-chat-bubble.user {
    color: #24134C !important;
    background: #E8E6FF !important;
    border-color: rgba(172,168,255,0.65) !important;
}

html[data-theme="ocean2"] .ai-chat-msg.assistant .bubble,
html[data-theme="ocean2"] .ai-chat-bubble.assistant {
    color: #071F3A !important;
    background: #F6FBFF !important;
    border-color: rgba(21,145,220,0.42) !important;
}
html[data-theme="ocean2"] .ai-chat-msg.user .bubble,
html[data-theme="ocean2"] .ai-chat-bubble.user {
    color: #071F3A !important;
    background: #DDEEFF !important;
    border-color: rgba(44,94,173,0.48) !important;
}

html[data-theme="glacier"] #aiChatInput,
html[data-theme="glacier"] #aiQuestionInput,
html[data-theme="glacier"] .ai-chat-footer .ai-input-row input {
    color: #123F46 !important;
    background: rgba(255,255,255,0.88) !important;
    border-color: rgba(113,201,206,0.72) !important;
    caret-color: #0B6F78 !important;
}
html[data-theme="glacier"] #aiChatInput::placeholder,
html[data-theme="glacier"] #aiQuestionInput::placeholder,
html[data-theme="glacier"] .ai-chat-footer .ai-input-row input::placeholder {
    color: #5E858A !important;
}
html[data-theme="glacier"] #aiChatInput:focus,
html[data-theme="glacier"] #aiQuestionInput:focus,
html[data-theme="glacier"] .ai-chat-footer .ai-input-row input:focus {
    border-color: #2BAAB4 !important;
    box-shadow: 0 0 0 2px rgba(113,201,206,0.22) !important;
}

html[data-theme="violet"] #aiChatInput,
html[data-theme="violet"] #aiQuestionInput,
html[data-theme="violet"] .ai-chat-footer .ai-input-row input {
    color: #24134C !important;
    background: rgba(255,255,255,0.9) !important;
    border-color: rgba(172,168,255,0.74) !important;
    caret-color: #6E4FD8 !important;
}
html[data-theme="violet"] #aiChatInput::placeholder,
html[data-theme="violet"] #aiQuestionInput::placeholder,
html[data-theme="violet"] .ai-chat-footer .ai-input-row input::placeholder {
    color: #766A9D !important;
}
html[data-theme="violet"] #aiChatInput:focus,
html[data-theme="violet"] #aiQuestionInput:focus,
html[data-theme="violet"] .ai-chat-footer .ai-input-row input:focus {
    border-color: #7B61FF !important;
    box-shadow: 0 0 0 2px rgba(172,168,255,0.26) !important;
}

html[data-theme="ocean2"] #aiChatInput,
html[data-theme="ocean2"] #aiQuestionInput,
html[data-theme="ocean2"] .ai-chat-footer .ai-input-row input {
    color: #071F3A !important;
    background: rgba(255,255,255,0.9) !important;
    border-color: rgba(21,145,220,0.68) !important;
    caret-color: #0B65A3 !important;
}
html[data-theme="ocean2"] #aiChatInput::placeholder,
html[data-theme="ocean2"] #aiQuestionInput::placeholder,
html[data-theme="ocean2"] .ai-chat-footer .ai-input-row input::placeholder {
    color: #55728E !important;
}
html[data-theme="ocean2"] #aiChatInput:focus,
html[data-theme="ocean2"] #aiQuestionInput:focus,
html[data-theme="ocean2"] .ai-chat-footer .ai-input-row input:focus {
    border-color: #1591DC !important;
    box-shadow: 0 0 0 2px rgba(21,145,220,0.22) !important;
}

html[data-theme="glacier"] .ai-chat-msg .bubble-title,
html[data-theme="violet"] .ai-chat-msg .bubble-title,
html[data-theme="ocean2"] .ai-chat-msg .bubble-title {
    color: inherit !important;
    opacity: 0.7 !important;
}
html[data-theme="lightcyber"] .ai-chat-footer { border-top: 1px solid rgba(0,139,255,0.10) !important; }
html[data-theme="lightcyber"] .ai-chat-footer input { background: rgba(255,255,255,0.8) !important; color: #0B1F3A !important; }
html[data-theme="lightcyber"] .ai-hints span { background: rgba(11,92,255,0.06) !important; color: #516B86 !important; }
html[data-theme="lightcyber"] .ai-hints span:hover { background: rgba(11,92,255,0.12) !important; color: #0B5CFF !important; }
html[data-theme="lightcyber"] .video-container,
html[data-theme="lightcyber"] .live-video {
    border: 1px solid rgba(0,174,239,0.38) !important; border-radius: 10px;
    box-shadow: 0 0 16px rgba(0,174,239,0.10), inset 0 0 16px rgba(0,174,239,0.03);
    background: #020B14;
}
html[data-theme="lightcyber"] #modalMetricTitle { color: #083B74 !important; }
html[data-theme="lightcyber"] #alarmDetailBody,
html[data-theme="lightcyber"] #alarmDetailBody span { color: #0B1F3A !important; }
html[data-theme="lightcyber"] #aiReportBody * { color: #0B1F3A !important; }
html[data-theme="lightcyber"] #aiReportBody h1,
html[data-theme="lightcyber"] #aiReportBody h2 { color: #083B74 !important; }
html[data-theme="lightcyber"] #aiReportBody h3 { color: #0B5CFF !important; }
html[data-theme="lightcyber"] .ai-report-controls p { color: #516B86 !important; }


.navbar-right .theme-switch-link {
    color: #8b9ab0;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 14px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}
.navbar-right .theme-switch-link:hover {
    color: #00d4ff;
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.08);
}


html[data-theme=ocean2] .navbar-right .mode-switch-link,
html[data-theme=ocean2] .navbar-right .theme-switch-link { color: #ffffff !important; border-color: rgba(255,255,255,0.3) !important; }
html[data-theme=ocean2] .navbar-right .mode-switch-link:hover,
html[data-theme=ocean2] .navbar-right .theme-switch-link:hover { color: #ffffff !important; border-color: #ffffff !important; }

html[data-theme=lightcyber] .logout-btn{color:#ff6b6b!important}
html[data-theme=violet] .navbar-right .mode-switch-link,html[data-theme=violet] .navbar-right .theme-switch-link{color:#fff!important;border-color:rgba(255,255,255,0.3)!important}html[data-theme=violet] .navbar-right .mode-switch-link:hover,html[data-theme=violet] .navbar-right .theme-switch-link:hover{color:#fff!important;border-color:#fff!important}

/* ═══════════════════════════════════════════
   智控主题 v2 — 深蓝黑工业AI驾驶舱
   ═══════════════════════════════════════════ */

/* ── 背景：深蓝黑 + 弱光晕 + 低透明度网格 ── */
html[data-theme="cyber"] body {
    background:
        radial-gradient(circle at 15% 6%, rgba(0,216,255,0.12), transparent 32%),
        radial-gradient(circle at 85% 15%, rgba(47,128,237,0.08), transparent 34%),
        linear-gradient(180deg, #071527 0%, #0A1A2E 40%, #06111F 100%);
    color: #EAF6FF; position: relative;
}
html[data-theme="cyber"] body::after {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
        linear-gradient(rgba(80,180,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(80,180,255,0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}
html[data-theme="cyber"] .container { position: relative; z-index: 1; }

/* ── 导航：选中项青蓝高亮+微发光 ── */
html[data-theme="cyber"] .navbar {
    background: rgba(6,17,31,0.95) !important;
    border-bottom: 1px solid rgba(0,216,255,0.30) !important;
    box-shadow: 0 0 18px rgba(0,216,255,0.06);
    position: relative; z-index: 100;
}
html[data-theme="cyber"] .navbar-menu a { color: #6B7F95 !important; transition: all 0.2s; }
html[data-theme="cyber"] .navbar-menu a:hover { color: #BDEFFF !important; }
html[data-theme="cyber"] .navbar-menu a.active {
    color: #00D8FF !important;
    background: rgba(0,216,255,0.09) !important;
    box-shadow: 0 0 12px rgba(0,216,255,0.15);
}
html[data-theme="cyber"] .brand-system-name { color: #EAF6FF !important; }
html[data-theme="cyber"] .navbar-right .mode-switch-link,
html[data-theme="cyber"] .navbar-right .theme-switch-link {
    color: #6B7F95 !important; border-color: rgba(64,169,255,0.25) !important;
    background: rgba(16,35,61,0.5) !important;
}
html[data-theme="cyber"] .navbar-right .mode-switch-link:hover,
html[data-theme="cyber"] .navbar-right .theme-switch-link:hover {
    color: #00D8FF !important; border-color: rgba(0,216,255,0.5) !important;
}
html[data-theme="cyber"] .logout-btn,
html[data-theme="cyber"] .user-info { color: #6B7F95 !important; }

/* ── 页面标题 ── */
html[data-theme="cyber"] .page-header h1 { color: #00D8FF !important; font-weight: 700; }
html[data-theme="cyber"] .page-header p,
html[data-theme="cyber"] .page-header label { color: #6B7F95 !important; }

/* ── 大卡片：深蓝玻璃面板（比背景亮一层） ── */
html[data-theme="cyber"] .data-card {
    background: linear-gradient(180deg, rgba(20,42,68,0.88), rgba(12,28,48,0.84)) !important;
    border: 1px solid rgba(64,169,255,0.22) !important;
    border-radius: 14px !important;
    box-shadow:
        0 0 0 1px rgba(0,216,255,0.03) inset,
        0 8px 24px rgba(0,0,0,0.20) !important;
    color: #EAF6FF !important;
    backdrop-filter: blur(12px);
}
html[data-theme="cyber"] .data-card:hover {
    border-color: rgba(0,216,255,0.38) !important;
    box-shadow: 0 0 14px rgba(0,216,255,0.08), 0 8px 24px rgba(0,0,0,0.24) !important;
}

/* ── 模块标题：电光青 ── */
html[data-theme="cyber"] .data-card h3,
html[data-theme="cyber"] .chart-title {
    color: #00D8FF !important; font-weight: 700;
    text-shadow: 0 0 6px rgba(0,216,255,0.18);
}

/* ── 标签：灰蓝色（不用绿色） ── */
html[data-theme="cyber"] .metric-label,
html[data-theme="cyber"] .side-metric-name,
html[data-theme="cyber"] .interval-name { color: #6B7F95 !important; }

/* ── 数值：近白色，加粗 ── */
html[data-theme="cyber"] .metric-value,
html[data-theme="cyber"] .side-metric-value {
    color: #F2FBFF !important; font-weight: 700;
}

/* ── 单位：电光青 ── */
html[data-theme="cyber"] .metric-unit,
html[data-theme="cyber"] .side-metric-unit { color: #00D8FF !important; }

/* ── 小指标卡：比大卡片再亮一层 ── */
html[data-theme="cyber"] .metric-box {
    background: rgba(24,48,76,0.82) !important;
    border: 1px solid rgba(100,160,220,0.10) !important;
    border-radius: 10px !important;
}
html[data-theme="cyber"] .side-metric,
html[data-theme="cyber"] .interval-item {
    background: rgba(24,48,76,0.82) !important;
    border-color: rgba(100,160,220,0.08) !important;
}

/* ── 池子Tab ── */
html[data-theme="cyber"] .pool-tab {
    background: rgba(20,42,68,0.5) !important;
    color: #6B7F95 !important;
    border: 1px solid rgba(64,169,255,0.18) !important;
}
html[data-theme="cyber"] .pool-tab.active {
    background: linear-gradient(135deg, #0078D4, #00C8F0) !important;
    color: #FFFFFF !important;
    border-color: rgba(0,216,255,0.5) !important;
    box-shadow: 0 0 12px rgba(0,216,255,0.22), inset 0 0 8px rgba(255,255,255,0.06) !important;
}

/* ── 输入框/下拉 ── */
html[data-theme="cyber"] input,
html[data-theme="cyber"] select {
    background: rgba(14,30,50,0.7) !important;
    color: #EAF6FF !important;
    border-color: rgba(64,169,255,0.2) !important;
}

/* ── 弹窗 ── */
html[data-theme="cyber"] .modal-content {
    background: linear-gradient(180deg, rgba(20,42,68,0.95), rgba(10,24,42,0.95)) !important;
    border: 1px solid rgba(0,216,255,0.28) !important;
    color: #EAF6FF !important; border-radius: 14px;
    backdrop-filter: blur(16px);
}
html[data-theme="cyber"] .modal-header h3 { color: #00D8FF !important; }

/* ── 管理表格 ── */
html[data-theme="cyber"] .admin-table th { color: #00D8FF !important; }
html[data-theme="cyber"] .admin-table td {
    color: #EAF6FF !important; border-color: rgba(64,169,255,0.08) !important;
}

/* ── 图表区 ── */
html[data-theme="cyber"] .chart-container,
html[data-theme="cyber"] .chart-area {
    background: rgba(14,30,50,0.5) !important;
    border-color: rgba(64,169,255,0.16) !important;
}
html[data-theme="cyber"] .chart-header { border-color: rgba(64,169,255,0.10) !important; }

/* ── AI悬浮按钮 ── */
html[data-theme="cyber"] #aiFloatBtn {
    background: rgba(6,17,31,0.92) !important;
    border-color: rgba(0,216,255,0.35) !important;
    box-shadow: 0 0 14px rgba(0,216,255,0.12) !important;
}
html[data-theme="cyber"] #aiFloatBtn:hover {
    box-shadow: 0 0 22px rgba(0,216,255,0.25) !important;
    border-color: rgba(0,216,255,0.55) !important;
}
html[data-theme="cyber"] #aiFloatBtn span { color: #00D8FF !important; }

/* ── 刷新提示：深色半透明科技条 ── */
html[data-theme="cyber"] .refresh-indicator {
    background: rgba(16,35,61,0.85) !important;
    border: 1px solid rgba(0,216,255,0.30) !important;
    color: #00D8FF !important;
    box-shadow: 0 0 10px rgba(0,216,255,0.12);
    border-radius: 8px !important;
}
html[data-theme="cyber"] .refresh-toast {
    background: rgba(16,35,61,0.90) !important;
    border: 1px solid rgba(0,216,255,0.30) !important;
    color: #BDEFFF !important;
    box-shadow: 0 0 14px rgba(0,216,255,0.15);
}

/* ── AI聊天区 ── */
html[data-theme="cyber"] .ai-chat-area {
    background: rgba(14,30,50,0.85) !important;
    border: 1px solid rgba(0,216,255,0.25) !important;
    border-radius: 14px; backdrop-filter: blur(12px);
    box-shadow: 0 0 18px rgba(0,216,255,0.06), 0 8px 28px rgba(0,0,0,0.25);
}
html[data-theme="cyber"] .ai-chat-footer { border-top: 1px solid rgba(0,216,255,0.15) !important; }
html[data-theme="cyber"] .ai-chat-footer input {
    background: rgba(14,30,50,0.7) !important; color: #EAF6FF !important;
    border-color: rgba(0,216,255,0.2) !important;
}
html[data-theme="cyber"] .ai-hints span {
    background: rgba(0,216,255,0.06) !important; color: #6B7F95 !important;
}
html[data-theme="cyber"] .ai-hints span:hover {
    background: rgba(0,216,255,0.14) !important; color: #00D8FF !important;
}

/* ── AI气泡 ── */
html[data-theme="cyber"] .ai-chat-msg.assistant .bubble {
    color: #EAF6FF !important;
    background: rgba(20,42,68,0.85) !important;
    border-color: rgba(0,216,255,0.25) !important;
}
html[data-theme="cyber"] .ai-chat-msg.user .bubble {
    color: #EAF6FF !important;
    background: rgba(0,216,255,0.14) !important;
}
html[data-theme="cyber"] .ai-chat-bubble.assistant {
    color: #EAF6FF !important;
    background: rgba(20,42,68,0.85) !important;
    border-color: rgba(0,216,255,0.25) !important;
}
html[data-theme="cyber"] .ai-chat-bubble.user {
    color: #EAF6FF !important;
    background: rgba(0,216,255,0.14) !important;
}

/* ── 视频/矾花 AI视觉监控窗口 ── */
html[data-theme="cyber"] .video-container,
html[data-theme="cyber"] .live-video {
    border: 1px solid rgba(0,216,255,0.42) !important;
    border-radius: 10px;
    box-shadow:
        0 0 16px rgba(0,216,255,0.12),
        inset 0 0 14px rgba(0,216,255,0.03);
    background: #020B14;
}

/* ── 特殊覆盖 ── */
html[data-theme="cyber"] #modalMetricTitle { color: #00D8FF !important; }
html[data-theme="cyber"] #alarmDetailBody,
html[data-theme="cyber"] #alarmDetailBody span { color: #EAF6FF !important; }
html[data-theme="cyber"] #aiReportBody * { color: #EAF6FF !important; }
html[data-theme="cyber"] #aiReportBody h1,
html[data-theme="cyber"] #aiReportBody h2 { color: #00D8FF !important; }
html[data-theme="cyber"] #aiReportBody h3 { color: #2F80ED !important; }
