:root {
    color-scheme: dark;
    --background: #07101d;
    --background-soft: #0b1424;
    --panel: rgba(16, 26, 45, 0.9);
    --panel-strong: #111a2c;
    --panel-border: rgba(154, 176, 214, 0.14);
    --text: #edf4ff;
    --text-soft: #c4d0e5;
    --muted: #8e9db9;
    --abnormal: #ff5d68;
    --abnormal-soft: rgba(255, 93, 104, 0.12);
    --normal: #2bd99f;
    --normal-soft: rgba(43, 217, 159, 0.11);
    --insufficient: #f4c95d;
    --insufficient-soft: rgba(244, 201, 93, 0.11);
    --unavailable: #7d89a2;
    --unavailable-soft: rgba(125, 137, 162, 0.12);
    --info: #58a6ff;
    --info-soft: rgba(88, 166, 255, 0.1);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

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

html {
    min-width: 0;
    max-width: 100%;
    background: var(--background);
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 0;
    max-width: 100%;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 10% -20%, rgba(39, 117, 167, 0.22), transparent 38%),
        radial-gradient(circle at 95% 5%, rgba(51, 188, 144, 0.12), transparent 30%),
        linear-gradient(155deg, #07101d 0%, #091321 52%, #070e19 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

button,
canvas {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(95px);
    opacity: 0.16;
    pointer-events: none;
}

.ambient--one {
    top: 12%;
    left: -180px;
    background: #2d8fd6;
}

.ambient--two {
    right: -180px;
    bottom: 10%;
    background: #1c9d79;
}

.dashboard-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 28px clamp(16px, 3vw, 44px) 24px;
}

.page-header,
.section-heading,
.panel-heading,
.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 18px;
}

.page-header {
    margin-bottom: 32px;
}

.page-heading {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 16px;
}

.brand-mark {
    position: relative;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(94, 221, 180, 0.36);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(43, 217, 159, 0.2), rgba(36, 91, 141, 0.2));
    box-shadow: inset 0 0 28px rgba(43, 217, 159, 0.08), 0 12px 32px rgba(0, 0, 0, 0.2);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
    position: absolute;
    right: 10px;
    left: 10px;
    height: 5px;
    border-radius: 999px;
    content: "";
}

.brand-mark::before {
    bottom: 11px;
    background: var(--normal);
}

.brand-mark span {
    right: 17px;
    bottom: 21px;
    background: #58a6ff;
}

.brand-mark::after {
    right: 25px;
    bottom: 31px;
    background: var(--insufficient);
}

.eyebrow {
    margin: 0 0 4px;
    color: #77d7b9;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.18;
}

h1 {
    font-size: clamp(1.6rem, 3vw, 2.45rem);
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.12rem, 2vw, 1.42rem);
}

h3 {
    font-size: 1rem;
}

.page-subtitle {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.refresh-panel {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 420px;
    padding: 11px 15px;
    gap: 10px;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    background: rgba(10, 18, 32, 0.66);
    backdrop-filter: blur(14px);
}

.refresh-panel > div {
    display: grid;
    min-width: 0;
}

.refresh-panel strong,
.refresh-panel span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.refresh-panel strong {
    font-size: 0.78rem;
}

.refresh-panel span {
    color: var(--muted);
    font-size: 0.7rem;
}

.refresh-dot {
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--normal);
    box-shadow: 0 0 0 5px rgba(43, 217, 159, 0.11);
    animation: status-pulse 2s ease-in-out infinite;
}

.refresh-status--error {
    color: #ff9ca4;
}

.refresh-status--loading {
    color: #9ccaff;
}

.refresh-status--success {
    color: #a8f2d7;
}

@keyframes status-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.section-heading {
    margin-bottom: 16px;
}

.thresholds {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
    gap: 8px;
}

.thresholds span,
.panel-note {
    padding: 6px 10px;
    color: var(--text-soft);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    background: rgba(17, 27, 46, 0.7);
    font-size: 0.75rem;
}

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

.summary-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 122px;
    padding: 17px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(155deg, rgba(19, 30, 51, 0.94), rgba(12, 21, 37, 0.9));
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.13);
    transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.summary-card::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 64px;
    height: 64px;
    border-radius: 0 0 0 100%;
    background: var(--card-tone, rgba(125, 137, 162, 0.08));
    content: "";
}

.summary-card:hover {
    transform: translateY(-2px);
}

.summary-card--abnormal {
    --card-tone: var(--abnormal-soft);
    border-color: rgba(255, 93, 104, 0.38);
    background: linear-gradient(155deg, rgba(68, 24, 35, 0.8), rgba(22, 22, 38, 0.94));
}

.summary-card--normal {
    --card-tone: var(--normal-soft);
    border-color: rgba(43, 217, 159, 0.3);
}

.summary-card--insufficient {
    --card-tone: var(--insufficient-soft);
    border-color: rgba(244, 201, 93, 0.28);
}

.summary-card--unavailable {
    --card-tone: var(--unavailable-soft);
    border-color: rgba(125, 137, 162, 0.34);
}

.summary-card--info {
    --card-tone: var(--info-soft);
    border-color: rgba(88, 166, 255, 0.22);
}

.summary-card--neutral {
    --card-tone: rgba(125, 137, 162, 0.07);
}

.summary-card__label {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.summary-card strong {
    position: relative;
    z-index: 1;
    margin: auto 0 2px;
    color: var(--text);
    font-size: clamp(1.48rem, 2.5vw, 2rem);
    line-height: 1.15;
}

.summary-card--abnormal strong { color: #ff949c; }
.summary-card--normal strong { color: #78e9c2; }
.summary-card--insufficient strong { color: #ffe096; }
.summary-card--unavailable strong { color: #b2bbcd; }
.summary-card--info strong { color: #9ccaff; }

.summary-card strong.summary-card__date {
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
}

.summary-card [data-summary-detail] {
    color: var(--muted);
    font-size: 0.72rem;
}

.data-message,
.panel-empty,
.chart-empty,
.noscript-message {
    margin: 0;
    padding: 20px;
    color: var(--text-soft);
    text-align: center;
    border: 1px dashed rgba(143, 160, 191, 0.26);
    border-radius: var(--radius-md);
    background: rgba(11, 19, 33, 0.55);
}

.data-message {
    margin-bottom: 20px;
}

.visual-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    min-width: 0;
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    min-width: 0;
    padding: clamp(16px, 2vw, 22px);
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    background: linear-gradient(155deg, rgba(18, 29, 49, 0.94), rgba(12, 20, 35, 0.94));
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.panel-heading {
    margin-bottom: 14px;
}

.panel-heading .eyebrow {
    margin-bottom: 5px;
}

.visual-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.visual-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot--abnormal { background: var(--abnormal); }
.legend-dot--normal { background: var(--normal); }
.legend-dot--insufficient { background: var(--insufficient); }
.legend-dot--unavailable { background: var(--unavailable); }

.chart-frame {
    position: relative;
    min-width: 0;
}

.chart-frame--bar {
    height: 330px;
}

.chart-frame--doughnut {
    height: 370px;
}

.chart-empty {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(90%, 360px);
    transform: translate(-50%, -50%);
}

.details-panel {
    grid-column: 1 / -1;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 470px;
    padding-right: 4px;
    gap: 10px;
    overflow-y: auto;
    scrollbar-color: rgba(129, 151, 186, 0.35) transparent;
}

.detail-item {
    min-width: 0;
    padding: 14px 15px;
    border: 1px solid var(--panel-border);
    border-left-width: 3px;
    border-radius: var(--radius-md);
    background: rgba(8, 15, 27, 0.48);
}

.detail-item--abnormal {
    border-left-color: var(--abnormal);
    background: linear-gradient(120deg, var(--abnormal-soft), rgba(8, 15, 27, 0.48) 42%);
}

.detail-item--unavailable {
    border-left-color: var(--unavailable);
}

.detail-item--insufficient {
    border-left-color: var(--insufficient);
    background: linear-gradient(120deg, var(--insufficient-soft), rgba(8, 15, 27, 0.48) 42%);
}

.detail-item h3 {
    margin-bottom: 7px;
}

.detail-item p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.84rem;
}

.reason-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.reason-tag,
.status-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.reason-tag--abnormal,
.status-badge--abnormal {
    color: #ffd0d4;
    background: rgba(255, 93, 104, 0.16);
}

.reason-tag--insufficient,
.status-badge--insufficient {
    color: #ffe7a9;
    background: rgba(244, 201, 93, 0.16);
}

.reason-tag--unavailable,
.status-badge--unavailable {
    color: #d0d6e2;
    background: rgba(125, 137, 162, 0.18);
}

.status-badge--normal {
    color: #a9f2d8;
    background: rgba(43, 217, 159, 0.14);
}

.section-heading--channels {
    align-items: flex-end;
}

.section-heading--channels > p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: right;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    min-width: 0;
    gap: 12px;
}

.channel-card {
    position: relative;
    min-width: 0;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-top-width: 3px;
    border-radius: var(--radius-lg);
    background: linear-gradient(150deg, rgba(18, 29, 49, 0.92), rgba(10, 18, 31, 0.94));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
    transition: transform 180ms ease, border-color 180ms ease;
}

.channel-card:hover {
    transform: translateY(-2px);
}

.channel-card--abnormal { border-top-color: var(--abnormal); }
.channel-card--normal { border-top-color: var(--normal); }
.channel-card--insufficient { border-top-color: var(--insufficient); }
.channel-card--unavailable { border-top-color: var(--unavailable); }

.channel-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
}

.channel-card__header h3 {
    padding-top: 3px;
}

.channel-card__identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    gap: 6px;
    margin-top: 8px;
}

.channel-card__name {
    min-width: 0;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.channel-card__name--missing {
    color: var(--muted);
    font-weight: 500;
    font-style: italic;
}

.method-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 8px;
    border: 1px solid rgba(159, 181, 220, 0.22);
    border-radius: 999px;
    color: #d0d6e2;
    background: rgba(125, 137, 162, 0.16);
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.method-chip--wxpay {
    border-color: rgba(7, 193, 96, 0.38);
    color: #8ff0bd;
    background: rgba(7, 193, 96, 0.15);
}

.method-chip--alipay {
    border-color: rgba(22, 119, 255, 0.42);
    color: #9cc6ff;
    background: rgba(22, 119, 255, 0.16);
}

.channel-card__rate {
    margin: 18px 0 -3px;
    color: var(--text);
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 760;
    line-height: 1;
}

.channel-card--abnormal .channel-card__rate { color: #ff969e; }
.channel-card--normal .channel-card__rate { color: #78e9c2; }
.channel-card--insufficient .channel-card__rate { color: #ffe096; }
.channel-card--unavailable .channel-card__rate { color: #b2bbcd; }

.channel-card > span {
    color: var(--muted);
    font-size: 0.7rem;
}

.channel-card__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
    border: 1px solid rgba(151, 171, 204, 0.1);
    border-radius: 11px;
    background: rgba(5, 11, 21, 0.32);
}

.channel-metric {
    display: grid;
    min-width: 0;
    padding: 8px 6px;
    text-align: center;
}

.channel-metric + .channel-metric {
    border-left: 1px solid rgba(151, 171, 204, 0.1);
}

.channel-metric span {
    color: var(--muted);
    font-size: 0.63rem;
}

.channel-metric strong {
    margin-top: 2px;
    font-size: 0.86rem;
}

.channel-card__note {
    min-height: 2.55em;
    margin: 12px 0 0;
    color: var(--text-soft);
    font-size: 0.74rem;
}

.page-footer {
    flex-wrap: wrap;
    margin-top: 28px;
    padding-top: 17px;
    color: var(--muted);
    border-top: 1px solid rgba(143, 164, 198, 0.1);
    font-size: 0.72rem;
}

.noscript-message {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    color: #ffd9dc;
    border-color: rgba(255, 93, 104, 0.45);
    background: #28121a;
}

@media (max-width: 1050px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .chart-frame--doughnut {
        height: 340px;
    }
}

@media (max-width: 720px) {
    .dashboard-shell {
        padding-top: 18px;
    }

    .page-header,
    .section-heading,
    .panel-heading,
    .section-heading--channels {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-header {
        margin-bottom: 24px;
    }

    .refresh-panel {
        width: 100%;
        max-width: none;
        border-radius: var(--radius-md);
    }

    .thresholds {
        justify-content: flex-start;
    }

    .panel-note {
        white-space: normal;
    }

    .detail-list {
        grid-template-columns: minmax(0, 1fr);
        max-height: 520px;
    }

    .panel--wide {
        order: 1;
    }

    .details-panel {
        order: 2;
    }

    .panel--distribution {
        order: 3;
    }

    .section-heading--channels > p {
        text-align: left;
    }

    .chart-frame--bar {
        height: 300px;
    }
}

@media (max-width: 420px) {
    .dashboard-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    .brand-mark {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .page-heading {
        align-items: flex-start;
        gap: 11px;
    }

    .page-subtitle {
        font-size: 0.78rem;
    }

    .summary-grid {
        gap: 8px;
    }

    .summary-card {
        min-height: 112px;
        padding: 13px;
        border-radius: 15px;
    }

    .summary-card strong {
        font-size: 1.3rem;
    }

    .summary-card strong.summary-card__date {
        font-size: 0.82rem;
    }

    .summary-card__label,
    .summary-card [data-summary-detail] {
        font-size: 0.65rem;
    }

    .panel {
        padding: 14px;
        border-radius: 18px;
    }

    .chart-frame--bar {
        height: 280px;
    }

    .chart-frame--doughnut {
        height: 330px;
    }

    .visual-legend {
        gap: 6px 10px;
    }

    .channel-card__metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .refresh-dot {
        animation: none;
    }
}
