/* 抖音直播记录站 - 清爽极简导播台设计系统 (Quiet Broadcast Studio) */
@layer tokens {
    :root {
        color-scheme: light;
        --hub-bg: #f6f7f9;
        --hub-surface: #ffffff;
        --hub-surface-soft: #f9fafb;
        --hub-border: #e5e7eb;
        --hub-border-strong: #d1d5db;
        --hub-text: #111827;
        --hub-text-soft: #374151;
        --hub-muted: #6b7280;
        --hub-primary: #18181b;
        --hub-primary-hover: #27272a;
        --hub-primary-soft: #f3f4f6;
        --hub-ring: color-mix(in srgb, var(--hub-primary) 16%, transparent);
        --hub-link: #2563eb;
        --hub-live: #e11d48;
        --hub-live-soft: #fff1f2;
        --hub-ok: #059669;
        --hub-ok-soft: #ecfdf5;
        --hub-amber: #b45309;
        --hub-amber-soft: #fffbeb;
        --hub-danger: #dc2626;
        --hub-danger-soft: #fef2f2;
        --hub-slate: #4b5563;
        --hub-slate-soft: #f3f4f6;
        --hub-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
        --hub-shadow-md: 0 2px 6px rgba(17, 24, 39, 0.04), 0 1px 2px rgba(17, 24, 39, 0.03);
        --hub-shadow-lg: 0 20px 44px -12px rgba(17, 24, 39, 0.18);
        --hub-radius: 10px;
        /* 统计看板语义别名 */
        --ink: var(--hub-text);
        --muted: var(--hub-muted);
        --line: var(--hub-border);
        --surface: var(--hub-surface);
        --page: var(--hub-bg);
        --amber: var(--hub-amber);
        --rose: var(--hub-live);
    }
}

html,
body {
    background-color: var(--hub-bg);
    color: var(--hub-text);
    font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
}

h1,
h2,
h3 {
    text-wrap: balance;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--hub-primary);
}

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--hub-primary);
    outline-offset: 2px;
}

.hub-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

[v-cloak] {
    display: none !important;
}

.hub-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: -0.02em;
}

/* 统一顶部导航栏 */
.hub-navbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hub-border);
}

.hub-navbar-inner {
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: 16px;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hub-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--hub-text);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    text-decoration: none;
    flex-shrink: 0;
}

.hub-brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(180deg, #20242e 0%, #0f1117 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 1px 2px rgba(15, 23, 42, 0.14);
}

.hub-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.hub-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--hub-muted);
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease;

    &:hover {
        color: var(--hub-text);
        background: var(--hub-slate-soft);
    }

    &.is-active {
        color: var(--hub-text);
        background: var(--hub-primary-soft);
        font-weight: 600;
    }
}

.hub-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hub-logout-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--hub-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;

    &:hover {
        color: var(--hub-danger);
        background: var(--hub-danger-soft);
    }
}

/* 页面主容器与面板 */
.hub-container {
    max-width: 1280px;
    margin-inline: auto;
    padding: 18px 16px 44px;
}

.hub-card {
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow-sm);
}

.hub-stat-card {
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow-sm);
    padding: 13px 16px;
    position: relative;
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;

    &.is-clickable {
        cursor: pointer;
        text-align: left;
        width: 100%;

        &:hover {
            border-color: var(--hub-border-strong);
            background: var(--hub-surface-soft);
        }
    }

    &.is-selected {
        border-color: var(--hub-primary);
        background: var(--hub-surface);
        box-shadow: inset 0 0 0 1px var(--hub-primary);
    }
}

/* 导播台水平数字条 */
.hub-data-strip {
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow-sm);
    overflow: hidden;
}

.hub-data-cell {
    padding: 12px 16px;
}

/* 统一按钮与行内操作 */
.hub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
    user-select: none;
    white-space: nowrap;

    &:disabled {
        opacity: 0.48;
        cursor: not-allowed;
    }
}

.hub-btn-primary {
    background: var(--hub-primary);
    color: #fff;

    &:hover:not(:disabled) {
        background: var(--hub-primary-hover);
    }
}

.hub-btn-secondary {
    background: var(--hub-surface);
    color: var(--hub-text-soft);
    border-color: var(--hub-border);

    &:hover:not(:disabled) {
        background: var(--hub-surface-soft);
        border-color: var(--hub-border-strong);
        color: var(--hub-text);
    }
}

.hub-btn-live {
    background: var(--hub-ok);
    color: #fff;

    &:hover:not(:disabled) {
        background: #047857;
    }
}

.hub-btn-danger {
    background: var(--hub-danger);
    color: #fff;

    &:hover:not(:disabled) {
        background: #b91c1c;
    }
}

.hub-row-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    color: var(--hub-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.14s ease, border-color 0.14s ease;
    white-space: nowrap;

    &:hover:not(:disabled) {
        background: var(--hub-surface-soft);
        border-color: var(--hub-border-strong);
    }
}

.hub-row-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--hub-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease;
    white-space: nowrap;

    &:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

    &:hover:not(:disabled) {
        background: var(--hub-slate-soft);
        color: var(--hub-text);
    }

    &.is-live:hover:not(:disabled) {
        background: var(--hub-ok-soft);
        color: var(--hub-ok);
    }

    &.is-warn:hover:not(:disabled) {
        background: var(--hub-amber-soft);
        color: var(--hub-amber);
    }

    &.is-danger:hover:not(:disabled) {
        background: var(--hub-danger-soft);
        color: var(--hub-danger);
    }
}

/* 状态徽章：克制信号色 */
.hub-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2.5px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;

    &.is-live {
        background: var(--hub-live-soft);
        color: var(--hub-live);
    }

    &.is-waiting {
        background: var(--hub-amber-soft);
        color: var(--hub-amber);
    }

    &.is-stopped {
        background: var(--hub-slate-soft);
        color: var(--hub-muted);
    }

    &.is-error {
        background: var(--hub-danger-soft);
        color: var(--hub-danger);
    }
}

.hub-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.hub-badge.is-live .hub-badge-dot {
    @media (prefers-reduced-motion: no-preference) {
        animation: hubPulse 1.8s ease-in-out infinite;
    }
}

@keyframes hubPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* 顶部状态药丸（保留 .status-pill 以兼容现有 E2E 断言） */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 7px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    color: var(--hub-muted);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.14s ease, background-color 0.14s ease;

    &:hover {
        border-color: var(--hub-border-strong);
        background: var(--hub-surface-soft);
    }

    & strong {
        color: var(--hub-text);
        font-weight: 600;
    }
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #9ca3af;
    flex-shrink: 0;
}

.status-pill.is-ready .status-dot {
    background: var(--hub-ok);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}

.status-pill.is-warn .status-dot {
    background: var(--hub-amber);
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

.status-pill.is-danger .status-dot {
    background: var(--hub-danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

/* 搜索框与勾选标签的父级状态响应 */
.hub-search-form > svg {
    transition: color 0.14s ease;
    pointer-events: none;
}

.hub-search-form:has(input:focus-visible) > svg {
    color: var(--hub-text);
}

label:has(> input[type="checkbox"]:checked) {
    color: var(--hub-text);
}

/* 级联/顶层 Toast 通知栈 (支持 popover="manual" 与静态降级) */
.hub-toast-container {
    position: fixed;
    inset: 66px 16px auto auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    width: auto;
    max-width: min(360px, calc(100vw - 32px));
    overflow: visible;
    z-index: 9999;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.hub-toast-container:not([popover]),
.hub-toast-container[popover]:where(:popover-open, .\:popover-open) {
    display: flex;
}

.hub-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    color: var(--hub-text);
    box-shadow: var(--hub-shadow-lg);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    animation: hubToastIn 0.16s ease-out;

    &.is-success {
        border-color: #a7f3d0;
        background: #f0fdf4;
        color: #065f46;
    }

    &.is-error {
        border-color: #fecaca;
        background: #fef2f2;
        color: #991b1b;
    }

    &.is-warning {
        border-color: #fde68a;
        background: #fffbeb;
        color: #92400e;
    }

    &.is-info {
        border-color: var(--hub-border);
        background: #ffffff;
        color: var(--hub-text);
    }

    @media (prefers-reduced-motion: reduce) {
        animation: none;
    }
}

.hub-toast-badge {
    font-weight: 800;
    flex-shrink: 0;
}

.hub-toast-body {
    flex: 1;
    word-break: break-word;
}

.hub-toast-close {
    margin-inline-start: auto;
    background: transparent;
    border: 0;
    color: currentColor;
    opacity: 0.6;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;

    &:hover {
        opacity: 1;
    }
}

@keyframes hubToastIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 原生顶层 <dialog> 模态框系统 (不设置无条件 display 以免覆盖关闭态) */
dialog:where(.hub-dialog, .hub-modal) {
    opacity: 0;
    margin: auto;
    padding: 0;
    border: 1px solid var(--hub-border);
    border-radius: 12px;
    background: var(--hub-surface);
    color: var(--hub-text);
    box-shadow: var(--hub-shadow-lg);
    width: min(var(--hub-modal-w, 448px), calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: min(88vh, 88dvh);
    overflow: auto;
    transition-property: opacity, transform, display, overlay;
    transition-duration: 0.18s;
    transition-timing-function: ease-out;
    transition-behavior: allow-discrete;

    @media (prefers-reduced-motion: no-preference) {
        transform: translateY(-8px) scale(0.98);
    }

    @media (prefers-reduced-motion: reduce) {
        transition-duration: 0.08s;
    }
}

dialog.hub-dialog {
    --hub-modal-w: 420px;
}

dialog.hub-modal-md {
    --hub-modal-w: 448px;
}

dialog.hub-modal-lg {
    --hub-modal-w: 672px;
}

dialog.hub-modal-xl {
    --hub-modal-w: 720px;
}

dialog.hub-modal-2xl {
    --hub-modal-w: 960px;
}

dialog:where(.hub-dialog, .hub-modal):modal {
    overscroll-behavior: contain;
}

dialog:where(.hub-dialog, .hub-modal)::backdrop {
    background-color: rgb(17 24 39 / 0);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    overflow: hidden;
    overscroll-behavior: contain;
    transition-property: background-color, display, overlay;
    transition-duration: 0.18s;
    transition-timing-function: ease-out;
    transition-behavior: allow-discrete;

    @media (prefers-reduced-motion: reduce) {
        transition-duration: 0.08s;
    }
}

dialog:where(.hub-dialog, .hub-modal)[open]:where(:not([data-closing])) {
    opacity: 1;

    @starting-style {
        opacity: 0;
    }

    @media (prefers-reduced-motion: no-preference) {
        transform: translateY(0) scale(1);

        @starting-style {
            transform: translateY(-8px) scale(0.98);
        }
    }
}

dialog:where(.hub-dialog, .hub-modal)[open]:where(:not([data-closing]))::backdrop {
    background-color: rgb(17 24 39 / 0.45);

    @starting-style {
        background-color: rgb(17 24 39 / 0);
    }
}

dialog.hub-modal > :is(.modal-content, .user-modal-content) {
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.hub-dialog-head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--hub-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hub-dialog-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--hub-text);
    margin: 0;

    &.is-danger {
        color: var(--hub-danger);
    }
}

.hub-dialog-body {
    padding: 16px 18px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--hub-text-soft);
}

.hub-dialog-warn {
    margin: 0;
}

.hub-hard-delete-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    margin: 10px 0;
    background: var(--hub-danger-soft);
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.hub-hard-delete-code {
    font-weight: 700;
    color: #991b1b;
    word-break: break-all;
}

.hub-hard-delete-fill-btn {
    padding: 4px 10px;
    font-size: 12px;
    flex-shrink: 0;
}

.hub-dialog-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--hub-border-strong);
    border-radius: 8px;
    font-size: 14px;
    color: var(--hub-text);
    background: var(--hub-surface);

    &:focus {
        outline: none;
        border-color: var(--hub-danger);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--hub-danger) 18%, transparent);
    }
}

.hub-dialog-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 共用图标与表情样式 */
.hub-badge-icon {
    height: 18px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.hub-badge-icon-sm {
    height: 16px;
}

.hub-badge-icon-lg {
    height: 20px;
}

.hub-badge-icon-lvl {
    width: 24px;
    height: 24px;
}

.hub-badge-gap-left {
    margin-inline-start: 4px;
}

.hub-badge-gap-left-lg {
    margin-inline-start: 8px;
}

.hub-badge-gap-right {
    margin-inline-end: 4px;
}

.danmu-emoji {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0 1px;
    vertical-align: -0.22em;
    object-fit: contain;
}

.danmu-emoji-sticker {
    display: inline-block;
    height: 42px;
    max-width: 96px;
    margin: 2px;
    vertical-align: middle;
    object-fit: contain;
}

/* ==================== 页面专属样式收口 ==================== */

/* 首页与归档页表格 */
.desktop-table {
    width: 100%;
    table-layout: fixed;
}

.desktop-table th {
    padding: 12px 16px;
    background: var(--hub-surface-soft);
    border-bottom: 1px solid var(--hub-border);
    color: var(--hub-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.desktop-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.desktop-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f1f5f9;
}

.table-row {
    transition: background-color 0.14s ease;

    &:hover {
        background-color: #f8fafc;
    }
}

.text-clip {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-note {
    display: inline-flex;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;

    &.is-warning {
        background: var(--hub-amber-soft);
        border: 1px solid #fde68a;
        color: #92400e;
    }

    &.is-danger {
        background: var(--hub-danger-soft);
        border: 1px solid #fecaca;
        color: #991b1b;
    }
}

.status-note-text {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 房间实时弹幕与榜单区域 */
.messages-container,
.contributor-container {
    height: 430px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

@media (min-width: 768px) {
    .messages-container,
    .contributor-container {
        height: 520px;
    }
}

.message {
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 8px;
    transition: background-color 0.14s ease;
    font-size: 13.5px;
    line-height: 1.5;
    contain: content;
}

.chat-message {
    background: #f9fafb;
    border-inline-start: 2px solid #d1d5db;
}

.gift-message {
    background: #fff1f2;
    border-inline-start: 2px solid #e11d48;
}

.gift-user-message {
    background: #fffbeb;
    border-inline-start: 2px solid #d97706;
}

.user-highlight {
    font-weight: 600;
    color: var(--hub-text);
    cursor: pointer;

    &:hover {
        color: var(--hub-link);
        text-decoration: underline;
    }
}

.user-level-icon {
    height: 18px;
    vertical-align: middle;
    margin-inline-end: 4px;
    display: inline-block;
}

.fans-club-icon {
    height: 18px;
    vertical-align: middle;
    margin-inline-end: 3px;
    display: inline-block;
}

.tab-button {
    position: relative;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    border-bottom: 2px solid transparent;

    &.active {
        color: var(--hub-text);
        border-bottom-color: var(--hub-text);
        background: var(--hub-surface);
    }
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border-radius: 999px;
    margin-inline-start: 5px;
    background: #e5e7eb;
    color: #4b5563;
}

.tab-button.active .tab-badge {
    background: var(--hub-primary);
    color: #ffffff;
}

.rank-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.rank-1 { background: #18181b; color: #fff; }
.rank-2 { background: #4b5563; color: #fff; }
.rank-3 { background: #9ca3af; color: #fff; }
.rank-other { background: #f3f4f6; color: #6b7280; }

/* 用户消息弹窗与场次弹窗内部 */
.user-header {
    background: var(--hub-surface-soft);
    border-bottom: 1px solid var(--hub-border);
    padding: 20px 22px;
    color: var(--hub-text);
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    border: 1px solid var(--hub-border);
    background: var(--hub-primary-soft);
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-fallback {
    background: var(--hub-primary);
    color: #ffffff;
}

.user-context-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-block-start: 6px;
}

.user-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-block: 2px;
    padding-inline: 8px;
    border-radius: 999px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    color: var(--hub-text-soft);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.user-scope-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-block: 10px;
    padding-inline: 22px;
    border-block-end: 1px solid var(--hub-border);
    background: var(--hub-surface);
}

.user-scope-seg {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border-radius: 9px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
}

.user-scope-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-block-size: 30px;
    padding-block: 4px;
    padding-inline: 10px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--hub-muted);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
    white-space: nowrap;

    &:hover:not([aria-pressed="true"], :disabled) {
        color: var(--hub-text);
    }

    &[aria-pressed="true"] {
        background: var(--hub-surface);
        border-color: var(--hub-border-strong);
        color: var(--hub-text);
        box-shadow: var(--hub-shadow-sm);
    }

    &.is-live[aria-pressed="true"] {
        background: var(--hub-live-soft);
        border-color: color-mix(in srgb, var(--hub-live) 38%, var(--hub-border));
        color: var(--hub-live);
    }
}

.user-scope-live-dot {
    inline-size: 7px;
    block-size: 7px;
    border-radius: 999px;
    background: var(--hub-live);
    flex-shrink: 0;
}

.user-scope-count {
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.user-scope-caption {
    font-size: 12px;
    color: var(--hub-muted);
    font-variant-numeric: tabular-nums;
}

.user-tab-button {
    position: relative;
    padding-block: 10px;
    padding-inline: 16px;
    font-size: 13.5px;
    font-weight: 600;
    border-block-end: 2px solid transparent;
    color: var(--hub-muted);
    background: var(--hub-surface);

    &:is(.active, [aria-pressed="true"]) {
        color: var(--hub-text);
    }

    &:is(.active, [aria-pressed="true"])::after {
        content: '';
        position: absolute;
        inset: auto 0 -2px;
        border-block-end: 2px solid var(--hub-text);
    }
}

.user-stat-chips {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-block-start: 14px;
}

@media (max-width: 480px) {
    .user-stat-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .user-scope-bar {
        padding-inline: 16px;
    }
}

.user-stat-chip {
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: 8px;
    padding: 8px 10px 10px;
    text-align: center;
    color: var(--hub-text);
    position: relative;
    overflow: hidden;

    &::after {
        content: '';
        position: absolute;
        inset-inline: 12px;
        inset-block-end: 0;
        block-size: 2px;
        background: var(--chip-accent, transparent);
        border-radius: 1px;
    }

    &[data-chip="messages"] { --chip-accent: #18181b; }
    &[data-chip="chat"] { --chip-accent: #6b7280; }
    &[data-chip="gift"] { --chip-accent: #db2777; }
    &[data-chip="diamond"] { --chip-accent: #d97706; }
    &[data-chip="like"] { --chip-accent: #e11d48; }
}

.user-stat-chip[data-chip="diamond"] .user-stat-chip-value {
    color: var(--hub-amber);
}

.user-stat-chip[data-chip="like"] .user-stat-chip-value {
    color: var(--hub-live);
}

.user-stat-chip-label {
    font-size: 11px;
    color: var(--hub-muted);
    margin-block-end: 2px;
}

.user-stat-chip-value {
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-block-start: 2px;
}

.user-stat-chip-sub {
    font-size: 11px;
    color: var(--hub-muted);
    margin-block-start: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.user-session-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-block: 6px;
    padding-inline: 10px;
    border-radius: 8px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
    color: var(--hub-text-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;

    &:not(:first-child) {
        margin-block-start: 10px;
    }

    &.is-live {
        background: var(--hub-live-soft);
        border-color: color-mix(in srgb, var(--hub-live) 32%, var(--hub-border));
        color: var(--hub-live);
    }
}

.user-session-divider-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
}

.user-session-divider-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--hub-muted);
    font-variant-numeric: tabular-nums;
}

.user-session-divider.is-live .user-session-divider-meta {
    color: color-mix(in srgb, var(--hub-live) 82%, var(--hub-text));
}

.user-session-divider-room {
    padding-block: 1px;
    padding-inline: 6px;
    border-radius: 999px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    color: var(--hub-text-soft);
    font-size: 11px;
    font-weight: 500;
}

@media (forced-colors: active) {
    .user-scope-btn[aria-pressed="true"] {
        border-color: Highlight;
        background: Highlight;
        color: HighlightText;
    }

    .user-session-divider.is-live {
        border-color: Highlight;
    }

    .user-scope-live-dot {
        background: CanvasText;
    }
}

.user-messages-body {
    min-height: 260px;
    display: flex;
    flex-direction: column;
}

.user-messages-list {
    flex: 1;
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.user-messages-placeholder {
    flex: 1;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-message-card {
    padding: 12px 14px;
    border-radius: 10px;
}

.user-chat-card {
    background: #f8fafc;
    border-inline-start: 3px solid #3b82f6;
}

.user-gift-card {
    background: #fff7ed;
    border-inline-start: 3px solid #ea580c;
}

/* 数据统计看板 */
.page-shell {
    max-width: 1280px;
}

.dashboard-panel,
.filter-panel,
.table-panel,
.empty-panel {
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow-sm);
}

.metric-card {
    min-height: 108px;
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow-sm);
}

.metric-value {
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.metric-unit {
    white-space: nowrap;
}

.trend-chart-frame {
    height: 200px;
    background: var(--hub-surface);
}

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

.dashboard-table {
    max-height: 460px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.metric-chip {
    border: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
    border-radius: 8px;
}

.chart-tab {
    min-width: 64px;

    &.is-active {
        background-color: var(--tab-bg);
        color: var(--tab-fg);
        border-color: var(--tab-border);
    }
}

.table-panel-header {
    background: var(--hub-surface);
}

.empty-panel {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.soft-button {
    border-radius: 7px;
}

.tab-btn {
    padding: 10px 0;
    color: var(--hub-muted);
    border-bottom: 2px solid transparent;

    &.active {
        color: var(--hub-text);
        border-bottom-color: var(--hub-text);
    }
}

.clickable-user {
    cursor: pointer;

    &:hover {
        text-decoration: underline;
    }
}

/* ==================== 多 Cookie 池与轮询配置面板 ==================== */
.cookie-pool-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cookie-pool-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 9px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
}

.cookie-pool-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    color: var(--hub-text-soft);
}

.cookie-pool-summary-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.cookie-pool-card {
    border: 1px solid var(--hub-border);
    border-radius: 9px;
    background: var(--hub-surface);
    padding: 14px;
}

.cookie-pool-heading {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--hub-text);
}

.cookie-strategy-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}

.cookie-strategy-legend {
    font-size: 13px;
    font-weight: 700;
    color: var(--hub-text);
    margin-block-end: 8px;
    padding: 0;
}

.cookie-strategy-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.cookie-strategy-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid var(--hub-border);
    background: var(--hub-surface);
    cursor: pointer;
    transition: border-color 0.14s ease, background-color 0.14s ease;

    &:hover {
        border-color: var(--hub-border-strong);
        background: var(--hub-surface-soft);
    }

    &:has(input[type="radio"]:checked) {
        border-color: var(--hub-primary);
        background: var(--hub-primary-soft);
    }

    & input[type="radio"] {
        margin-block-start: 2px;
        flex-shrink: 0;
    }
}

.cookie-strategy-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    font-size: 12.5px;
    line-height: 1.35;
}

.cookie-strategy-name {
    font-weight: 600;
    color: var(--hub-text);
}

.cookie-strategy-desc {
    font-size: 11.5px;
    color: var(--hub-muted);
}

.cookie-settings-row {
    margin-block-start: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cookie-settings-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--hub-text-soft);
}

.cookie-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.cookie-cooldown-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cookie-cooldown-input {
    width: 84px;
    padding: 5px 8px;
    border: 1px solid var(--hub-border-strong);
    border-radius: 6px;
    font-size: 13px;
    color: var(--hub-text);
    background: var(--hub-surface);
}

.cookie-entry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cookie-entry-item {
    border: 1px solid var(--hub-border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--hub-surface);
    display: flex;
    flex-direction: column;
    gap: 6px;

    &.is-disabled {
        background: var(--hub-surface-soft);
        opacity: 0.78;
    }
}

.cookie-entry-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cookie-entry-title-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.cookie-entry-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--hub-text);
}

.cookie-entry-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.cookie-entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    font-size: 12px;
    color: var(--hub-muted);
}

.cookie-entry-error {
    font-size: 12px;
    color: var(--hub-danger);
    word-break: break-word;
}

.cookie-room-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
}

.cookie-room-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--hub-primary-soft);
    color: var(--hub-text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.hub-badge.is-ok {
    background: var(--hub-ok-soft);
    color: var(--hub-ok);
}

.cookie-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-block-end: 10px;
}

.cookie-form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--hub-text-soft);
}

.cookie-form-input,
.cookie-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--hub-border-strong);
    border-radius: 7px;
    font-size: 13px;
    color: var(--hub-text);
    background: var(--hub-surface);
    box-sizing: border-box;
}

.cookie-form-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    resize: vertical;
}

.cookie-form-input[aria-invalid="true"],
.cookie-form-textarea[aria-invalid="true"] {
    border-color: var(--hub-danger);
}

.cookie-form-hint {
    font-size: 12px;
    color: var(--hub-muted);
}

.cookie-form-error {
    font-size: 12px;
    color: var(--hub-danger);
    font-weight: 500;
}

/* 原生 <details> 高级选项折叠面板（progressive enhancement 展开动画） */
.hub-disclosure {
    border: 1px solid var(--hub-border);
    border-radius: 8px;
    background: var(--hub-surface-soft);
    margin-block-end: 10px;
}

.hub-disclosure > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--hub-text-soft);
    cursor: pointer;
    user-select: none;

    &::-webkit-details-marker {
        display: none;
    }

    &::before {
        content: "";
        display: inline-block;
        inline-size: 0.55em;
        block-size: 0.55em;
        flex-shrink: 0;
        border-inline-end: 1.75px solid currentColor;
        border-block-end: 1.75px solid currentColor;
        rotate: -45deg;
        transform-origin: center;
    }

    @media (prefers-reduced-motion: no-preference) {
        &::before {
            transition: rotate 0.18s ease;
        }
    }
}

.hub-disclosure[open] > summary::before {
    rotate: 45deg;
}

.hub-disclosure::details-content {
    interpolate-size: allow-keywords;
    overflow: clip;
    contain: layout;
}

.hub-disclosure:not([open])::details-content {
    block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .hub-disclosure::details-content {
        transition: block-size, content-visibility, display;
        transition-duration: 0.22s;
        transition-timing-function: ease-in-out;
        transition-behavior: allow-discrete;
    }
}

.hub-disclosure-body {
    padding: 4px 10px 10px;
    border-top: 1px solid var(--hub-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cookie-form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

@media (max-width: 768px) {
    .cookie-strategy-grid {
        grid-template-columns: 1fr;
    }
    .hub-navbar-inner {
        flex-wrap: wrap;
        padding: 8px 12px;
    }
    .hub-nav-links {
        order: 3;
        width: 100%;
        padding-top: 6px;
        border-top: 1px solid var(--hub-border);
    }
    .hub-nav-link {
        flex: 1;
        justify-content: center;
        padding: 6px 8px;
        font-size: 13px;
    }
    .status-note-text {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .trend-chart-frame {
        height: 170px;
    }
    .dashboard-table {
        max-height: 420px;
    }
}
