/* Codex fix for /opus47: new page only, original Opus files remain untouched. */

:root {
    --fix-topbar-h: 68px;
    --fix-left-w: clamp(360px, 20vw, 420px);
    --fix-right-w: clamp(360px, 21vw, 430px);
    --fix-bottom-h: clamp(320px, 32vh, 390px);
    --fix-panel-bg: #f6f9fc;
    --fix-panel-head: #eef4fa;
    --fix-text: #102033;
    --fix-muted: #526174;
    --fix-line: rgba(15, 23, 42, 0.12);
}

html,
body {
    font-size: 15.5px !important;
    line-height: 1.5;
    color: var(--fix-text);
    background: #e6edf4;
}

/* 顶部栏：原 Opus 版把高度压到 40px，品牌和控件被截断。 */
#topbar {
    height: var(--fix-topbar-h) !important;
    padding: 0 18px !important;
    display: grid !important;
    grid-template-columns: minmax(300px, 360px) minmax(620px, 1fr) minmax(160px, 240px);
    align-items: center !important;
    gap: 16px !important;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fa 100%) !important;
    border-bottom: 1px solid var(--fix-line) !important;
    box-shadow: 0 8px 24px rgba(30, 41, 59, 0.16) !important;
}

.brand {
    min-width: 0;
    height: auto !important;
    padding-right: 12px !important;
    border-right: 1px solid var(--fix-line) !important;
}

.brand-logo {
    width: 44px !important;
    height: 44px !important;
    border-radius: 9px !important;
}

.brand-title {
    font-size: 19px !important;
    line-height: 1.12 !important;
    white-space: nowrap;
}

.brand-sub {
    display: block !important;
    margin-top: 4px !important;
    font-size: 12.5px !important;
    color: var(--fix-muted) !important;
    white-space: nowrap;
}

.topbar-controls {
    min-width: 0;
    justify-content: center;
    gap: 14px !important;
}

.ctrl-group {
    min-width: 0;
    gap: 8px !important;
}

.ctrl-label {
    font-size: 13px !important;
    color: var(--fix-muted) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 750 !important;
    white-space: nowrap;
}

.radio-group {
    height: 42px;
    padding: 4px !important;
    border-radius: 10px !important;
    background: #e9eff6 !important;
}

.radio-btn {
    height: 32px;
    min-width: 78px;
    justify-content: center;
    padding: 0 16px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
}

#topbar input[type="date"] {
    width: 170px !important;
    height: 40px !important;
    padding: 0 12px !important;
    color-scheme: light !important;
    font-size: 15px !important;
    background: #f8fbff !important;
}

.ctrl-group-hour {
    min-width: 310px !important;
}

#hour-slider {
    width: 170px !important;
}

#hour-label {
    min-width: 62px !important;
    font-size: 18px !important;
    color: var(--fix-text) !important;
}

.ctrl-status {
    justify-self: end;
    max-width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 14px !important;
    overflow: hidden;
}

#status {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px !important;
}

/* 主体布局：固定清晰比例，不吃之前 splitter 写进 localStorage 的内联宽度。 */
#layout {
    top: var(--fix-topbar-h) !important;
    height: calc(100vh - var(--fix-topbar-h)) !important;
    display: flex !important;
    background: #e6edf4 !important;
}

#sidebar-left.side-panel {
    width: var(--fix-left-w) !important;
    min-width: 340px !important;
    max-width: 430px !important;
}

#sidebar-right.side-panel {
    width: var(--fix-right-w) !important;
    min-width: 350px !important;
    max-width: 440px !important;
}

.side-panel {
    background: var(--fix-panel-bg) !important;
    border-color: var(--fix-line) !important;
    overflow: hidden !important;
}

.panel-head {
    min-height: 54px !important;
    padding: 0 16px !important;
    background: var(--fix-panel-head) !important;
}

.panel-head-title {
    font-size: 15px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.panel-body {
    padding-bottom: 10px;
}

.splitter-v,
.splitter-h {
    display: none !important;
}

/* 折叠按钮：左、右、下都放在对应边界的正中间。 */
.panel-collapse-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 999px !important;
    background: rgba(248, 251, 255, 0.96) !important;
    border: 1px solid rgba(8, 127, 155, 0.25) !important;
    color: #087f9b !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18) !important;
    z-index: 1200 !important;
}

.panel-collapse-btn[data-panel="sidebar-left"] {
    position: fixed !important;
    top: calc(var(--fix-topbar-h) + (100vh - var(--fix-topbar-h)) / 2 - 21px) !important;
    left: calc(var(--fix-left-w) - 21px) !important;
}

.panel-collapse-btn[data-panel="sidebar-right"] {
    position: fixed !important;
    top: calc(var(--fix-topbar-h) + (100vh - var(--fix-topbar-h)) / 2 - 21px) !important;
    right: calc(var(--fix-right-w) - 21px) !important;
}

.side-stub {
    top: calc(var(--fix-topbar-h) + (100vh - var(--fix-topbar-h)) / 2 - 24px) !important;
    width: 44px !important;
    height: 48px !important;
    z-index: 1200 !important;
}

.side-stub svg,
.panel-collapse-btn svg,
#bp-collapse-btn svg {
    width: 18px !important;
    height: 18px !important;
}

.middle-col {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

#map-wrap {
    min-height: 440px !important;
}

.bottom-panel,
#bottom-panel {
    height: var(--fix-bottom-h) !important;
    min-height: 240px !important;
    background: #f8fbff !important;
    position: relative !important;
}

.bottom-panel.collapsed,
#bottom-panel.collapsed {
    height: 58px !important;
    min-height: 58px !important;
}

.bp-head {
    height: 58px !important;
    padding: 0 18px !important;
}

.bp-head-right {
    padding-right: 0 !important;
}

#bp-collapse-btn {
    position: absolute !important;
    top: 10px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 999px !important;
    background: rgba(248, 251, 255, 0.98) !important;
    border: 1px solid rgba(8, 127, 155, 0.25) !important;
    color: #087f9b !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16) !important;
    z-index: 20 !important;
}

.bp-title {
    font-size: 20px !important;
}

.bp-sub {
    font-size: 14px !important;
}

.bp-body {
    min-height: 0;
    height: calc(100% - 58px) !important;
    padding: 0 16px 12px !important;
}

#chart {
    width: 100% !important;
    height: 100% !important;
    min-height: 238px !important;
}

/* 左栏：卡片留白和数字层级重整，避免小字糊成一团。 */
.sb-header {
    padding: 18px 18px 14px !important;
}

.sb-icon {
    width: 48px !important;
    height: 48px !important;
}

.sb-station-name {
    font-size: 24px !important;
    line-height: 1.15 !important;
}

.city-tag,
.code-tag,
.ref-tag {
    font-size: 14px !important;
    padding: 4px 10px !important;
}

.sb-coord {
    margin-top: 10px;
    font-size: 13px !important;
}

.card {
    margin: 12px 14px !important;
    border-radius: 10px !important;
    background: #f9fbfd !important;
}

.card-head {
    min-height: 44px !important;
    padding: 0 13px !important;
}

.card-head-title {
    font-size: 15px !important;
}

.section-hint {
    font-size: 12px !important;
}

.pollution-banner {
    margin: 10px 12px 12px !important;
    padding: 16px 16px !important;
    border-radius: 10px !important;
}

.banner-label {
    font-size: 12px !important;
}

.banner-type {
    margin-top: 6px !important;
    margin-bottom: 8px !important;
    font-size: 26px !important;
    line-height: 1.16 !important;
}

.banner-thresholds {
    font-size: 13px !important;
    line-height: 1.55 !important;
}

.province-banner {
    margin: 0 12px 12px !important;
    padding: 12px !important;
}

.stats-grid {
    gap: 12px !important;
}

.stat-card {
    min-width: 0;
    padding: 14px 12px !important;
    overflow: hidden !important;
}

.stat-name {
    font-size: 14px !important;
}

.stat-value {
    font-size: 34px !important;
    line-height: 1 !important;
}

.stat-unit,
.stat-status {
    font-size: 12px !important;
}

.day-stats-label {
    font-size: 11px !important;
}

.ds-row {
    grid-template-columns: 8px minmax(42px, 1fr) auto !important;
    gap: 7px !important;
    padding: 5px 4px !important;
}

.ds-label,
.ds-extra {
    font-size: 11px !important;
}

.ds-value {
    min-width: 48px !important;
    font-size: 13px !important;
}

.data-quality {
    margin: 10px 12px 12px !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
}

/* 地图浮层：避免标题条太大压地图。 */
.map-topbar {
    top: 14px !important;
    max-width: min(760px, calc(100% - 260px));
    padding: 10px 22px !important;
    font-size: 16px !important;
}

.basemap-toolbar {
    top: 14px !important;
    right: 14px !important;
}

.legend-mini {
    right: 22px !important;
    bottom: 28px !important;
}

.llm-select {
    width: auto !important;
    min-width: 120px !important;
    max-width: none !important;     /* 覆盖 style_opus47.css 的 max-width: 42% */
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 13.5px !important;
    text-overflow: clip !important;
}

/* === 齿轮设置按钮 === */
.llm-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 4px;
    flex-shrink: 0;
}
.llm-settings-btn:hover {
    color: #0891b2;
    border-color: #0891b2;
    background: rgba(8, 145, 178, 0.08);
    transform: rotate(60deg);
}
.llm-settings-btn svg { transition: transform 0.3s ease; }

/* === 自定义模型模态框 === */
.llm-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.llm-settings-modal.hidden { display: none !important; }

.llm-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.llm-settings-panel {
    position: relative;
    width: min(460px, calc(100vw - 32px));
    max-height: calc(100vh - 60px);
    overflow: auto;
    background: white;
    border-radius: 14px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.45),
        0 0 0 1px rgba(148, 163, 184, 0.18);
    animation: cmModalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes cmModalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.llm-settings-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #e2e8f0;
}
.llm-settings-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}
.llm-settings-title svg { color: #0891b2; }
.llm-settings-close {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.llm-settings-close:hover { background: #f1f5f9; color: #0f172a; }

.llm-settings-body { padding: 16px 22px 22px; }
.llm-settings-hint {
    margin: 0 0 14px;
    padding: 9px 12px;
    background: rgba(8, 145, 178, 0.07);
    border-left: 3px solid #06b6d4;
    border-radius: 0 6px 6px 0;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
}

.llm-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}
.llm-field-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.2px;
}
.llm-field input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 13.5px;
    font-family: "JetBrains Mono", Consolas, monospace;
    color: #0f172a;
    background: #f8fafc;
    transition: all 0.15s;
}
.llm-field input:focus {
    outline: none;
    border-color: #06b6d4;
    background: white;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.llm-settings-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}
.cm-btn {
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.cm-btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    box-shadow: 0 2px 6px rgba(8, 145, 178, 0.35);
}
.cm-btn-primary:hover { box-shadow: 0 4px 12px rgba(8, 145, 178, 0.5); transform: translateY(-1px); }
.cm-btn-ghost {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
}
.cm-btn-ghost:hover { background: #fef2f2; }

.cm-status {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    text-align: center;
    transition: opacity 0.3s;
    opacity: 0;
}
.cm-status.show { opacity: 1; }
.cm-status.ok   { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.cm-status.err  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ============ _md_1732：多模型管理 模态框样式 ============ */

.llm-settings-panel-lg {
    width: min(580px, calc(100vw - 32px)) !important;
}

/* 模型卡片列表容器 */
.cm-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    max-height: 56vh;
    overflow-y: auto;
    padding-right: 4px;
}
.cm-list::-webkit-scrollbar { width: 6px; }
.cm-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* 单条模型卡片 */
.cm-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    overflow: hidden;
    transition: all 0.18s;
}
.cm-card:hover { border-color: #cbd5e1; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06); }
.cm-card.is-active {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.06), rgba(8, 145, 178, 0.02));
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* 卡片头部 (折叠时只显示这一行) */
.cm-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
}
.cm-card-head-left,
.cm-card-head-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cm-card-head-left { flex: 1; min-width: 0; }

/* ★ 设为当前模型按钮 */
.cm-active-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.cm-active-toggle:hover { color: #f59e0b; background: #fef3c7; }
.cm-card.is-active .cm-active-toggle {
    color: #f59e0b;
    background: #fef3c7;
}
.cm-card.is-active .cm-active-toggle svg { fill: currentColor; }

/* 名称输入（卡片头里） */
.cm-card-head .cm-name {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    padding: 5px 8px;
    border-radius: 5px;
    transition: all 0.15s;
}
.cm-card-head .cm-name:hover  { background: white; border-color: #e2e8f0; }
.cm-card-head .cm-name:focus  { outline: none; background: white; border-color: #06b6d4; box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15); }

/* 展开/删除按钮 */
.cm-card-toggle,
.cm-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.cm-card-toggle:hover { background: rgba(8, 145, 178, 0.10); color: #0891b2; border-color: rgba(8, 145, 178, 0.25); }
.cm-card.expanded .cm-card-toggle svg { transform: rotate(180deg); }
.cm-card-toggle svg { transition: transform 0.2s; }
.cm-del:hover { background: #fef2f2; color: #ef4444; border-color: #fecaca; }

/* 卡片 body（展开后显示详细字段） */
.cm-card-body {
    padding: 4px 11px 11px;
    border-top: 1px dashed #e2e8f0;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cm-card-body.hidden { display: none; }

.cm-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cm-field > span {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.2px;
}
.cm-input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    font-family: "JetBrains Mono", Consolas, monospace;
    color: #0f172a;
    background: white;
    transition: all 0.15s;
}
.cm-input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* 添加新模型 按钮（蓝色描边） */
.cm-btn-ghost-blue {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: #0891b2;
    border: 1px dashed #06b6d4;
}
.cm-btn-ghost-blue:hover {
    background: rgba(6, 182, 212, 0.08);
    border-style: solid;
}

/* foot 两按钮并排 */
.llm-settings-foot {
    display: flex !important;
    justify-content: space-between !important;
    gap: 10px;
}

/* v1.5: "添加 API 模型" / "添加本地模型" 双按钮组 */
.cm-add-group {
    display: flex;
    gap: 8px;
    flex: 1;
}
.cm-add-group .cm-btn {
    flex: 1;
}

/* 帮助文字（本地端口提示） */
.cm-hint {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(8, 145, 178, 0.06);
    border-left: 2px solid #06b6d4;
    border-radius: 0 5px 5px 0;
    font-size: 11.5px;
    color: #475569;
    line-height: 1.5;
}
.cm-hint code {
    background: rgba(8, 145, 178, 0.10);
    color: #086d80;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
}
.cm-hint b {
    color: #0891b2;
    font-weight: 700;
}

/* 模型下拉框里 custom 项加个标记 */
.llm-select option[value="custom"] {
    font-weight: 700;
    color: #0891b2;
}

.ai-tabs {
    min-height: 56px !important;
    gap: 2px !important;
    flex-wrap: nowrap !important;
}

.ai-tab {
    padding: 0 9px !important;
    min-height: 56px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
}

.ai-tab-action {
    width: 38px !important;
    height: 38px !important;
}

.ai-context-bar {
    margin: 14px 16px 10px !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
}

.llm-quick-asks {
    margin: 8px 16px 12px !important;
    gap: 8px !important;
}

.quick-ask {
    height: 34px !important;
    padding: 0 13px !important;
    font-size: 14px !important;
}

.llm-messages {
    margin: 0 16px !important;
    padding: 10px 0 !important;
}

/* v1.7 聊天输入区美化：卡片容器 + 圆角输入框 + 渐变发送按钮 */
.llm-input-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 76px !important;
    gap: 10px !important;
    margin: 12px 16px 16px !important;
    align-items: stretch !important;
    padding: 10px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .05) !important;
    transition: border-color .16s ease, box-shadow .16s ease !important;
}
.llm-input-row:focus-within {
    border-color: var(--accent-cyan, #06b6d4) !important;
    box-shadow: 0 4px 16px rgba(6, 182, 212, .15) !important;
}

#llm-input {
    min-height: 76px !important;
    max-height: 130px !important;
    padding: 10px 12px !important;
    font-size: 14.5px !important;
    line-height: 1.5 !important;
    border: none !important;
    background: transparent !important;
    border-radius: 10px !important;
    resize: none !important;
    outline: none !important;
}
#llm-input::placeholder { color: #94a3b8 !important; }

.llm-send {
    width: 76px !important;
    min-width: 76px !important;
    height: auto !important;
    border: none !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(6, 182, 212, .3) !important;
    transition: all .16s ease !important;
}
.llm-send:hover {
    background: linear-gradient(135deg, #22d3ee, #06b6d4) !important;
    box-shadow: 0 6px 18px rgba(6, 182, 212, .4) !important;
    transform: translateY(-1px) !important;
}
.llm-send:active { transform: translateY(0) !important; }
.llm-send:disabled {
    background: #cbd5e1 !important;
    box-shadow: none !important;
    cursor: wait !important;
    transform: none !important;
}
.llm-send-icon { color: #fff !important; }

.llm-msg .msg-body {
    font-size: 14px !important;
    line-height: 1.55 !important;
}

/* ====================================================================
   _md 地图 & 工具栏增强：站点 marker 强制置顶 + basemap-btn 美化
   ==================================================================== */

/* (1) _md_1732 改进：marker 可点 + 省界染色 100% 工作
   - 去掉之前 .leaflet-marker-icon::before { inset:-10px } 方案
     原因：扩大的 hitbox 在站点密集区把整个区域都吃掉了，鼠标根本
          挪不到省 polygon 上 → 省 hover 染色永远触发不了
   - 只靠 markerPane z-index 800（远高于 overlayPane 400）
     浏览器 hit-testing 优先命中 marker；
     鼠标在 marker 视觉范围之外，事件正常落到省 polygon 上触发染色 */
.leaflet-marker-pane    { z-index: 800 !important; }
.leaflet-shadow-pane    { z-index: 790 !important; }
.leaflet-popup-pane     { z-index: 900 !important; }
.leaflet-tooltip-pane   { z-index: 820 !important; }

.leaflet-marker-icon { cursor: pointer !important; }

/* (2) 关键：鼠标 hover 在 marker（含 cluster）上时，强制还原下面省 polygon 的染色
   原因：marker pane z-index 800 拦截了 mouseout 事件，polygon 的 mouseout
        触发不了，setStyle 的染色态卡住，会干扰 marker tooltip 视觉
   解法：用 `:has()` 选择器检测全局是否有 marker / cluster / tooltip 处于 hover
        命中时 CSS !important 覆盖 polygon 的 inline fill-opacity 强制还原
   兼容：Chrome 105+/Firefox 121+/Safari 15.4+ 全支持 :has() */
body:has(.leaflet-marker-icon:hover),
body:has(.aq-cluster-wrap:hover),
body:has(.leaflet-popup:hover),
body:has(.leaflet-tooltip:not(.aq-prov-tooltip):hover) {
    /* 这个空规则触发 :has 求值；具体覆盖在下面 */
}
body:has(.leaflet-marker-icon:hover) .leaflet-overlay-pane svg path,
body:has(.aq-cluster-wrap:hover)    .leaflet-overlay-pane svg path,
body:has(.leaflet-popup:hover)      .leaflet-overlay-pane svg path,
body:has(.leaflet-tooltip:not(.aq-prov-tooltip):hover) .leaflet-overlay-pane svg path {
    fill-opacity: 0 !important;
    stroke: rgba(15, 23, 42, 0.20) !important;
    stroke-opacity: 1 !important;
    stroke-width: 0.7 !important;
    transition: fill-opacity 0.12s ease;
}
/* 同时把省自己的 tooltip（aq-prov-tooltip）也隐藏，避免和 marker tooltip 抢占 */
body:has(.leaflet-marker-icon:hover) .leaflet-tooltip.aq-prov-tooltip,
body:has(.aq-cluster-wrap:hover)    .leaflet-tooltip.aq-prov-tooltip {
    display: none !important;
}

/* (2) basemap-toolbar 整体美化：玻璃 pill 风格容器 */
.basemap-toolbar {
    display: inline-flex !important;
    align-items: center;
    gap: 4px !important;
    padding: 5px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(203, 213, 225, 0.6) !important;
    border-radius: 10px !important;
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.06),
        0 8px 24px rgba(15, 23, 42, 0.10) !important;
}
body[data-basemap="dark"] .basemap-toolbar,
body[data-basemap="satellite"] .basemap-toolbar {
    background: rgba(15, 23, 42, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* (3) basemap-btn 大小 + 圆角 + 图标 + label */
.basemap-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    height: 32px !important;
    min-width: 32px;
    padding: 0 10px !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #475569 !important;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid transparent !important;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.basemap-btn svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.basemap-btn-label {
    font-size: 12px;
    line-height: 1;
}
.basemap-btn:hover {
    background: rgba(8, 145, 178, 0.10) !important;
    color: #0891b2 !important;
    border-color: rgba(8, 145, 178, 0.25) !important;
}
.basemap-btn:hover svg {
    transform: scale(1.12);
}
.basemap-btn.active {
    background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow:
        0 2px 6px rgba(8, 145, 178, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}
.basemap-btn.active svg {
    transform: scale(1.05);
}
body[data-basemap="dark"] .basemap-btn,
body[data-basemap="satellite"] .basemap-btn {
    color: #cbd5e1 !important;
}
body[data-basemap="dark"] .basemap-btn:hover,
body[data-basemap="satellite"] .basemap-btn:hover {
    background: rgba(6, 182, 212, 0.20) !important;
    color: #67e8f9 !important;
}

/* (4) prov-toggle 单独样式，激活时金黄色提示 */
.basemap-btn.prov-toggle.active {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow:
        0 2px 6px rgba(245, 158, 11, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.30) !important;
}

/* (5) 分隔线 */
.basemap-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: rgba(148, 163, 184, 0.4);
    margin: 0 2px;
}
body[data-basemap="dark"] .basemap-divider,
body[data-basemap="satellite"] .basemap-divider {
    background: rgba(255, 255, 255, 0.18);
}

/* (6) 极窄屏只显示 icon 隐藏 label */
@media (max-width: 1100px) {
    .basemap-btn-label { display: none; }
    .basemap-btn { padding: 0 8px !important; min-width: 32px !important; }
}

/* ====================================================================
   _md 增强：Markdown 渲染样式 + 流式防抖布局稳定
   ==================================================================== */

/* (A) 关键防抖：消息容器隔离重排 + 禁用浏览器 scroll anchoring */
#llm-messages,
.llm-messages {
    contain: layout style;          /* 内部 reflow 不影响外部 */
    overflow-anchor: none;          /* 禁用浏览器自动 scroll 回弹 */
    scroll-behavior: auto;          /* 流式过程禁用 smooth 滚动避免重叠 */
}
.llm-msg {
    contain: layout style;
    overflow-anchor: none;
    margin-bottom: 14px;
}
.llm-msg .msg-body {
    overflow-anchor: none;
    /* 让流式追加内容时高度变化不引起整页 jump */
    overflow-wrap: break-word;
    word-break: break-word;
}

/* (B) 流式光标提示：assistant 消息流式中，body 末尾闪烁圆点 */
.llm-msg.streaming .msg-body::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 14px;
    margin-left: 3px;
    vertical-align: -2px;
    background: #06b6d4;
    border-radius: 1px;
    animation: blink 1.05s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 0.15; }
    50%      { opacity: 1; }
}

/* (C) Markdown 元素样式（针对 .llm-msg.assistant .msg-body 内的 HTML） */
.llm-msg.assistant .msg-body > *:first-child { margin-top: 0 !important; }
.llm-msg.assistant .msg-body > *:last-child  { margin-bottom: 0 !important; }

/* === .markdown-body 紧凑样式（借鉴 1422_compact + 进一步压缩） === */
.markdown-body {
    color: #1f2937;
    font-size: 14px;
    line-height: 1.55;
}
.markdown-body > *:first-child { margin-top: 0 !important; }
.markdown-body > *:last-child  { margin-bottom: 0 !important; }

/* 段落：紧凑 */
.markdown-body p {
    margin: 0.35em 0;
}
.markdown-body p + p { margin-top: 0.5em; }

/* 标题：明显但不浪费空间，h3 加底部细线增强层次感 */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 0.7em 0 0.25em;
    line-height: 1.25;
    color: #0f172a;
    font-weight: 800;
}
.markdown-body h1 { font-size: 1.18em; }
.markdown-body h2 { font-size: 1.10em; }
.markdown-body h3 {
    font-size: 1.04em;
    padding-bottom: 0.18em;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}
.markdown-body h4 { font-size: 1.00em; color: #0891b2; }

/* 列表：缩小 margin，让前后段不撑开 */
.markdown-body ul,
.markdown-body ol {
    margin: 0.3em 0;
    padding-left: 1.4em;
}
.markdown-body li {
    margin: 0.12em 0;
    line-height: 1.55;
}
.markdown-body li > p { margin: 0.1em 0; }
.markdown-body li::marker { color: #0891b2; font-weight: 700; }
.markdown-body li > ul,
.markdown-body li > ol { margin: 0.15em 0 0.2em; }

/* 强调 */
.markdown-body strong {
    color: #0f172a;
    font-weight: 800;
}
.markdown-body em { font-style: italic; color: #475569; }
.markdown-body del,
.markdown-body s  { color: #94a3b8; }

/* 行内代码：青色高亮 */
.markdown-body code {
    padding: 0.1em 0.38em;
    border-radius: 4px;
    background: rgba(8, 145, 178, 0.12);
    color: #086d80;
    font-family: "JetBrains Mono", Consolas, ui-monospace, monospace;
    font-size: 0.9em;
}

/* 代码块：深色背景 */
.markdown-body pre {
    margin: 0.5em 0;
    padding: 0.8em 0.9em;
    overflow-x: auto;
    border-radius: 7px;
    background: #122033;
    color: #e2e8f0;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}
.markdown-body pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 0.86em;
}

/* 引用 */
.markdown-body blockquote {
    margin: 0.45em 0;
    padding: 0.3em 0.85em;
    border-left: 3px solid #06b6d4;
    background: rgba(148, 163, 184, 0.08);
    color: #475569;
    border-radius: 0 4px 4px 0;
}
.markdown-body blockquote > *:first-child { margin-top: 0; }
.markdown-body blockquote > *:last-child  { margin-bottom: 0; }

/* 表格 */
.markdown-body table {
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 0.92em;
    width: 100%;
    background: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.markdown-body th,
.markdown-body td {
    border: 1px solid #e2e8f0;
    padding: 0.32em 0.6em;
    text-align: left;
    vertical-align: top;
}
.markdown-body th {
    background: rgba(8, 145, 178, 0.08);
    color: #0c4a6e;
    font-weight: 700;
}
.markdown-body tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.7);
}

/* 分割线 */
.markdown-body hr {
    border: 0;
    border-top: 1px dashed #cbd5e1;
    margin: 0.7em 0;
}

/* 链接 */
.markdown-body a {
    color: #0891b2;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.markdown-body a:hover {
    color: #0369a1;
    text-decoration-thickness: 2px;
}

/* 折叠连续多 br（很多 LLM 输出 \n\n\n 会变成多个空 br） */
.markdown-body br + br { display: none; }

.llm-msg.assistant .msg-body code {
    background: rgba(8, 145, 178, 0.12);
    color: #086d80;
    padding: 0.13em 0.4em;
    border-radius: 4px;
    font-family: 'JetBrains Mono', Consolas, ui-monospace, monospace;
    font-size: 0.9em;
}
.llm-msg.assistant .msg-body pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.85em 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.7em 0;
    font-size: 0.85em;
    line-height: 1.55;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}
.llm-msg.assistant .msg-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 1em;
    border-radius: 0;
}

.llm-msg.assistant .msg-body blockquote {
    border-left: 3px solid #06b6d4;
    margin: 0.55em 0;
    padding: 0.3em 0.9em;
    color: #475569;
    background: rgba(148, 163, 184, 0.10);
    border-radius: 0 5px 5px 0;
}
.llm-msg.assistant .msg-body blockquote > *:first-child { margin-top: 0; }
.llm-msg.assistant .msg-body blockquote > *:last-child  { margin-bottom: 0; }

.llm-msg.assistant .msg-body table {
    border-collapse: collapse;
    margin: 0.65em 0;
    font-size: 0.92em;
    width: 100%;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.llm-msg.assistant .msg-body th,
.llm-msg.assistant .msg-body td {
    border: 1px solid #e2e8f0;
    padding: 0.4em 0.65em;
    text-align: left;
    vertical-align: top;
}
.llm-msg.assistant .msg-body th {
    background: rgba(8, 145, 178, 0.08);
    font-weight: 700;
    color: #0c4a6e;
}
.llm-msg.assistant .msg-body tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.7);
}

.llm-msg.assistant .msg-body strong { font-weight: 700; color: #0f172a; }
.llm-msg.assistant .msg-body em     { font-style: italic; }
.llm-msg.assistant .msg-body del,
.llm-msg.assistant .msg-body s      { color: #94a3b8; }

.llm-msg.assistant .msg-body hr {
    border: 0;
    border-top: 1px dashed #cbd5e1;
    margin: 0.85em 0;
}

.llm-msg.assistant .msg-body a {
    color: #0891b2;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.llm-msg.assistant .msg-body a:hover {
    color: #0369a1;
    text-decoration-thickness: 2px;
}

/* (D) 错误消息样式 */
.llm-msg.error .msg-body {
    color: #b91c1c;
}
.llm-msg.error .msg-body blockquote {
    border-left-color: #ef4444;
    color: #b91c1c;
    background: rgba(254, 226, 226, 0.5);
}

/* 防止 150% 缩放或较窄屏幕时继续互相挤。 */
@media (max-width: 1440px) {
    :root {
        --fix-left-w: 340px;
        --fix-right-w: 350px;
    }

    #topbar {
        grid-template-columns: minmax(260px, 300px) minmax(520px, 1fr) minmax(130px, 180px);
        gap: 10px !important;
        padding: 0 12px !important;
    }

    .brand-title { font-size: 17px !important; }
    .brand-sub { display: none !important; }
    .ctrl-label { display: none !important; }
    .ctrl-group-hour { min-width: 230px !important; }
    #hour-slider { width: 120px !important; }
    .map-topbar { max-width: calc(100% - 210px); }
}

@media (max-width: 1440px) {
    .panel-collapse-btn[data-panel="sidebar-left"] {
        left: calc(var(--fix-left-w) - 21px) !important;
    }
    .panel-collapse-btn[data-panel="sidebar-right"] {
        right: calc(var(--fix-right-w) - 21px) !important;
    }
}

@media (max-width: 1180px) {
    body {
        overflow: auto !important;
    }

    #topbar {
        position: sticky !important;
        height: auto !important;
        min-height: var(--fix-topbar-h);
        grid-template-columns: 1fr;
        padding: 12px !important;
    }

    #layout {
        position: static !important;
        height: auto !important;
        min-height: calc(100vh - var(--fix-topbar-h));
        flex-direction: column;
    }

    #sidebar-left.side-panel,
    #sidebar-right.side-panel {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    .middle-col {
        min-height: 720px;
    }

    .panel-collapse-btn[data-panel="sidebar-left"],
    .panel-collapse-btn[data-panel="sidebar-right"],
    .side-stub {
        position: fixed !important;
        top: 50% !important;
    }

    .panel-collapse-btn[data-panel="sidebar-left"] {
        left: 12px !important;
    }

    .panel-collapse-btn[data-panel="sidebar-right"] {
        right: 12px !important;
    }
}

/* Codex final: 修正 _md_1732 顶部栏与 AI 头部，避免 CC 版过高、挤压、截字。 */
:root {
    --fix-topbar-h: 56px;
}

#topbar {
    height: var(--fix-topbar-h) !important;
    min-height: var(--fix-topbar-h) !important;
    padding: 0 16px !important;
    display: grid !important;
    grid-template-columns: minmax(300px, 360px) minmax(600px, 1fr) minmax(150px, 220px) !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 5px 16px rgba(30, 41, 59, 0.13) !important;
}

.brand {
    gap: 10px !important;
    padding-right: 12px !important;
    min-width: 0 !important;
}

.brand-logo {
    width: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
}

.brand-title {
    font-size: 17px !important;
    line-height: 1.12 !important;
}

.brand-sub {
    margin-top: 2px !important;
    font-size: 11.5px !important;
}

.topbar-controls {
    gap: 10px !important;
    min-width: 0 !important;
}

.ctrl-group {
    gap: 7px !important;
}

.ctrl-label {
    font-size: 12px !important;
}

.radio-group {
    height: 38px !important;
    padding: 3px !important;
}

.radio-btn {
    height: 30px !important;
    min-width: 70px !important;
    padding: 0 12px !important;
    font-size: 13.5px !important;
}

#topbar input[type="date"] {
    width: 158px !important;
    height: 36px !important;
    font-size: 13.5px !important;
}

.ctrl-group-hour {
    min-width: 270px !important;
}

#hour-slider {
    width: 145px !important;
}

#hour-label {
    min-width: 58px !important;
    height: 36px !important;
    font-size: 16px !important;
}

.ctrl-status {
    height: 36px !important;
    padding: 0 12px !important;
}

#status {
    max-width: 170px !important;
    font-size: 13px !important;
}

#layout {
    top: var(--fix-topbar-h) !important;
    height: calc(100vh - var(--fix-topbar-h)) !important;
}

.map-topbar {
    top: 12px !important;
}

#sidebar-right .panel-head {
    min-height: 50px !important;
    height: 50px !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow: visible !important;
}

#sidebar-right .panel-head-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    font-size: 14px !important;
}

#sidebar-right .panel-head-title span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

#sidebar-right .panel-head-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
}

#sidebar-right .llm-select {
    width: 132px !important;
    min-width: 112px !important;
    max-width: 132px !important;
    height: 32px !important;
    padding: 0 8px !important;
    font-size: 13px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

#sidebar-right .llm-settings-btn {
    width: 32px !important;
    height: 32px !important;
    margin-left: 0 !important;
    flex: 0 0 32px !important;
}

@media (max-width: 1440px) {
    #topbar {
        grid-template-columns: minmax(260px, 310px) minmax(480px, 1fr) minmax(130px, 180px) !important;
        gap: 8px !important;
    }
    .ctrl-label { display: none !important; }
    .ctrl-group-hour { min-width: 220px !important; }
    #hour-slider { width: 112px !important; }
    #sidebar-right .llm-select {
        width: 120px !important;
        max-width: 120px !important;
    }
}

/* ====================================================================
   _2200：顶部省综合判定卡 + PM2.5/O3 点击 modal
   ==================================================================== */

/* 顶部卡固定显示在左栏最上方，独立于站点选择 */
.top-status-card-2200 {
    margin: 12px 14px 10px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* 兼容容器：保留 #pollution-banner 和 #province-banner id 但完全隐藏视觉 */
.tsc-compat-banner,
.tsc-compat-province {
    display: none !important;
}

/* 标题行：「状态」+ 阈值 */
.tsc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px 8px;
    background: linear-gradient(180deg, #eef4fa 0%, #e6ecf3 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    flex-wrap: nowrap;            /* 强制单行 */
    min-width: 0;
}
.tsc-title {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.3px;
    flex-shrink: 0;               /* 标题不被挤压 */
}
.tsc-title svg { color: #0891b2; flex-shrink: 0; }
.tsc-thresholds {
    font-size: 11px;
    color: #475569;
    text-align: right;
    line-height: 1.3;
    white-space: nowrap;          /* 阈值不换行 */
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.tsc-thresholds b { color: #0f172a; font-weight: 800; }

/* 行 2：省份 + 日期 */
.tsc-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px 6px;
    font-size: 13px;
}
.tsc-prov {
    font-weight: 800;
    font-size: 15px;
    color: #0f172a;
    letter-spacing: 0.3px;
}
.tsc-date-wrap {
    color: #64748b;
    font-size: 12px;
    font-family: "JetBrains Mono", Consolas, monospace;
}
.tsc-date {
    color: #0f172a;
    font-weight: 700;
}

/* 行 3：PM2.5 / O3 数值按钮 */
.tsc-buttons-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 14px 10px;
}
.tsc-pol-btn {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 9px 12px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-align: left;
}
.tsc-pol-btn:hover {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.08), rgba(6, 182, 212, 0.04));
    border-color: #0891b2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15);
}
.tsc-pol-name {
    font-size: 11.5px;
    color: #475569;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.tsc-pol-val {
    display: flex;
    align-items: baseline;
    gap: 3px;
}
.tsc-pol-val b {
    font-size: 19px;
    font-weight: 850;
    color: #0f172a;
    font-family: "JetBrains Mono", Consolas, monospace;
}
.tsc-pol-val small {
    font-size: 10.5px;
    color: #94a3b8;
    font-weight: 600;
}
.tsc-pol-icon {
    position: absolute;
    top: 50%;
    right: 9px;
    transform: translateY(-50%);
    color: #94a3b8;
    transition: all 0.18s;
}
.tsc-pol-btn:hover .tsc-pol-icon {
    color: #0891b2;
    transform: translateY(-50%) translateX(2px);
}

/* 行 4：综合状态 */
.tsc-overall-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 12px;
    border-top: 1px dashed rgba(15, 23, 42, 0.08);
}
.tsc-overall-label {
    font-size: 12.5px;
    color: #475569;
    font-weight: 700;
}
.tsc-overall-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: #94a3b8;
    color: white;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ============ 省内站点 modal ============ */
.tsc-modal {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tsc-modal.hidden { display: none !important; }
.tsc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tsc-modal-panel {
    position: relative;
    width: min(540px, calc(100vw - 32px));
    max-height: calc(100vh - 60px);
    background: white;
    border-radius: 12px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.45),
        0 0 0 1px rgba(148, 163, 184, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tscModalIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes tscModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tsc-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef4fa 100%);
}
.tsc-modal-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
}
.tsc-modal-title span { color: #0891b2; }
.tsc-modal-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.tsc-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.tsc-modal-body {
    padding: 12px 16px 16px;
    overflow-y: auto;
    flex: 1;
}
.tsc-modal-loading {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-size: 13px;
}
.tsc-station-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tsc-station-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    transition: all 0.15s;
}
.tsc-station-row:hover {
    background: #ecf6fb;
    border-color: #0891b2;
    transform: translateX(2px);
}
.tsc-station-row.over-threshold {
    background: #fef2f2;
    border-color: #fecaca;
}
.tsc-station-row.over-threshold:hover { background: #fee2e2; }
.tsc-st-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tsc-st-city {
    color: #94a3b8;
    font-weight: 500;
    font-size: 11.5px;
    margin-left: 4px;
}
.tsc-st-val {
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}
.tsc-station-row.over-threshold .tsc-st-val { color: #dc2626; }
.tsc-st-unit {
    font-size: 10.5px;
    color: #94a3b8;
    font-weight: 500;
}
.tsc-modal-empty {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-size: 13px;
}

/* ====================================================================
   _2240：4 状态 chip 横排 + 当前高亮 + 站点详细数据小标题
   ==================================================================== */

/* 行 4 改为 chip 横排：覆盖 _2200 的 .tsc-overall-row */
.tsc-overall-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px;
    padding: 9px 14px 12px !important;
    border-top: 1px dashed rgba(15, 23, 42, 0.08);
}
.tsc-overall-label {
    font-size: 11.5px;
    color: #475569;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.tsc-chips {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}
.tsc-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    cursor: default;
    user-select: none;
}
/* 当前状态高亮：颜色由 JS 设置 background + box-shadow 实现脉冲感 */
.tsc-chip.active {
    color: #ffffff;
    border-color: transparent;
    /* JS 会 set --chip-color = data-color */
    background: var(--chip-color, #94a3b8);
    box-shadow:
        0 2px 8px color-mix(in srgb, var(--chip-color, #94a3b8) 50%, transparent),
        0 0 0 2px color-mix(in srgb, var(--chip-color, #94a3b8) 25%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: scale(1.03);
    font-weight: 800;
    z-index: 1;
}
.tsc-chip.active::before {
    content: "✓ ";
    margin-right: 2px;
    font-weight: 900;
}
/* 非当前 chip hover 时微微提示（仅视觉，不可交互） */
.tsc-chip:not(.active):hover {
    background: #e2e8f0;
    color: #475569;
}

/* 站点详细数据小标题（和顶部 panel-head 同一字号）—— 用户要求加大 */
.sb-section-label-2240 {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 6px;
    font-size: 15px !important;       /* 和 .panel-head-title 同字号 */
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    color: #0f172a;
    border-top: 1px dashed rgba(15, 23, 42, 0.10);
    margin-top: 6px;
}
.sb-section-label-2240 svg {
    width: 16px !important;           /* 和 .panel-head-title svg 同 */
    height: 16px !important;
    color: #0891b2;
    flex-shrink: 0;
}
.sb-section-label-2240 span { color: #0f172a; }

/* ====================================================================
   v1.1：全局紧凑覆盖（基于 v1.0 的字号统一缩 12-20%）
   独立一段，方便回滚（注释掉这块就回到 v1.0）
   ==================================================================== */

/* (1) 顶栏 brand + 控件 */
.brand-title       { font-size: 16px !important; line-height: 1.15 !important; }
.brand-sub         { font-size: 11px !important; margin-top: 2px !important; }
.brand-logo        { width: 36px !important; height: 36px !important; border-radius: 7px !important; }
.brand-logo svg    { width: 22px !important; height: 22px !important; }
#topbar            { height: 56px !important; padding: 0 14px !important; }
.brand             { padding-right: 10px !important; }

.ctrl-label        { font-size: 11.5px !important; }
.radio-group       { height: 34px !important; padding: 3px !important; }
.radio-btn         { height: 26px !important; min-width: 64px !important; font-size: 12.5px !important; padding: 0 12px !important; }
#topbar input[type="date"] { height: 32px !important; width: 140px !important; font-size: 12.5px !important; padding: 0 10px !important; }
.ctrl-group-hour   { min-width: 250px !important; }
#hour-slider       { width: 140px !important; }
#hour-label        { font-size: 14px !important; min-width: 50px !important; }
.ctrl-status       { height: 34px !important; padding: 0 12px !important; }
#status            { font-size: 12px !important; max-width: 150px; }

/* (2) 左栏 panel-head（"省整体状态"） */
.panel-head        { min-height: 44px !important; padding: 0 14px !important; }
.panel-head-title  { font-size: 13px !important; }
.panel-head-title svg { width: 14px !important; height: 14px !important; }

/* (3) 顶部省综合判定卡 tsc-* */
.top-status-card-2200 { margin: 10px 12px 8px !important; }
.tsc-head          { padding: 8px 12px 6px !important; }
.tsc-title         { font-size: 12px !important; gap: 4px !important; }
.tsc-title svg     { width: 12px !important; height: 12px !important; }
.tsc-thresholds    { font-size: 10.5px !important; }
.tsc-meta-row      { padding: 8px 12px 4px !important; font-size: 12px !important; }
.tsc-prov          { font-size: 13px !important; }
.tsc-date-wrap     { font-size: 11px !important; }
.tsc-buttons-row   { padding: 4px 12px 8px !important; gap: 6px !important; }
.tsc-pol-btn       { padding: 7px 9px !important; gap: 3px !important; }
.tsc-pol-name      { font-size: 10.5px !important; }
.tsc-pol-val b     { font-size: 16px !important; }
.tsc-pol-val small { font-size: 9.5px !important; }
.tsc-pol-icon      { right: 7px !important; }
.tsc-overall-row   { padding: 7px 12px 10px !important; gap: 4px !important; }
.tsc-overall-label { font-size: 10.5px !important; }
.tsc-chip          { padding: 4px 6px !important; font-size: 10.5px !important; }

/* (4) 站点详细数据小标题 */
.sb-section-label-2240   { font-size: 13px !important; padding: 10px 16px 5px !important; gap: 6px !important; }
.sb-section-label-2240 svg { width: 14px !important; height: 14px !important; }

/* (5) 站点头 + 关键值卡 */
.sb-header         { padding: 14px 14px 10px !important; }
.sb-icon           { width: 38px !important; height: 38px !important; }
.sb-station-name   { font-size: 19px !important; }
.city-tag, .code-tag, .ref-tag { font-size: 11.5px !important; padding: 3px 8px !important; }
.sb-coord          { font-size: 11px !important; margin-top: 7px; }
.card              { margin: 10px 12px !important; }
.card-head         { padding: 10px 14px !important; }
.card-head-title   { font-size: 12.5px !important; gap: 7px !important; }
.card-head-title svg { width: 13px !important; height: 13px !important; }
.section-hint      { font-size: 11px !important; }
.stat-card         { padding: 10px 11px !important; }
.stat-card-head    { gap: 6px !important; }
.stat-name         { font-size: 12px !important; }
.stat-value        { font-size: 26px !important; }
.stat-unit         { font-size: 11px !important; }
.stat-status       { font-size: 11px !important; }
.day-stats-label   { font-size: 10px !important; margin-bottom: 3px !important; }

/* (6) 底部时序图标题 */
.bp-head           { height: 48px !important; padding: 0 14px !important; }
.bp-title          { font-size: 16px !important; }
.bp-sub            { font-size: 11.5px !important; }

/* (7) 右栏 AI 区域：cqw 字号配合容器再缩一档 */
#sidebar-right .panel-head-title { font-size: clamp(11px, 2.7cqw, 14px) !important; }
#sidebar-right .ai-tab           { font-size: clamp(10.5px, 2.5cqw, 12.5px) !important; }
#sidebar-right .ai-context-bar   { font-size: clamp(10px, 2.3cqw, 12px) !important; }
#sidebar-right .quick-ask        { font-size: clamp(10px, 2.3cqw, 11.5px) !important; }
#sidebar-right #llm-input        { font-size: clamp(10.5px, 2.5cqw, 12.5px) !important; min-height: 42px !important; }
#sidebar-right .llm-send         { font-size: clamp(10px, 2.4cqw, 12px) !important; }
#sidebar-right .llm-msg .msg-body{ font-size: 13px !important; line-height: 1.5 !important; }
.markdown-body                    { font-size: 13px !important; line-height: 1.5 !important; }
.markdown-body h1 { font-size: 1.12em !important; }
.markdown-body h2 { font-size: 1.06em !important; }
.markdown-body h3 { font-size: 1.02em !important; }

/* (8) 折叠按钮也缩小 */
.panel-collapse-btn  { width: 36px !important; height: 36px !important; }
.panel-collapse-btn svg { width: 14px !important; height: 14px !important; }
#bp-collapse-btn     { width: 36px !important; height: 36px !important; }
#bp-collapse-btn svg { width: 14px !important; height: 14px !important; }

/* ====================================================================
   v1.1.2 紧凑暴力补丁：左右两栏整体 zoom 0.85（保持地图原比例）
   + 关键值卡大数字进一步缩小（PM2.5 13.8 这种数字）
   ==================================================================== */

/* 整体缩 15% —— zoom 不影响 leaflet 地图，因为地图在 #middle 不在两栏内 */
#sidebar-left,
#sidebar-right {
    zoom: 0.85;
}

/* 关键值数字之前 26px 看着还大，再砍到 19px */
.stat-value          { font-size: 19px !important; }
.stat-unit           { font-size: 10.5px !important; }
.stat-name           { font-size: 11.5px !important; }
.stat-card           { padding: 8px 10px !important; }
.stat-status         { font-size: 10.5px !important; }

/* 顶部判定卡数字也砍 */
.tsc-pol-val b       { font-size: 14px !important; }
.tsc-pol-name        { font-size: 10px !important; }
.tsc-pol-btn         { padding: 6px 8px !important; }

/* 站点名也砍 */
.sb-station-name     { font-size: 16px !important; line-height: 1.12 !important; }
.sb-icon             { width: 32px !important; height: 32px !important; }
.sb-icon svg         { width: 16px !important; height: 16px !important; }
.city-tag, .code-tag, .ref-tag { font-size: 10.5px !important; padding: 2px 7px !important; }
.sb-coord            { font-size: 10px !important; }

/* card-head 也砍 */
.card-head           { padding: 8px 12px !important; }
.card-head-title     { font-size: 11.5px !important; }

/* day-stats 进一步缩 */
.ds-row              { font-size: 11px !important; padding: 2px 4px !important; }
.ds-label            { font-size: 10.5px !important; }
.ds-value            { font-size: 12px !important; }
.ds-extra            { font-size: 9.5px !important; }

/* 数据质量 */
.data-quality        { font-size: 10.5px !important; padding: 6px 10px !important; }
.dq-item             { font-size: 10.5px !important; }

/* 底部时序图 */
.bp-title            { font-size: 14px !important; }
.bp-sub              { font-size: 10.5px !important; }

/* 右栏：因为 zoom 0.85 已经整体缩了，cqw 字号回稍微抬高一点保证可读 */
#sidebar-right .panel-head-title { font-size: clamp(12px, 3.0cqw, 15px) !important; }
#sidebar-right .ai-tab           { font-size: clamp(11px, 2.7cqw, 13.5px) !important; }
#sidebar-right .ai-context-bar   { font-size: clamp(10.5px, 2.5cqw, 12.5px) !important; }
#sidebar-right .quick-ask        { font-size: clamp(10.5px, 2.5cqw, 12px) !important; }
#sidebar-right #llm-input        { font-size: clamp(11px, 2.7cqw, 13.5px) !important; }
#sidebar-right .llm-msg .msg-body{ font-size: 14px !important; }
.markdown-body                   { font-size: 14px !important; }

/* ====================================================================
   v1.1.3：中栏（地图上方信息条 + 底部时序图标题）也压缩
   不能给 #middle zoom（会把地图也缩，破坏 leaflet 计算 + ECharts 模糊）
   只精准缩字号 + svg
   ==================================================================== */

/* 地图上方浮动信息条："2025-01-15 14:00 · 全国 PM2.5 均值 26.3..." */
.map-topbar {
    padding: 6px 14px !important;
    font-size: 12px !important;
    top: 10px !important;
}
.map-topbar b               { font-size: 12px !important; }
.map-topbar .topbar-num     { font-size: 13px !important; }
#map-topbar-text            { font-size: 12px !important; }

/* 底部时序图：bp-head 标题 + sub + 右上图例数字（v1.1.4 再压一档） */
.bp-head                    { height: 36px !important; padding: 0 10px !important; min-height: 36px !important; gap: 8px !important; }
.bp-title                   { font-size: 12px !important; line-height: 1.15 !important; }
.bp-sub                     { font-size: 9.5px !important; }
.bp-head-right              { gap: 7px !important; font-size: 10px !important; }
.bp-head-right b            { font-size: 11px !important; }
.bp-head-right .bp-legend   { font-size: 9.5px !important; }
/* bp-head 左侧图标也缩 */
.bp-head svg                { width: 14px !important; height: 14px !important; }
.bp-head > div:first-child  { gap: 6px !important; }

/* v1.1.7：隐藏正中央那个折叠按钮（absolute 定位会和 ECharts legend / 标题重叠） */
#bp-collapse-btn            { display: none !important; }

/* v1.1.8：bp-stats 右上数字卡片极致紧凑（去 min-width、padding 压、单行布局） */
.bp-stats {
    gap: 6px !important;
    flex-wrap: nowrap !important;
}
.bp-stat {
    min-width: 0 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    border-left-width: 2px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
/* row（● PM2.5）和 vals（峰34 均13.8）原本是上下两行，改成一行水平 */
.bp-stat-row {
    margin-bottom: 0 !important;
    font-size: 10px !important;
    gap: 4px !important;
}
.bp-stat-dot { width: 5px !important; height: 5px !important; }
.bp-stat-label { font-size: 10px !important; }
.bp-stat-vals {
    gap: 6px !important;
}
.bp-stat-vals > span {
    font-size: 11px !important;
    gap: 2px !important;
}
.bp-stat-mini { font-size: 9px !important; letter-spacing: 0.2px !important; }

/* ====================================================================
   v1.1.9：左下"当日 24H 统计" + 中间 legend-mini 紧凑化
   ==================================================================== */

/* (A) ds-row 改 4 列单行布局，所有元素挤一行（之前 3 列 grid 装不下 4 元素被换行） */
.ds-row {
    display: grid !important;
    grid-template-columns: 6px auto 1fr auto !important;
    /*       dot   label  弹性间隔  value+extra 容器右对齐 */
    gap: 5px !important;
    padding: 1px 4px !important;
    line-height: 1.3 !important;
    align-items: baseline !important;
}
.ds-dot       { width: 5px !important; height: 5px !important; }
.ds-label     { font-size: 10.5px !important; text-align: left !important; }
.ds-value     {
    font-size: 12px !important;
    min-width: 0 !important;
    text-align: right !important;
    grid-column: 3 / 4 !important;
    justify-self: end !important;
}
.ds-extra     {
    font-size: 9px !important;
    color: #94a3b8 !important;
    white-space: nowrap !important;
    grid-column: 4 / 5 !important;
    padding-left: 6px !important;
}

/* 隐藏"中位/振幅/标准差"3 行冗余注释（μg/m³、max-min、σ —— 重复无用信息） */
/* 用 :not() 排除有 max/min/over/ok class 的行（这些行的 extra 是 @时刻 或 "小时 >X" 有意义） */
.day-stats-grid .ds-row:not(.ds-row-max):not(.ds-row-min):not(.ds-row-over):not(.ds-row-ok) .ds-extra {
    display: none !important;
}

/* day-stats-wrap 整体压缩 */
.day-stats-wrap   { margin-top: 6px !important; padding-top: 4px !important; }
.day-stats-label  { font-size: 10px !important; margin-bottom: 2px !important; }
.day-stats-grid   { gap: 0 !important; }

/* (B) legend-mini（地图右上 PM2.5 (μg/m³) 图例）紧凑：2 列布局 + 字号缩 */
.legend-mini {
    padding: 6px 10px !important;
    font-size: 10px !important;
    line-height: 1.3 !important;
    border-radius: 7px !important;
}
.legend-mini-title {
    font-size: 10.5px !important;
    margin-bottom: 4px !important;
    padding-bottom: 3px !important;
    font-weight: 800 !important;
}
.legend-mini-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;   /* 2 列 */
    column-gap: 12px !important;
    row-gap: 2px !important;
}
.legend-mini-item {
    font-size: 9.5px !important;
    gap: 5px !important;
    padding: 1px 0 !important;
    line-height: 1.25 !important;
}
.legend-mini-item .swatch,
.legend-mini .swatch {
    width: 9px !important;
    height: 9px !important;
    border-radius: 2px !important;
    flex-shrink: 0;
}
.legend-item-muted {
    grid-column: 1 / -1 !important;
    margin-top: 2px !important;
}

/* ====================================================================
   v1.1.10：上方关键值卡瘦身 + 隐藏超标行重叠的"小时>75"扰民 extra
   ==================================================================== */

/* 上方 stat-value 大数字再缩，让上下视觉比例平衡 */
.stat-value      { font-size: 17px !important; line-height: 1.05 !important; }
.stat-unit       { font-size: 9.5px !important; }
.stat-name       { font-size: 11px !important; }
.stat-card       { padding: 7px 9px !important; gap: 3px !important; }
.stat-card-head  { gap: 5px !important; }
.stat-value-row  { gap: 3px !important; align-items: baseline !important; margin: 1px 0 !important; }

/* "--" 状态在没有数据时纯占位，隐藏掉省空间 */
.stat-status     { font-size: 9.5px !important; min-height: 0 !important; padding: 1px 0 !important; line-height: 1.1 !important; }
.stat-status:empty,
.stat-status:not([data-state]) { display: none !important; }
/* 简单方案：直接全隐 */
.stat-status     { display: none !important; }

/* 修超标行重叠：列布局放宽 + extra 在窄屏时隐藏 */
.ds-row {
    grid-template-columns: 5px auto 1fr !important;   /* 3 列：dot + label + value 撑右 */
    grid-template-rows: auto !important;
}
.ds-value {
    grid-column: 3 / 4 !important;
    justify-self: end !important;
    text-align: right !important;
}
/* ds-extra 全部隐藏（之前的 @时刻 / 小时>X 在窄宽下与 value 重叠且视觉嘈杂；
   峰值时刻信息有意义，但在小卡片上不是必需，整体清爽优先） */
.ds-extra { display: none !important; }

/* 数据质量卡瘦身（下方"当日 PM2.5 有效:24 小时" / "当日 O3 有效:17 小时"） */
.data-quality { padding: 6px 10px !important; margin: 8px 12px !important; gap: 10px !important; }
.dq-item      { font-size: 10.5px !important; gap: 5px !important; }
.dq-icon      { font-size: 12px !important; }
.dq-text      { font-size: 10.5px !important; }
.dq-text b    { font-size: 12px !important; }
.dq-unit      { font-size: 9.5px !important; }
.dq-sep       { width: 1px !important; height: 14px !important; }

/* 折叠按钮也缩（bp-collapse-btn 之前已经设了 36，再缩一档） */
#bp-collapse-btn            { width: 30px !important; height: 30px !important; top: 6px !important; }
#bp-collapse-btn svg        { width: 12px !important; height: 12px !important; }

/* 底栏整体高度：用更宽 clamp + 配合 ECharts grid.bottom 78px 保证 X 轴坐标始终可见 */
.bottom-panel,
#bottom-panel {
    --fix-bottom-h: clamp(200px, 32vh, 420px);
    height: clamp(200px, 32vh, 420px) !important;
    min-height: 200px !important;
}
.bottom-panel.collapsed,
#bottom-panel.collapsed {
    height: 38px !important;
    min-height: 38px !important;
}
.bp-body { padding: 0 8px 6px !important; height: calc(100% - 36px) !important; }
#chart   { width: 100% !important; height: 100% !important; min-height: 160px !important; }

/* 地图工具栏按钮（右上 basemap） */
.basemap-btn                { height: 30px !important; padding: 0 8px !important; }
.basemap-btn svg            { width: 14px !important; height: 14px !important; }

/* legend 图例 */
.legend-mini                { font-size: 11px !important; padding: 8px 10px !important; }
.legend-mini-item           { font-size: 11px !important; gap: 5px !important; }
.legend-mini-title          { font-size: 11.5px !important; margin-bottom: 5px !important; }

/* ====================================================================
   v1.5：模型管理 - 知识库区域（文件上传 + 列表 + 删除）
   ==================================================================== */

.kb-section {
    margin: 14px 0 10px;
    padding: 10px 12px;
    background: rgba(248, 250, 252, 0.6);
    border: 1px dashed #cbd5e1;
    border-radius: 7px;
}

.kb-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.kb-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
}
.kb-title svg { color: #0891b2; flex-shrink: 0; }
.kb-stat {
    font-size: 10.5px;
    color: #64748b;
    font-family: "JetBrains Mono", Consolas, monospace;
}

.kb-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    justify-content: center;
    padding: 7px 12px;
    background: rgba(8, 145, 178, 0.06);
    border: 1px dashed #06b6d4;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 700;
    color: #0891b2;
    transition: all 0.15s;
}
.kb-upload-btn:hover {
    background: rgba(8, 145, 178, 0.12);
    border-style: solid;
}

.kb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.kb-list:empty { display: none; }

.kb-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 5px 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 11px;
}
.kb-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
    font-weight: 600;
}
.kb-item-size {
    color: #64748b;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 10px;
    white-space: nowrap;
}
.kb-item-del {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.kb-item-del:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

/* ====================================================================
   v1.6：附近气象站卡 + 地图气象 toggle 按钮 + 气象 marker 样式
   ==================================================================== */

/* 左栏 weather-card */
.weather-card {
    padding: 6px 12px 10px;
    font-size: 11.5px;
    color: #475569;
}
.weather-empty {
    color: #94a3b8;
    text-align: center;
    padding: 14px 0;
    font-size: 11px;
}
.weather-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px dashed #e2e8f0;
}
.weather-meta-label { color: #94a3b8; font-size: 10.5px; }
.weather-meta-value { color: #0f172a; font-weight: 700; font-size: 11.5px; }
.weather-meta-value b {
    color: #0891b2; font-family: "JetBrains Mono", Consolas, monospace;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px 6px;
}
.weather-cell {
    background: rgba(8, 145, 178, 0.06);
    border-radius: 5px;
    padding: 5px 4px;
    text-align: center;
}
.weather-cell-label { font-size: 9.5px; color: #64748b; }
.weather-cell-value {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    font-family: "JetBrains Mono", Consolas, monospace;
    line-height: 1.2;
}
.weather-cell-unit { font-size: 9px; color: #94a3b8; }

/* 地图右上 weather-toggle 按钮 */
.weather-toggle.active {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.30) !important;
}

/* 气象 marker：跟 PM 站点（圆点）区分，用方形蓝色小图标 */
.weather-marker {
    width: 14px;
    height: 14px;
    background: #0ea5e9;
    border: 2px solid white;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.5);
    transform: rotate(45deg);
}
.weather-marker:hover {
    background: #0284c7;
    transform: rotate(45deg) scale(1.2);
}
.aq-weather-tooltip {
    font-size: 11.5px !important;
    padding: 6px 10px !important;
}

/* v1.6: 底栏图表切换 [污染物 / 气象 / 相关] segment control
   v1.6.2: 推到 bp-head 最右（在 PM2.5/O3 数字卡之后）*/
.bp-tab-segments {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: rgba(8, 145, 178, 0.08);
    border-radius: 6px;
    margin: 0 0 0 12px;
    flex-shrink: 0;
    order: 999;            /* 最大 order → flex 容器内排在最后 */
}
.bp-head-right { order: 50; }
.bp-head-left  { order: 1; }
.bp-tab {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    padding: 0 8px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    transition: all 0.15s;
}
.bp-tab:hover { color: #0891b2; background: rgba(255,255,255,0.6); }
.bp-tab.active {
    background: white;
    color: #0891b2;
    box-shadow: 0 1px 3px rgba(8,145,178,0.20);
}
.bp-tab svg { flex-shrink: 0; }

/* v1.6: 最近气象站高亮 marker（橙色脉冲方块）*/
.nearest-weather-wrap {
    background: transparent !important;
    border: none !important;
}
.nearest-weather-marker {
    position: relative;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
}
.nearest-weather-marker::after {
    content: "";
    width: 14px; height: 14px;
    background: #f59e0b;
    border: 2px solid white;
    border-radius: 3px;
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
    z-index: 2;
}
.nearest-pulse {
    position: absolute;
    width: 22px; height: 22px;
    background: rgba(245, 158, 11, 0.4);
    border-radius: 50%;
    animation: nearestPulse 1.8s ease-out infinite;
}
@keyframes nearestPulse {
    0%   { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* ========== v1.7 报告按钮（移到 ai-tabs 行，历史右边）========== */
.ai-report-btn {
    margin-left: auto !important;          /* 顶到右边，新建按钮紧随其后 */
    display: inline-flex; align-items: center; gap: 4px;
    height: 30px; padding: 0 8px;
    border-radius: 8px;
    background: linear-gradient(180deg, #ecfdf5, #d1fae5);
    border: 1px solid rgba(16, 185, 129, .4);
    color: #047857;
    font-size: 11.5px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: all .16s ease;
}
.ai-report-btn svg { color: #059669; }
.ai-report-btn:hover {
    background: linear-gradient(180deg, #d1fae5, #a7f3d0);
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, .25);
    transform: translateY(-1px);
}
.ai-report-btn:active { transform: translateY(0); }
/* 新建对话按钮原本 margin-left:auto，现在让报告按钮占据，新建按钮紧跟 */
.ai-tabs .ai-tab-action { margin-left: 6px !important; }

/* 模态框 */
.report-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; }
.report-modal.hidden { display: none; }
.report-modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px); }
.report-modal-box {
    position: relative; width: min(440px, 92vw); max-height: 86vh; overflow: auto;
    background: #fff; border-radius: 12px; box-shadow: 0 26px 60px rgba(15, 23, 42, .28);
    border: 1px solid #e2e8f0;
}
.report-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid #e2e8f0;
    font-size: 16px; font-weight: 800; color: #142033;
    background: linear-gradient(180deg, #f0fdf4, #ffffff);
}
.report-modal-head button#report-modal-close {
    width: 28px; height: 28px; border: none; background: transparent;
    font-size: 22px; line-height: 1; color: #64748b; cursor: pointer; border-radius: 6px;
}
.report-modal-head button#report-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.report-modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.report-modal-body .rm-row {
    display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px;
}
.report-modal-body .rm-row.hidden { display: none; }
.report-modal-body .rm-row > label:first-child { color: #475569; font-weight: 600; font-size: 13px; }
.report-modal-body select,
.report-modal-body input[type="date"],
.report-modal-body input[type="month"] {
    width: 100%; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 7px;
    font-size: 13.5px; color: #142033; background: #fff;
}
.report-modal-body .rm-radio-group { display: flex; gap: 16px; }
.report-modal-body .rm-radio-group label {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer;
}
.report-modal-body .rm-tip {
    margin-top: 4px; padding: 10px 12px; background: #f8fafc; border: 1px dashed #cbd5e1;
    border-radius: 8px; color: #475569; font-size: 12.5px; line-height: 1.55;
}
.report-modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 12px 18px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.rm-btn {
    padding: 7px 16px; border-radius: 7px; font-size: 13.5px; font-weight: 700;
    cursor: pointer; border: 1px solid transparent;
}
.rm-btn-ghost { background: #fff; color: #475569; border-color: #cbd5e1; }
.rm-btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.rm-btn-primary { background: #16a34a; color: #fff; border-color: #15803d; }
.rm-btn-primary:hover { background: #15803d; }

/* 消息卡片末尾的下载条 */
.report-dl-bar {
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed #cbd5e1;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.report-dl-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    color: #fff; font-size: 13px; font-weight: 800; border: none;
    cursor: pointer; box-shadow: 0 4px 10px rgba(22, 163, 74, .22);
}
.report-dl-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.report-dl-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.report-dl-tip { color: #64748b; font-size: 12px; }

/* v1.6 报告进度浮窗 */
.report-progress { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px); }
.report-progress-box {
    background: #fff; border-radius: 12px; padding: 22px 26px;
    box-shadow: 0 26px 60px rgba(15, 23, 42, .28);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    min-width: 320px; max-width: 460px;
}
.rp-spinner {
    width: 36px; height: 36px; border-radius: 50%;
    border: 3px solid #e2e8f0; border-top-color: #22c55e;
    animation: rp-spin 0.8s linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }
.rp-text { font-size: 14px; color: #142033; font-weight: 700; }
.rp-text b { color: #16a34a; }
.rp-sub { font-size: 12px; color: #64748b; text-align: center; }
.rm-mode-only-ai { color: #94a3b8; font-size: 11px; font-weight: 400; }
/* 禁用的日报 radio 文字变灰 */
.rm-radio-group label input[type="radio"]:disabled + * { color: #cbd5e1; }

/* v1.7 左上角品牌 logo 换成 icon.jpg（白底蓝 X），撑满圆角容器 */
.brand-logo.brand-logo-img {
    background: #fff !important;
    padding: 0 !important;
    overflow: hidden;
}
.brand-logo.brand-logo-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* ============================================================
   20260613 右栏视觉重构 + 顶栏 i18n toggle 适配
   ============================================================ */

/* --- 顶栏：状态文本省略，toggle 不被压缩不换行 --- */
.ctrl-status {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
}
#status {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#lang-toggle { flex: none !important; margin-left: 2px !important; }

/* --- 右栏 tab 行：所有控件统一 32px、垂直居中对齐 --- */
#sidebar-right .ai-tabs {
    align-items: center !important;
    padding-right: 12px !important;
}
#sidebar-right .ai-report-btn {
    height: 32px !important;
    padding: 0 11px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}
#sidebar-right .ai-tab-action {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    margin-left: 8px !important;
}

/* --- 模式切换（直接问答 / Agent）：segmented control 风格 --- */
#sidebar-right .chat-mode-switch {
    gap: 0 !important;
    margin: 10px 16px 10px !important;
    padding: 3px !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
}
#sidebar-right .cms-btn {
    border: none !important;
    background: transparent !important;
    border-radius: 7px !important;
    padding: 6px 8px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    box-shadow: none !important;
}
#sidebar-right .cms-btn:hover { color: #0e7490 !important; }
#sidebar-right .cms-btn.active {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(6, 182, 212, .35) !important;
}

/* --- 上下文条：左名右状态，垂直居中 --- */
#sidebar-right .ai-context-bar {
    display: flex !important;
    align-items: center !important;
    gap: 6px;
    margin: 12px 16px 8px !important;
    padding: 10px 13px !important;
    font-size: 13.5px !important;
}
#sidebar-right .ai-context-bar #ai-context-time { margin-left: auto; color: #94a3b8; font-size: 12px; }


/* --- v2.1: AI 回答里的 Markdown 表格 / 分割线（renderMarkdown 新增支持） --- */
.msg-body table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
    width: 100%;
    display: block;
    overflow-x: auto;   /* 列多时横向滚动，不挤破右栏 */
}
.msg-body th, .msg-body td {
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
    text-align: left;
    white-space: nowrap;
}
.msg-body th { background: #f1f5f9; font-weight: 700; }
.msg-body tr:nth-child(even) td { background: #f8fafc; }
.msg-body hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 10px 0;
}