/* 数据中心（P4）：全页视图、筛选条、页签、KPI、表格、图表、实时卡、对账。深色主题，主色 #8B5CFF，红色只用于告警。 */

.ws-data { min-height: 0; overflow: auto; padding: 16px 20px 28px; }
.an-page { max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.an-head { display: flex; align-items: center; gap: 12px; }
.an-h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.an-title { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.an-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.an-panel { min-width: 0; }
.an-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-export-row { display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.an-small { font-size: 12px; }
.an-back { margin-left: -6px; }

/* 页签 */
.an-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.an-tabs::-webkit-scrollbar { display: none; }
.an-tab { position: relative; height: 40px; padding: 0 16px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; border-radius: 8px 8px 0 0; }
.an-tab:hover { color: var(--fg); background: var(--panel-2); }
.an-tab.active { color: #C7B3FF; }
.an-tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* 筛选条 */
.an-filters { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.an-filter-item { display: inline-flex; align-items: center; gap: 8px; }
.an-filter-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.an-filter-hint { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.an-filter-err { flex-basis: 100%; }
.an-room-sel { min-width: 168px; height: 34px; }
.an-custom { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.an-date { height: 34px; width: 140px; color-scheme: dark; }
.an-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); }
.an-seg-btn { height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.an-seg-btn:hover { color: var(--fg); }
.an-seg-btn.active { background: var(--accent-soft); color: #C7B3FF; box-shadow: inset 0 0 0 1px var(--accent-line); }

/* 卡片 */
.an-card { padding: 14px 16px 16px; min-width: 0; }
.an-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.an-card-title { margin: 0; font-size: 14px; font-weight: 700; }
.an-card-sub { font-size: 12px; color: var(--dim); }
.an-sec-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }

/* KPI */
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.an-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.an-kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.an-kpi-value { font-size: 24px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-kpi-sub { font-size: 12px; color: var(--dim); }

/* 表格 */
.an-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.an-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.an-table th.an-right, .an-table td.an-right { text-align: right; font-variant-numeric: tabular-nums; }
.an-table th.an-center, .an-table td.an-center { text-align: center; }
.an-table tbody tr:last-child td { border-bottom: 0; }
.an-table tr.is-click { cursor: pointer; }
.an-table tr.is-click:hover td, .an-table tr.is-click:focus-visible td { background: var(--panel-2); }
.an-table tr.is-click:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: -2px; }
.an-diamond { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.an-gem { font-size: 12px; }
.an-change { font-variant-numeric: tabular-nums; font-weight: 600; }
.an-change-up { color: var(--ok); }
.an-change-down { color: var(--warn); }
.an-change-none, .an-change-flat { color: var(--dim); }
.an-chips { display: inline-flex; gap: 6px; }
.an-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 4px; border-radius: 999px; background: #1F2632; font-size: 12px; max-width: 170px; }
.an-chip-rank { width: 16px; height: 16px; border-radius: 50%; background: var(--accent-soft); color: #B9A0FF; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.an-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-chip-val { color: var(--muted); flex: none; }

/* 图表 */
.an-chart-box { display: flex; flex-direction: column; gap: 8px; }
.an-chart { width: 100%; height: auto; display: block; overflow: visible; }
.an-axis-text { fill: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.an-axis-text.an-ink { fill: var(--muted); }
.an-band-text { fill: var(--fg); font-size: 11px; font-weight: 600; }
.an-mark { stroke: var(--panel); stroke-width: 1.5; }
.an-hit { fill: transparent; }
.an-bar:hover .an-hit { fill: rgba(255, 255, 255, .05); }
.an-bar:hover .an-mark { filter: brightness(1.25); }
.an-dot { opacity: 0; stroke: var(--panel); stroke-width: 2; }
.an-bar:hover .an-dot { opacity: 1; }
.an-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.an-legend li { display: inline-flex; align-items: center; gap: 6px; }
.an-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.an-swatch.is-band { opacity: .55; }
.an-swatch.is-hatch { background: repeating-linear-gradient(45deg, #566073 0 2px, #1B212C 2px 5px); }
.an-spark { width: 100%; height: 44px; display: block; }
.an-hbars { width: 100%; max-width: 420px; height: auto; display: block; }

/* 实时 */
.an-live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.an-live-card { display: flex; flex-direction: column; gap: 14px; }
.an-live-card.is-idle { opacity: .8; }
.an-live-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.an-live-name { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-live-idle { margin: 0; color: var(--dim); font-size: 14px; }
.an-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.an-metric { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.an-metric-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.an-metric-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.an-metric-sub { font-size: 12px; }
.an-live-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.an-banner { padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.an-banner-warn { background: var(--warn-soft); color: #F0C26B; border: 1px solid rgba(255, 176, 32, .3); }

/* 对账 */
.an-rec { display: flex; flex-direction: column; gap: 12px; }
.an-rec-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.an-rec-amount { width: 200px; text-align: right; }
.an-rec-note { flex: 1; min-width: 200px; }
.an-rec-line { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.an-rec-text { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.an-rec-text.is-diff { color: var(--fg); font-weight: 600; }
.an-gap-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.an-gap-list li { display: flex; align-items: center; gap: 10px; }

/* 状态占位 */
.an-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 16px; text-align: center; color: var(--muted); }
.an-state-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--dim); }
.an-state-text { margin: 0; font-size: 14px; font-weight: 600; color: var(--fg); }
.an-state-detail { margin: 0; font-size: 12px; color: var(--dim); max-width: 460px; }
.an-state-disabled .an-state-ic { background: var(--warn-soft); color: var(--warn); }
.an-state-error .an-state-ic { background: var(--danger-soft); color: var(--danger); }
.an-state-loading .an-state-ic .ic { animation: an-spin 1.2s linear infinite; }
@keyframes an-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .an-state-loading .an-state-ic .ic { animation: none; } }

@media (max-width: 1440px) { .an-live-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
@media (max-width: 1320px) { .ws-data { padding: 12px 14px 24px; } .an-kpi-value { font-size: 20px; } }

/* ---- 第二批：自适应图表 / 实时紧凑卡 / 主播 / 观众 / 玩法 ---- */
.an-filter-label { white-space: nowrap; }
.an-filter-item { flex: none; }
.an-chart { width: auto; max-width: none; height: auto; }
.an-chart-holder { min-width: 0; width: 100%; overflow: hidden; }
.an-hbars { width: auto; max-width: 100%; height: auto; }
.an-live-grid { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.an-live-idle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.an-live-idle-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 40px; color: var(--muted); }
.an-live-idle-row .an-live-name { color: var(--fg); font-size: 14px; }
.an-mute { white-space: nowrap; }

.an-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.an-member { display: flex; flex-direction: column; gap: 12px; }
.an-member-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.an-member-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-member-income { font-size: 26px; font-weight: 800; }
.an-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.an-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.an-stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.an-stat-value { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.an-chips-wrap { flex-wrap: wrap; }

.an-ratio-wrap { display: flex; flex-direction: column; gap: 10px; }
.an-ratio-nums { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; }
.an-ratio { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #2E3746; gap: 2px; }
.an-ratio-new { background: var(--accent); border-radius: 6px 0 0 6px; }
.an-ratio-old { background: #2E3746; }

.an-heat-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-heat-ramp { width: 120px; height: 10px; border-radius: 5px; }
.an-heat-empty { width: 14px; height: 10px; border-radius: 3px; border: 1px dashed #2E3746; margin-left: 12px; }
.an-cell { stroke: none; }
.an-cell.is-empty { stroke: #2E3746; }
.an-bar:hover .an-cell { stroke: #fff; stroke-width: 1; }
