/* =========================================================
   运营数据看板 — 样式
   浅色 / 深色主题均由 CSS 变量驱动
   ========================================================= */

/* ---------- 浅色主题（默认） ---------- */
:root {
    color-scheme: light;

    --bg: #f5f5f2;
    --surface: #fcfcfb;
    --surface-2: #f0f0eb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);

    --accent: #2a78d6;
    --accent-ink: #1c5cab;
    --accent-weak: rgba(42, 120, 214, 0.10);
    --accent-weak-2: rgba(42, 120, 214, 0.18);

    --good: #006300;
    --good-bg: rgba(12, 163, 12, 0.12);
    --bad: #b42318;
    --bad-bg: rgba(208, 59, 59, 0.12);

    --shadow: 0 1px 2px rgba(11, 11, 11, 0.04);
    --shadow-hover: 0 12px 32px rgba(11, 11, 11, 0.08), 0 2px 6px rgba(11, 11, 11, 0.04);

    --sidebar-w: 232px;
    --sidebar-w-collapsed: 76px;
    --sidebar-mobile-w: 268px;
    --radius: 16px;
    --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---------- 深色主题：系统偏好（未手动选择时生效） ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --bg: #0d0d0d;
        --surface: #1a1a19;
        --surface-2: #232321;
        --ink: #f0efec;
        --ink-2: #c3c2b7;
        --muted: #898781;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, 0.10);

        --accent: #3987e5;
        --accent-ink: #86b6ef;
        --accent-weak: rgba(57, 135, 229, 0.14);
        --accent-weak-2: rgba(57, 135, 229, 0.26);

        --good: #0ca30c;
        --good-bg: rgba(12, 163, 12, 0.14);
        --bad: #e66767;
        --bad-bg: rgba(230, 103, 103, 0.14);

        --shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
        --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.45);
    }
}

/* ---------- 深色主题：手动切换 ---------- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);

    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-weak: rgba(57, 135, 229, 0.14);
    --accent-weak-2: rgba(57, 135, 229, 0.26);

    --good: #0ca30c;
    --good-bg: rgba(12, 163, 12, 0.14);
    --bad: #e66767;
    --bad-bg: rgba(230, 103, 103, 0.14);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
    margin: 0;
}

a {
    color: inherit;
}

button {
    font: inherit;
}

svg {
    display: block;
}

[id] {
    scroll-margin-top: 88px;
}

::selection {
    background: var(--accent-weak-2);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: none;
}

/* ---------- 外壳 ---------- */
.app {
    min-height: 100vh;
}

.content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ---------- 侧栏：手机端默认是抽屉 ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-mobile-w);
    max-width: 86vw;
    padding: 22px 14px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--surface);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 767.98px) {
    body.drawer-open {
        overflow: hidden;
    }
}

/* 初始化时禁止侧栏/内容宽度过渡，避免首帧闪动 */
.no-sidebar-transition .sidebar,
.no-sidebar-transition .content {
    transition: none !important;
}

/* ---------- 侧栏头部 / 折叠按钮 ---------- */
.sidebar-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 8px 22px;
}

.brand {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
}

.brand-name {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.brand-name span {
    margin-left: 5px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
}

.sidebar-toggle {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.sidebar-toggle .icon-chevron {
    transition: transform 0.2s ease;
}

.sidebar-toggle .icon-close {
    display: none;
}

@media (max-width: 767.98px) {
    .sidebar-toggle .icon-chevron {
        display: none;
    }

    .sidebar-toggle .icon-close {
        display: block;
    }
}

/* ---------- 导航 ---------- */
.nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.nav-label {
    padding: 10px 12px 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.nav-link.is-active {
    background: var(--accent-weak);
    color: var(--accent-ink);
}

.nav-link svg {
    flex: none;
}

/* ---------- 侧栏底部 ---------- */
.sidebar-foot {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-status {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px 12px;
    color: var(--muted);
    font-size: 11.5px;
}

.user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

.avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-weak-2);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.user-role {
    color: var(--muted);
    font-size: 11.5px;
}

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px;
}

.heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin-right: auto;
}

/* 手机端左上角按钮：打开侧栏 */
.mobile-brand {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.mobile-brand:hover {
    filter: brightness(1.07);
}

h1 {
    font-size: clamp(19px, 2.2vw, 24px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12.5px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.segmented {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
}

.segmented button {
    appearance: none;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-2);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.segmented button:hover {
    color: var(--ink);
}

.segmented button[aria-pressed="true"] {
    background: var(--accent-weak-2);
    color: var(--accent-ink);
    font-weight: 600;
}

.icon-button {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
    border-color: var(--axis);
    color: var(--ink);
}

/* 主题按钮图标：浅色显示月亮，深色显示太阳 */
.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

:root[data-theme="dark"] .icon-sun {
    display: block;
}

:root[data-theme="dark"] .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun {
        display: block;
    }

    :root:not([data-theme="light"]) .icon-moon {
        display: none;
    }
}

/* ---------- 主体 ---------- */
main {
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 16px 32px;
}

.section {
    margin-bottom: 26px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 14px;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-sub,
.panel-sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12.5px;
}

.updated {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 0 3px var(--good-bg);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

.noscript {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 14px;
}

/* ---------- KPI 卡片 ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--axis);
    box-shadow: var(--shadow-hover);
}

.kpi-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.kpi-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-weak);
    color: var(--accent-ink);
}

.kpi-label {
    overflow: hidden;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.kpi-spark {
    height: 36px;
    margin-top: auto;
    color: var(--accent);
}

.kpi-spark svg {
    width: 100%;
    height: 36px;
}

/* ---------- 涨跌标记 ---------- */
.delta {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding: 3px 6px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.delta svg {
    width: 11px;
    height: 11px;
}

.delta-down svg {
    transform: rotate(180deg);
}

.delta-up {
    background: var(--good-bg);
    color: var(--good);
}

.delta-down {
    background: var(--bad-bg);
    color: var(--bad);
}

/* ---------- 图表面板 ---------- */
.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.chart {
    position: relative;
    width: 100%;
    height: 240px;
    margin-top: 12px;
}

.chart-canvas,
.chart svg {
    width: 100%;
    height: 100%;
}

.chart svg {
    overflow: visible;
}

/* SVG 图表样式（颜色随主题变量切换） */
.chart-tick {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-tick--y {
    text-anchor: end;
}

.chart-tick--x {
    text-anchor: middle;
}

.chart-grid {
    stroke: var(--grid);
    stroke-width: 1;
}

.chart-axis {
    stroke: var(--axis);
    stroke-width: 1;
}

.area-stop-top {
    stop-color: var(--accent);
    stop-opacity: 0.16;
}

.area-stop-bottom {
    stop-color: var(--accent);
    stop-opacity: 0;
}

.trend-area {
    fill: url(#trendArea);
}

.trend-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend-end-dot {
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 2;
}

.trend-end-label {
    fill: var(--ink);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    paint-order: stroke;
    stroke: var(--surface);
    stroke-width: 3px;
}

.trend-crosshair {
    stroke: var(--axis);
    stroke-width: 1;
    opacity: 0;
}

.trend-hover-dot {
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 2;
    opacity: 0;
}

.trend-crosshair.is-visible,
.trend-hover-dot.is-visible {
    opacity: 1;
}

.chart-hit {
    fill: transparent;
    cursor: crosshair;
}

.chart-tooltip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;
    display: grid;
    gap: 1px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-hover);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%);
    transition: opacity 0.12s ease;
}

.chart-tooltip.is-below {
    transform: translate(-50%, 0);
}

.chart-tooltip.is-visible {
    opacity: 1;
}

.chart-tooltip strong {
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chart-tooltip span {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

/* ---------- 渠道条形图 ---------- */
.bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0 18px;
    padding: 0;
    list-style: none;
}

.bar-item {
    position: relative;
    outline-offset: 4px;
}

.bar-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}

.bar-label {
    color: var(--ink-2);
    font-size: 13px;
}

.bar-stats {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.bar-pct {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.bar-count {
    color: var(--muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.bar-track {
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--surface-2);
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
    transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.15s ease;
}

.bar-item:hover .bar-fill,
.bar-item:focus-visible .bar-fill {
    filter: brightness(1.12);
}

.bar-item::after {
    content: attr(data-tip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 5;
    padding: 6px 9px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--bg);
    font-size: 11.5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.bar-item:hover::after,
.bar-item:focus-visible::after {
    opacity: 1;
    transform: none;
}

.channel-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
}

.channel-total strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---------- 数据表 ---------- */
.data-table {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.data-table summary {
    display: flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
}

.data-table summary::-webkit-details-marker {
    display: none;
}

.data-table summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.data-table[open] summary::before {
    transform: rotate(45deg);
}

.table-scroll {
    overflow-x: auto;
    margin-top: 10px;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
    text-align: left;
}

.data-table thead th {
    color: var(--muted);
    font-weight: 500;
}

.data-table tbody th {
    color: var(--ink-2);
    font-weight: 500;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
    border-bottom: 0;
}

/* ---------- 页脚 ---------- */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 12px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 16px 28px;
    color: var(--muted);
    font-size: 12px;
}

/* =========================================================
   响应式断点
   ========================================================= */

/* 平板：768–1199，侧栏固定为图标栏，可展开 */
@media (min-width: 768px) {
    .sidebar {
        z-index: 30;
        width: var(--sidebar-w);
        max-width: none;
        transform: none;
        visibility: visible;
        transition: width 0.22s ease;
    }

    .sidebar.is-collapsed {
        width: var(--sidebar-w-collapsed);
    }

    .sidebar-backdrop {
        display: none;
    }

    .content {
        margin-left: var(--sidebar-w);
        transition: margin-left 0.22s ease;
    }

    .sidebar.is-collapsed ~ .content {
        margin-left: var(--sidebar-w-collapsed);
    }

    .mobile-brand {
        display: none;
    }

    /* 折叠态：只保留图标 */
    .sidebar.is-collapsed .sidebar-head {
        flex-direction: column;
        gap: 10px;
        padding: 2px 0 18px;
    }

    .sidebar.is-collapsed .brand {
        flex: none;
        justify-content: center;
        width: 100%;
    }

    .sidebar.is-collapsed .brand-name {
        display: none;
    }

    .sidebar.is-collapsed .sidebar-toggle {
        width: 36px;
        height: 30px;
    }

    .sidebar.is-collapsed .sidebar-toggle .icon-chevron {
        transform: rotate(180deg);
    }

    .sidebar.is-collapsed .nav-label {
        display: none;
    }

    .sidebar.is-collapsed .nav-link {
        justify-content: center;
        gap: 0;
        padding: 12px 0;
    }

    /* 图标栏宽度较窄，焦点框内收避免被侧栏裁切 */
    .sidebar.is-collapsed .nav-link:focus-visible {
        outline-offset: -2px;
    }

    .sidebar.is-collapsed .nav-text,
    .sidebar.is-collapsed .status-text,
    .sidebar.is-collapsed .user-info {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .sidebar.is-collapsed .sidebar-status {
        justify-content: center;
        padding: 0 0 12px;
    }

    .sidebar.is-collapsed .user {
        justify-content: center;
        padding: 6px 0;
    }

    /* 平板布局 */
    .topbar-inner {
        padding: 20px 24px;
    }

    main {
        padding: 24px 24px 40px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .chart {
        height: 300px;
    }

    .footer {
        padding: 0 24px 32px;
    }
}

@media (min-width: 1000px) {
    .panel-grid {
        grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
    }
}

/* 桌面：≥1200，侧栏默认展开，四列指标卡 */
@media (min-width: 1200px) {
    .topbar-inner {
        padding: 22px 32px;
    }

    main {
        padding: 26px 32px 44px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .kpi-value {
        font-size: 26px;
    }

    .footer {
        padding: 0 32px 36px;
    }
}

@media (min-width: 1500px) {
    .kpi-value {
        font-size: 30px;
    }
}

/* ---------- 降低动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
