/* ============================================================
   退出预警页面  (ew-*)
   ============================================================ */

.ew-page {
    padding: 20px 24px;
    min-height: 100%;
    color: var(--text-primary, #e2e8f0);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
}

/* ── 头部 ─────────────────────────────────────────────────── */
.ew-header { margin-bottom: 16px; }

.ew-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ew-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    white-space: nowrap;
}

/* ── 汇总统计卡片 ─────────────────────────────────────────── */
.ew-stats { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }

.ew-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    user-select: none;
}
.ew-stat:hover { opacity: .85; transform: translateY(-1px); }

.ew-stat-red    { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.3); }
.ew-stat-orange { background: rgba(249,115,22,.12); border-color: rgba(249,115,22,.3); }
.ew-stat-yellow { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.ew-stat-ok     { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); }

.ew-stat-num { font-size: 15px; font-weight: 700; line-height: 1; }
.ew-stat-red    .ew-stat-num { color: #ef4444; }
.ew-stat-orange .ew-stat-num { color: #f97316; }
.ew-stat-yellow .ew-stat-num { color: #f59e0b; }
.ew-stat-ok     .ew-stat-num { color: #10b981; }
.ew-stat-lbl { font-size: 11px; color: #64748b; }

.ew-refresh-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
    margin-left: auto;
}
.ew-refresh-btn:hover { background: rgba(255,255,255,.1); color: #e2e8f0; }

/* ── 筛选行 ───────────────────────────────────────────────── */
.ew-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ew-select {
    padding: 5px 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}
.ew-select:focus { border-color: #3b82f6; }

.ew-search {
    padding: 5px 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 12px;
    outline: none;
    width: 200px;
}
.ew-search:focus { border-color: #3b82f6; }
.ew-search::placeholder { color: #475569; }

/* ── 上方网格：图表 + 规则 ────────────────────────────────── */
.ew-top-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.ew-chart-card,
.ew-rules-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 14px 16px;
}

.ew-chart-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 160px;
    overflow: hidden;
}

.ew-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

/* ── 规则列表 ─────────────────────────────────────────────── */
.ew-rules-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ew-rule-item {
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11.5px;
    border: 1px solid transparent;
}
.ew-rule-red    { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.2);  color: #fca5a5; }
.ew-rule-orange { background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.2); color: #fdba74; }
.ew-rule-yellow { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.2); color: #fcd34d; }

/* ── 表格 ─────────────────────────────────────────────────── */
.ew-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
}

.ew-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

.ew-th {
    padding: 9px 12px;
    background: rgba(255,255,255,.05);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,.08);
    user-select: none;
}
.ew-th-left { text-align: left; }
.ew-th-sort { cursor: pointer; }
.ew-th-sort:hover { color: #e2e8f0; }
.ew-th-sort.active { color: #60a5fa; }

.ew-tr { transition: background .12s; }
.ew-tr:hover { background: rgba(255,255,255,.04); }
.ew-tr-red    { border-left: 3px solid #ef4444; }
.ew-tr-orange { border-left: 3px solid #f97316; }

.ew-td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    text-align: center;
    vertical-align: middle;
}
.ew-td-site { text-align: left; min-width: 110px; }
.ew-td-reasons { text-align: left; min-width: 200px; }
.ew-td-score { min-width: 70px; }

/* ── 站点名 ───────────────────────────────────────────────── */
.ew-site-name { display: block; font-weight: 500; color: #e2e8f0; }
.ew-site-city { display: block; font-size: 11px; color: #64748b; margin-top: 1px; }

/* ── 徽章 ─────────────────────────────────────────────────── */
.ew-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.ew-badge-red    { background: rgba(239,68,68,.2);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.ew-badge-orange { background: rgba(249,115,22,.2); color: #fb923c; border: 1px solid rgba(249,115,22,.3); }
.ew-badge-yellow { background: rgba(245,158,11,.2); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.ew-badge-ok     { background: rgba(16,185,129,.15);color: #34d399; border: 1px solid rgba(16,185,129,.25); }

/* ── 风险分 ───────────────────────────────────────────────── */
.ew-score {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}
.ew-score-red    { color: #ef4444; }
.ew-score-orange { color: #f97316; }
.ew-score-yellow { color: #f59e0b; }
.ew-score-ok     { color: #10b981; }

/* ── 评级标签 ─────────────────────────────────────────────── */
.ew-grade-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin: 1px;
}
.ew-grade-poor      { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.ew-grade-ok        { background: rgba(16,185,129,.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,.2); }
.ew-grade-good      { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }
.ew-grade-excellent { background: rgba(168,85,247,.12); color: #c4b5fd; border: 1px solid rgba(168,85,247,.25); }

/* ── 维度标签 ─────────────────────────────────────────────── */
.ew-dim-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 11px;
    background: rgba(99,102,241,.15);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,.25);
}

/* ── 保护期标签 ───────────────────────────────────────────── */
.ew-exempt-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    background: rgba(14,165,233,.15);
    color: #7dd3fc;
    border: 1px solid rgba(14,165,233,.25);
    margin: 1px;
}

/* ── 触发原因 ─────────────────────────────────────────────── */
.ew-reason {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    margin: 1px;
    white-space: nowrap;
}
.ew-reason-red    { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.ew-reason-orange { background: rgba(249,115,22,.12);color: #fdba74; border: 1px solid rgba(249,115,22,.2); }
.ew-reason-yellow { background: rgba(245,158,11,.12);color: #fcd34d; border: 1px solid rgba(245,158,11,.2); }

/* ── 数值颜色 ─────────────────────────────────────────────── */
.ew-val-danger { color: #f87171; font-weight: 600; }
.ew-val-warn   { color: #fbbf24; }
.ew-val-ok     { color: #94a3b8; }
.ew-val-muted  { color: #475569; }

/* ── 空状态 ───────────────────────────────────────────────── */
.ew-empty {
    padding: 40px;
    text-align: center;
    color: #475569;
    font-size: 13px;
}

/* ── 加载 / 错误 ──────────────────────────────────────────── */
.ew-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px;
    color: #64748b;
}
.ew-spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ew-spin .7s linear infinite;
}
@keyframes ew-spin { to { transform: rotate(360deg); } }

.ew-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 40px;
    justify-content: center;
    color: #ef4444;
}
.ew-error button {
    padding: 4px 12px;
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 5px;
    color: #f87171;
    cursor: pointer;
    font-size: 12px;
}

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .ew-top-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .ew-page {
        padding: 10px 10px 16px;
    }

    .ew-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ew-title {
        font-size: 14px;
        white-space: normal;
    }

    .ew-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    .ew-stat {
        justify-content: center;
        padding: 6px 8px;
    }

    .ew-refresh-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .ew-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ew-select,
    .ew-search {
        width: 100%;
        box-sizing: border-box;
    }

    .ew-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== 浅色主题适配 ===== */
[data-theme="light"] .ew-page { color: #1a2a3a; }
[data-theme="light"] .ew-title { color: #1a2a3a; }
[data-theme="light"] .ew-card-title { color: #5a8ab0; }
[data-theme="light"] .ew-refresh-btn {
    background: rgba(0, 100, 200, 0.06);
    border-color: rgba(0, 100, 200, 0.18);
    color: #5a8ab0;
}
[data-theme="light"] .ew-refresh-btn:hover { background: rgba(0, 100, 200, 0.12); color: #0055cc; }

[data-theme="light"] .ew-select,
[data-theme="light"] .ew-search {
    background: #fff;
    border-color: rgba(0, 100, 200, 0.18);
    color: #1a2a3a;
}
[data-theme="light"] .ew-search::placeholder { color: #8ab0cc; }
[data-theme="light"] .ew-select:focus,
[data-theme="light"] .ew-search:focus { border-color: #0077cc; }

[data-theme="light"] .ew-chart-card,
[data-theme="light"] .ew-rules-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 100, 200, 0.12);
}

[data-theme="light"] .ew-table-wrap { border-color: rgba(0, 100, 200, 0.12); }
[data-theme="light"] .ew-th {
    background: rgba(0, 100, 200, 0.05);
    color: #2c5282;
    border-bottom-color: rgba(0, 100, 200, 0.12);
}
[data-theme="light"] .ew-th-sort:hover { color: #0055cc; }
[data-theme="light"] .ew-th-sort.active { color: #0077cc; }
[data-theme="light"] .ew-tr:hover { background: rgba(0, 100, 200, 0.03); }
[data-theme="light"] .ew-td { border-bottom-color: rgba(0, 100, 200, 0.06); }

/* 站点名称 - 浅色模式下黑色 */
[data-theme="light"] .ew-site-name { color: #1a2a3a; font-weight: 600; }
[data-theme="light"] .ew-site-city { color: #7aa8c8; }

[data-theme="light"] .ew-stat-lbl { color: #7aa8c8; }
[data-theme="light"] .ew-rule-red    { background: rgba(239,68,68,.08);  color: #dc2626; }
[data-theme="light"] .ew-rule-orange { background: rgba(249,115,22,.08); color: #ea580c; }
[data-theme="light"] .ew-rule-yellow { background: rgba(245,158,11,.08); color: #b45309; }

/* ===== 模态框通用结构 ===== */
.ew-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.ew-modal-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    min-width: 320px;
    max-width: 480px;
    width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ew-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #1e293b;
}

.ew-modal-title {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
}

.ew-modal-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}
.ew-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.ew-modal-body {
    padding: 8px 0;
}

.ew-modal-body-scroll {
    padding: 16px;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
}

.ew-modal-loading {
    text-align: center;
    color: #64748b;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ew-modal-empty {
    text-align: center;
    color: #64748b;
    padding: 20px;
}

/* 分级明细表格 */
.ew-modal-table {
    width: 100%;
    border-collapse: collapse;
}

.ew-modal-th {
    padding: 6px 12px;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #1e293b;
}
.ew-modal-th-left { text-align: left; }

.ew-modal-row { border-bottom: 1px solid #1e293b; }
.ew-modal-row:last-child { border-bottom: none; }

.ew-modal-td {
    padding: 8px 12px;
    font-size: 0.82rem;
}
.ew-modal-td-date  { color: #94a3b8; }
.ew-modal-td-center { text-align: center; }
.ew-modal-td-text  { color: #cbd5e1; }

/* 运营事故明细 */
.ew-accident-count {
    margin-bottom: 8px;
    color: #64748b;
    font-size: 0.75rem;
}

.ew-accident-list {
    border: 1px solid #1e293b;
    border-radius: 6px;
    overflow: hidden;
}

.ew-accident-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #1e293b;
}
.ew-accident-row:last-child { border-bottom: none; }

.ew-accident-date {
    flex-shrink: 0;
    width: 90px;
    color: #94a3b8;
    font-size: 0.82rem;
}
.ew-accident-category {
    flex: 1;
    color: #cbd5e1;
    font-size: 0.82rem;
}
.ew-accident-amount {
    flex-shrink: 0;
    color: #f87171;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ===== 浅色主题：模态框 ===== */
[data-theme="light"] .ew-modal-overlay {
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .ew-modal-card {
    background: #ffffff;
    border-color: #d0dde8;
    box-shadow: 0 8px 40px rgba(0, 60, 120, 0.15);
}

[data-theme="light"] .ew-modal-header {
    border-bottom-color: #e2eaf0;
}

[data-theme="light"] .ew-modal-title {
    color: #1a2a3a;
}

[data-theme="light"] .ew-modal-close {
    color: #64748b;
}
[data-theme="light"] .ew-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a2a3a;
}

[data-theme="light"] .ew-modal-th {
    color: #5a7a9a;
    border-bottom-color: #e2eaf0;
}

[data-theme="light"] .ew-modal-row {
    border-bottom-color: #eef2f7;
}

[data-theme="light"] .ew-modal-td-date  { color: #7a9ab8; }
[data-theme="light"] .ew-modal-td-text  { color: #1a2a3a; }

[data-theme="light"] .ew-modal-empty,
[data-theme="light"] .ew-modal-loading { color: #8aabcc; }

[data-theme="light"] .ew-accident-list {
    border-color: #e2eaf0;
}
[data-theme="light"] .ew-accident-row {
    border-bottom-color: #eef2f7;
}
[data-theme="light"] .ew-accident-date  { color: #7a9ab8; }
[data-theme="light"] .ew-accident-category { color: #1a2a3a; }
[data-theme="light"] .ew-accident-count { color: #8aabcc; }

/* ===== 浅色主题：页面正文字体修复 ===== */
/* 表格正文文字 */
[data-theme="light"] .ew-td { color: #1a2a3a; }

/* 数值颜色：浅色模式下"正常"和"静默"值需加深，否则看不清 */
[data-theme="light"] .ew-val-ok     { color: #3a5a7a; }
[data-theme="light"] .ew-val-muted  { color: #8aabcc; }

/* 触发原因标签 */
[data-theme="light"] .ew-reason-red    { background: rgba(239,68,68,.08);  color: #b91c1c; border-color: rgba(239,68,68,.25); }
[data-theme="light"] .ew-reason-orange { background: rgba(249,115,22,.08); color: #c2410c; border-color: rgba(249,115,22,.25); }
[data-theme="light"] .ew-reason-yellow { background: rgba(245,158,11,.08); color: #92400e; border-color: rgba(245,158,11,.25); }

/* 评级标签 */
[data-theme="light"] .ew-grade-poor      { background: rgba(239,68,68,.08);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
[data-theme="light"] .ew-grade-ok        { background: rgba(16,185,129,.08); color: #065f46; border-color: rgba(16,185,129,.2); }
[data-theme="light"] .ew-grade-good      { background: rgba(59,130,246,.08); color: #1d4ed8; border-color: rgba(59,130,246,.2); }
[data-theme="light"] .ew-grade-excellent { background: rgba(168,85,247,.08); color: #6d28d9; border-color: rgba(168,85,247,.2); }

/* 维度标签 */
[data-theme="light"] .ew-dim-tag {
    background: rgba(99,102,241,.08);
    color: #4338ca;
    border-color: rgba(99,102,241,.2);
}

/* 保护期标签 */
[data-theme="light"] .ew-exempt-tag {
    background: rgba(14,165,233,.08);
    color: #0369a1;
    border-color: rgba(14,165,233,.2);
}

/* 风险徽章 */
[data-theme="light"] .ew-badge-red    { background: rgba(239,68,68,.1);  color: #b91c1c; border-color: rgba(239,68,68,.3); }
[data-theme="light"] .ew-badge-orange { background: rgba(249,115,22,.1); color: #c2410c; border-color: rgba(249,115,22,.3); }
[data-theme="light"] .ew-badge-yellow { background: rgba(245,158,11,.1); color: #92400e; border-color: rgba(245,158,11,.3); }
[data-theme="light"] .ew-badge-ok     { background: rgba(16,185,129,.08);color: #065f46; border-color: rgba(16,185,129,.2); }

/* 风险分数字 */
[data-theme="light"] .ew-score-red    { color: #dc2626; }
[data-theme="light"] .ew-score-orange { color: #ea580c; }
[data-theme="light"] .ew-score-yellow { color: #b45309; }
[data-theme="light"] .ew-score-ok     { color: #059669; }

/* 加载/错误状态 */
[data-theme="light"] .ew-loading { color: #7aa8c8; }
[data-theme="light"] .ew-spinner {
    border-color: rgba(0, 100, 200, 0.15);
    border-top-color: #0077cc;
}
[data-theme="light"] .ew-empty { color: #8aabcc; }

/* 规则速查卡片 */
[data-theme="light"] .ew-rule-red    { background: rgba(239,68,68,.06);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
[data-theme="light"] .ew-rule-orange { background: rgba(249,115,22,.06); color: #c2410c; border-color: rgba(249,115,22,.2); }
[data-theme="light"] .ew-rule-yellow { background: rgba(245,158,11,.06); color: #92400e; border-color: rgba(245,158,11,.2); }

/* ================================================================
   退出预警：多主题适配（浅色系：sakura / nature / dopamine / heal / mint）
   ================================================================ */

/*
 * 浅色系主题共用选择器（白底深字）
 * dreamy 背景为深色紫色渐变，单独处理，不在此组内
 */
:is(
  [data-theme="sakura"],
  [data-theme="nature"],
  [data-theme="dopamine"],
  [data-theme="heal"],
  [data-theme="mint"]
) {
  /* ── 页面基础文字 ── */
  & .ew-page { color: var(--text-primary); }
  & .ew-title { color: var(--text-primary); }
  & .ew-card-title { color: var(--text-tertiary); }

  /* ── 刷新按钮 ── */
  & .ew-refresh-btn {
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--border-medium);
    color: var(--text-secondary);
  }
  & .ew-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.40);
    color: var(--text-primary);
  }

  /* ── 筛选控件 ── */
  & .ew-select,
  & .ew-search {
    background: rgba(255, 255, 255, 0.70);
    border-color: var(--border-medium);
    color: var(--text-primary);
  }
  & .ew-search::placeholder { color: var(--text-muted); }
  & .ew-select:focus,
  & .ew-search:focus { border-color: var(--color-primary); }

  /* ── 卡片背景 ── */
  & .ew-chart-card,
  & .ew-rules-card {
    background: rgba(255, 255, 255, 0.55);
    border-color: var(--border-light);
    backdrop-filter: blur(12px);
  }

  /* ── 表格容器 ── */
  & .ew-table-wrap { border-color: var(--border-light); }

  /* ── 表头 ── */
  & .ew-th {
    background: rgba(255, 255, 255, 0.35);
    color: var(--text-secondary);
    border-bottom-color: var(--border-light);
  }
  & .ew-th-sort:hover { color: var(--text-primary); }
  & .ew-th-sort.active { color: var(--color-primary); }

  /* ── 表格行 ── */
  & .ew-tr:hover { background: rgba(255, 255, 255, 0.30); }
  & .ew-td {
    color: var(--text-primary);
    border-bottom-color: var(--border-light);
  }

  /* ── 站点名称 ── */
  & .ew-site-name { color: var(--text-primary); font-weight: 600; }
  & .ew-site-city { color: var(--text-muted); }

  /* ── 汇总统计标签 ── */
  & .ew-stat-lbl { color: var(--text-muted); }

  /* ── 数值颜色：正常/静默 ── */
  & .ew-val-ok    { color: var(--text-secondary); }
  & .ew-val-muted { color: var(--text-muted); }

  /* ── 空状态 / 加载 ── */
  & .ew-empty  { color: var(--text-muted); }
  & .ew-loading { color: var(--text-muted); }
  & .ew-spinner {
    border-color: var(--border-light);
    border-top-color: var(--color-primary);
  }

  /* ── 规则速查标签 ── */
  & .ew-rule-red    { background: rgba(239,68,68,.08);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
  & .ew-rule-orange { background: rgba(249,115,22,.08); color: #c2410c; border-color: rgba(249,115,22,.2); }
  & .ew-rule-yellow { background: rgba(245,158,11,.08); color: #92400e; border-color: rgba(245,158,11,.2); }

  /* ── 触发原因标签 ── */
  & .ew-reason-red    { background: rgba(239,68,68,.08);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
  & .ew-reason-orange { background: rgba(249,115,22,.08); color: #c2410c; border-color: rgba(249,115,22,.2); }
  & .ew-reason-yellow { background: rgba(245,158,11,.08); color: #92400e; border-color: rgba(245,158,11,.2); }

  /* ── 评级标签 ── */
  & .ew-grade-poor      { background: rgba(239,68,68,.08);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
  & .ew-grade-ok        { background: rgba(16,185,129,.08); color: #065f46; border-color: rgba(16,185,129,.2); }
  & .ew-grade-good      { background: rgba(59,130,246,.08); color: #1d4ed8; border-color: rgba(59,130,246,.2); }
  & .ew-grade-excellent { background: rgba(168,85,247,.08); color: #6d28d9; border-color: rgba(168,85,247,.2); }

  /* ── 风险徽章 ── */
  & .ew-badge-red    { background: rgba(239,68,68,.10);  color: #b91c1c; border-color: rgba(239,68,68,.3); }
  & .ew-badge-orange { background: rgba(249,115,22,.10); color: #c2410c; border-color: rgba(249,115,22,.3); }
  & .ew-badge-yellow { background: rgba(245,158,11,.10); color: #92400e; border-color: rgba(245,158,11,.3); }
  & .ew-badge-ok     { background: rgba(16,185,129,.08); color: #065f46; border-color: rgba(16,185,129,.2); }

  /* ── 风险分数字 ── */
  & .ew-score-red    { color: #dc2626; }
  & .ew-score-orange { color: #ea580c; }
  & .ew-score-yellow { color: #b45309; }
  & .ew-score-ok     { color: #059669; }

  /* ── 维度标签 ── */
  & .ew-dim-tag {
    background: rgba(99,102,241,.08);
    color: #4338ca;
    border-color: rgba(99,102,241,.2);
  }

  /* ── 保护期标签 ── */
  & .ew-exempt-tag {
    background: rgba(14,165,233,.08);
    color: #0369a1;
    border-color: rgba(14,165,233,.2);
  }

  /* ── 模态框遮罩 ── */
  & .ew-modal-overlay { background: rgba(0, 0, 0, 0.30); }

  /* ── 模态框卡片 ── */
  & .ew-modal-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: var(--border-medium);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  /* ── 模态框头部 ── */
  & .ew-modal-header { border-bottom-color: var(--border-light); }
  & .ew-modal-title  { color: var(--text-primary); }

  /* ── 模态框关闭按钮 ── */
  & .ew-modal-close { color: var(--text-muted); }
  & .ew-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
  }

  /* ── 模态框表头 ── */
  & .ew-modal-th {
    color: var(--text-muted);
    border-bottom-color: var(--border-light);
  }

  /* ── 模态框行 ── */
  & .ew-modal-row { border-bottom-color: var(--border-light); }
  & .ew-modal-td-date  { color: var(--text-muted); }
  & .ew-modal-td-text  { color: var(--text-primary); }

  /* ── 模态框空/加载状态 ── */
  & .ew-modal-empty,
  & .ew-modal-loading { color: var(--text-muted); }

  /* ── 运营事故明细 ── */
  & .ew-accident-list  { border-color: var(--border-light); }
  & .ew-accident-row   { border-bottom-color: var(--border-light); }
  & .ew-accident-date  { color: var(--text-muted); }
  & .ew-accident-category { color: var(--text-primary); }
  & .ew-accident-count { color: var(--text-muted); }
}

/* ================================================================
   退出预警：梦幻主题（dreamy）专属适配
   背景为深色紫色渐变，使用白色/浅色文字，模态框用毛玻璃深色卡片
   ================================================================ */

[data-theme="dreamy"] .ew-page { color: #f0e8ff; }
[data-theme="dreamy"] .ew-title { color: #f0e8ff; }
[data-theme="dreamy"] .ew-card-title { color: rgba(240, 232, 255, 0.65); }

/* ── 刷新按钮 ── */
[data-theme="dreamy"] .ew-refresh-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(240, 232, 255, 0.80);
}
[data-theme="dreamy"] .ew-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.20);
    color: #ffffff;
}

/* ── 筛选控件 ── */
[data-theme="dreamy"] .ew-select,
[data-theme="dreamy"] .ew-search {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.30);
    color: #f0e8ff;
}
[data-theme="dreamy"] .ew-search::placeholder { color: rgba(240, 232, 255, 0.45); }
[data-theme="dreamy"] .ew-select:focus,
[data-theme="dreamy"] .ew-search:focus { border-color: rgba(255, 255, 255, 0.55); }

/* ── 卡片背景 ── */
[data-theme="dreamy"] .ew-chart-card,
[data-theme="dreamy"] .ew-rules-card {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(16px);
}

/* ── 表格容器 ── */
[data-theme="dreamy"] .ew-table-wrap { border-color: rgba(255, 255, 255, 0.15); }

/* ── 表头 ── */
[data-theme="dreamy"] .ew-th {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(240, 232, 255, 0.75);
    border-bottom-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dreamy"] .ew-th-sort:hover { color: #ffffff; }
[data-theme="dreamy"] .ew-th-sort.active { color: #00d4ff; }

/* ── 表格行 ── */
[data-theme="dreamy"] .ew-tr:hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dreamy"] .ew-td {
    color: #f0e8ff;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ── 站点名称 ── */
[data-theme="dreamy"] .ew-site-name { color: #ffffff; font-weight: 600; }
[data-theme="dreamy"] .ew-site-city { color: rgba(240, 232, 255, 0.55); }

/* ── 汇总统计标签 ── */
[data-theme="dreamy"] .ew-stat-lbl { color: rgba(240, 232, 255, 0.60); }

/* ── 数值颜色 ── */
[data-theme="dreamy"] .ew-val-ok    { color: rgba(240, 232, 255, 0.75); }
[data-theme="dreamy"] .ew-val-muted { color: rgba(240, 232, 255, 0.40); }

/* ── 空状态 / 加载 ── */
[data-theme="dreamy"] .ew-empty  { color: rgba(240, 232, 255, 0.50); }
[data-theme="dreamy"] .ew-loading { color: rgba(240, 232, 255, 0.60); }
[data-theme="dreamy"] .ew-spinner {
    border-color: rgba(255, 255, 255, 0.15);
    border-top-color: #00d4ff;
}

/* ── 规则速查标签（在紫色背景上用亮色） ── */
[data-theme="dreamy"] .ew-rule-red    { background: rgba(239,68,68,.18);  color: #fca5a5; border-color: rgba(239,68,68,.35); }
[data-theme="dreamy"] .ew-rule-orange { background: rgba(249,115,22,.18); color: #fdba74; border-color: rgba(249,115,22,.35); }
[data-theme="dreamy"] .ew-rule-yellow { background: rgba(245,158,11,.18); color: #fcd34d; border-color: rgba(245,158,11,.35); }

/* ── 触发原因标签 ── */
[data-theme="dreamy"] .ew-reason-red    { background: rgba(239,68,68,.18);  color: #fca5a5; border-color: rgba(239,68,68,.30); }
[data-theme="dreamy"] .ew-reason-orange { background: rgba(249,115,22,.18); color: #fdba74; border-color: rgba(249,115,22,.30); }
[data-theme="dreamy"] .ew-reason-yellow { background: rgba(245,158,11,.18); color: #fcd34d; border-color: rgba(245,158,11,.30); }

/* ── 评级标签 ── */
[data-theme="dreamy"] .ew-grade-poor      { background: rgba(239,68,68,.18);  color: #fca5a5; border-color: rgba(239,68,68,.30); }
[data-theme="dreamy"] .ew-grade-ok        { background: rgba(16,185,129,.18); color: #6ee7b7; border-color: rgba(16,185,129,.30); }
[data-theme="dreamy"] .ew-grade-good      { background: rgba(96,165,250,.18); color: #93c5fd; border-color: rgba(96,165,250,.30); }
[data-theme="dreamy"] .ew-grade-excellent { background: rgba(192,132,252,.18);color: #d8b4fe; border-color: rgba(192,132,252,.30); }

/* ── 风险徽章 ── */
[data-theme="dreamy"] .ew-badge-red    { background: rgba(239,68,68,.22);  color: #fca5a5; border-color: rgba(239,68,68,.40); }
[data-theme="dreamy"] .ew-badge-orange { background: rgba(249,115,22,.22); color: #fdba74; border-color: rgba(249,115,22,.40); }
[data-theme="dreamy"] .ew-badge-yellow { background: rgba(245,158,11,.22); color: #fcd34d; border-color: rgba(245,158,11,.40); }
[data-theme="dreamy"] .ew-badge-ok     { background: rgba(16,185,129,.18); color: #6ee7b7; border-color: rgba(16,185,129,.30); }

/* ── 风险分数字 ── */
[data-theme="dreamy"] .ew-score-red    { color: #f87171; }
[data-theme="dreamy"] .ew-score-orange { color: #fb923c; }
[data-theme="dreamy"] .ew-score-yellow { color: #fbbf24; }
[data-theme="dreamy"] .ew-score-ok     { color: #34d399; }

/* ── 维度标签 ── */
[data-theme="dreamy"] .ew-dim-tag {
    background: rgba(129, 140, 248, 0.20);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.35);
}

/* ── 保护期标签 ── */
[data-theme="dreamy"] .ew-exempt-tag {
    background: rgba(56, 189, 248, 0.18);
    color: #bae6fd;
    border-color: rgba(56, 189, 248, 0.32);
}

/* ── 模态框遮罩 ── */
[data-theme="dreamy"] .ew-modal-overlay { background: rgba(0, 0, 0, 0.55); }

/* ── 模态框卡片：毛玻璃深色 ── */
[data-theme="dreamy"] .ew-modal-card {
    background: rgba(30, 10, 60, 0.85);
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.50);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* ── 模态框头部 ── */
[data-theme="dreamy"] .ew-modal-header { border-bottom-color: rgba(255, 255, 255, 0.12); }
[data-theme="dreamy"] .ew-modal-title  { color: #f0e8ff !important; }

/* ── 模态框关闭按钮 ── */
[data-theme="dreamy"] .ew-modal-close { color: rgba(240, 232, 255, 0.55) !important; }
[data-theme="dreamy"] .ew-modal-close:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff !important;
}

/* ── 模态框表头 ── */
[data-theme="dreamy"] .ew-modal-th {
    color: rgba(240, 232, 255, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.10);
}

/* ── 模态框行 ── */
[data-theme="dreamy"] .ew-modal-row { border-bottom-color: rgba(255, 255, 255, 0.08); }
/* 用 !important 覆盖 variables.css 中 table tbody td { color: #1a0a2e !important } */
[data-theme="dreamy"] .ew-modal-td-date  { color: rgba(240, 232, 255, 0.60) !important; }
[data-theme="dreamy"] .ew-modal-td-text  { color: #f0e8ff !important; }
/* 模态框内所有 td 统一用浅色，防止被通用 table 规则覆盖 */
[data-theme="dreamy"] .ew-modal-table tbody td { color: #f0e8ff !important; }
[data-theme="dreamy"] .ew-modal-table thead th { color: rgba(240, 232, 255, 0.60) !important; }

/* ── 模态框空/加载状态 ── */
[data-theme="dreamy"] .ew-modal-empty,
[data-theme="dreamy"] .ew-modal-loading { color: rgba(240, 232, 255, 0.50); }

/* ── 运营事故明细 ── */
[data-theme="dreamy"] .ew-accident-list  { border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dreamy"] .ew-accident-row   { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dreamy"] .ew-accident-date  { color: rgba(240, 232, 255, 0.60) !important; }
[data-theme="dreamy"] .ew-accident-category { color: #f0e8ff !important; }
[data-theme="dreamy"] .ew-accident-count { color: rgba(240, 232, 255, 0.50) !important; }

/* 页面标题「退出预警」：浅色系强制深色字（避免 #f1f5f9 浅字不可见） */
[data-theme="light"] .ew-page .ew-title,
[data-theme="sakura"] .ew-page .ew-title,
[data-theme="nature"] .ew-page .ew-title,
[data-theme="dopamine"] .ew-page .ew-title,
[data-theme="heal"] .ew-page .ew-title,
[data-theme="mint"] .ew-page .ew-title {
    color: var(--text-primary) !important;
}
