/* 统计门户（index 模块）样式 */
/* 覆盖 frontend.css 为默认顶栏预留的 padding-top:60px，header 须顶格 */
html,
body.stat-portal-body {
    margin: 0;
    padding: 0;
}
body.stat-portal-body {
    min-height: 100vh;
    overflow-x: hidden;
    max-width: none;
    width: 100%;
    padding-top: 0 !important;
    background: var(--sp-page-bg, #f4f6f8);
}
.stat-portal-muted { color: #64748b; font-size: 14px; }
.stat-portal-login {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: var(--sp-login-bg, linear-gradient(145deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%));
}
.stat-portal-login-card {
    width: 100%; max-width: 420px; background: var(--sp-surface); border-radius: 16px; padding: 32px 28px;
    box-shadow: 0 12px 40px var(--sp-shadow, rgba(15, 23, 42, 0.08)); border: 1px solid var(--sp-border);
}
.stat-portal-login-card h1 { margin: 0 0 8px; font-size: 24px; }
.stat-portal-shell { min-height: 100vh; margin: 0; padding: 0; }
.stat-portal-header {
    display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px;
    background: var(--sp-surface); border-bottom: 1px solid var(--sp-border); position: sticky; top: 0; z-index: 100;
    width: 100%; max-width: 100%; box-sizing: border-box; margin: 0;
}
.stat-portal-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; }
.stat-portal-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
}
.stat-portal-nav { display: flex; gap: 8px; flex: 1; }
.stat-portal-nav a {
    padding: 8px 14px; border-radius: 8px; color: #64748b; text-decoration: none; font-size: 14px;
}
.stat-portal-nav a.active { background: var(--sp-accent-bg); color: #2563eb; font-weight: 600; }
.stat-portal-user { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.stat-portal-user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-portal-lang { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.stat-portal-lang-dropdown { display: inline-block; }
.stat-portal-lang-btn {
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 6px;
    border-color: var(--sp-border, #e2e8f0);
    background: transparent;
    color: var(--sp-muted, #64748b);
    min-width: 48px;
}
.stat-portal-lang-btn:hover,
.stat-portal-lang-btn:focus {
    color: var(--sp-accent, #2563eb);
    border-color: var(--sp-accent, #2563eb);
    background: var(--sp-accent-bg, #eff6ff);
}
.stat-portal-lang-btn .caret { margin-left: 2px; }
.stat-portal-lang-menu {
    min-width: 148px;
    margin-top: 6px;
    padding: 4px 0;
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.stat-portal-lang-menu > li > a {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--sp-text, #0f172a);
}
.stat-portal-lang-menu > li > a:hover,
.stat-portal-lang-menu > li > a:focus {
    background: var(--sp-accent-bg, #eff6ff);
    color: var(--sp-accent, #2563eb);
}
.stat-portal-lang-menu > li.active > a,
.stat-portal-lang-menu > li.active > a:hover {
    background: var(--sp-accent-bg, #eff6ff);
    color: var(--sp-accent, #2563eb);
    font-weight: 600;
}
.stat-portal-view-toggle .btn { padding: 6px 10px; }
.stat-portal-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stat-portal-card-head h3 { margin: 0; flex: 1; min-width: 0; word-break: break-word; }
.stat-sparkline { display: block; opacity: 0.9; }
.stat-delta-up { color: #059669 !important; }
.stat-delta-down { color: #dc2626 !important; }
.stat-portal-trace-tabs { margin-bottom: 0; border-bottom: 1px solid var(--sp-border); }
.stat-portal-trace-tabs > li > a { border-radius: 8px 8px 0 0; }
.stat-portal-main { max-width: 1440px; margin: 0 auto; padding: 20px; }
.stat-portal-toolbar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 12px; margin-bottom: 16px;
}
.stat-portal-toolbar-stacked,
.stat-portal-toolbar-responsive {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
}
.stat-portal-toolbar-stacked .stat-portal-toolbar-row,
.stat-portal-toolbar-responsive .stat-portal-toolbar-row {
    width: 100%;
}
.stat-portal-toolbar-stacked .stat-portal-toolbar-row-actions,
.stat-portal-toolbar-stacked .stat-portal-toolbar-row-filters,
.stat-portal-toolbar-responsive .stat-portal-toolbar-row-actions,
.stat-portal-toolbar-responsive .stat-portal-toolbar-row-filters {
    padding: 10px 12px;
    background: var(--sp-surface, #fff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 10px;
}
@media (min-width: 992px) {
    .stat-portal-toolbar-responsive .stat-portal-toolbar-row-actions,
    .stat-portal-toolbar-responsive .stat-portal-toolbar-row-filters {
        width: auto;
        flex: 1 1 calc(50% - 6px);
    }
    .stat-portal-toolbar-responsive {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .stat-portal-toolbar-responsive .stat-portal-toolbar-row-head {
        flex: 1 1 100%;
    }
}
.stat-portal-toolbar-row {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.stat-portal-toolbar-row-head {
    justify-content: space-between;
}
.stat-portal-toolbar-row-filters .stat-portal-search {
    flex: 1 1 200px; min-width: 160px; max-width: 360px;
}
.stat-portal-field-label {
    margin: 0; font-size: 13px; color: var(--sp-muted, #64748b); white-space: nowrap;
}
.stat-portal-field-date { width: auto; min-width: 150px; max-width: 180px; }
.stat-portal-field-select { width: auto; min-width: 120px; max-width: 180px; }
.stat-portal-channel-switch {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.stat-portal-toolbar h2 { margin: 0; font-size: 20px; }
.stat-portal-toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stat-portal-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.stat-portal-metric {
    background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px; padding: 14px 16px;
}
.stat-portal-metric-label { font-size: 13px; color: #64748b; }
.stat-portal-metric-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-portal-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
@media (min-width: 1200px) {
    .stat-portal-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    .stat-portal-main { padding: 24px 28px; }
    .stat-portal-user-name { max-width: 200px; }
}
.stat-portal-home-projects {
    display: grid; grid-template-columns: 1fr; gap: 28px; margin-bottom: 8px;
}
@media (min-width: 1100px) {
    .stat-portal-home-projects {
        grid-template-columns: 1fr 1fr; align-items: start;
    }
}
.stat-portal-home-channel-section {
    margin-top: 0;
    background: var(--sp-surface, #fff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 14px;
    padding: 18px 20px 20px;
}
.stat-portal-home-channel-section .stat-portal-section-title {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.stat-portal-section-title .stat-portal-project-count { font-size: 14px; font-weight: 400; }
.stat-portal-card-enter { margin-top: 12px; }
.stat-portal-trend-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center;
}
.stat-portal-channel-select { min-width: 140px; max-width: 200px; }
.stat-portal-project-select { min-width: 180px; max-width: 320px; flex: 1 1 200px; }
.stat-portal-project-switcher {
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(420px, 100%);
    width: auto;
    font-weight: 600;
    font-size: 15px;
    height: 36px;
}
.stat-portal-compare-select {
    min-height: 160px;
    max-width: 520px;
}
.stat-portal-help-inline { font-size: 13px; margin: 6px 0 0; }
.stat-portal-compare-picks { margin-bottom: 16px; }
.stat-portal-card {
    background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 14px; padding: 18px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.stat-portal-card h3 { margin: 0 0 12px; font-size: 16px; }
.stat-portal-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 12px; color: #64748b; }
.stat-portal-card-metrics strong { display: block; font-size: 18px; color: #0f172a; margin-top: 2px; }
.stat-portal-empty { text-align: center; padding: 48px 16px; color: #64748b; }
.stat-portal-empty.hide { display: none; }
.stat-portal-workbench { display: flex; gap: 16px; padding: 20px; max-width: none; margin: 0; width: 100%; box-sizing: border-box; }
.stat-portal-side {
    width: 200px; flex-shrink: 0; background: var(--sp-surface); border: 1px solid var(--sp-border);
    border-radius: 12px; padding: 8px;
}
.stat-portal-side-link {
    display: block; padding: 10px 12px; border-radius: 8px; color: #64748b;
    text-decoration: none; margin-bottom: 2px; font-size: 14px;
}
.stat-portal-side-link.active { background: var(--sp-accent-bg); color: #2563eb; font-weight: 600; }
.stat-portal-panel { flex: 1; min-width: 0; background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px; padding: 16px; }
.stat-portal-trend-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stat-portal-trend-toolbar .form-control { width: auto; min-width: 140px; }
.stat-portal-back { color: #64748b; text-decoration: none; font-size: 14px; }
.stat-portal-project-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.stat-portal-project-title h2 { margin: 0; font-size: 18px; }
.stat-portal-btn-loading.is-loading { pointer-events: none; opacity: 0.75; }
.stat-portal-table-wrap { overflow-x: auto; margin-top: 12px; }
.stat-portal-logs-pager-slot-top { margin-top: 8px; margin-bottom: 4px; }
.stat-portal-logs-pager-slot-bottom { margin-top: 4px; }
.stat-portal-logs-pager-slot .stat-portal-logs-pager { margin-top: 0; }
.stat-portal-log-table { font-size: 13px; }
.stat-portal-log-table .sp-log-row-bot { background: rgba(245, 158, 11, 0.08); }
.stat-portal-log-table .sp-log-row-bot:hover { background: rgba(245, 158, 11, 0.14); }
.stat-portal-log-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}
.stat-portal-log-badge-human {
    color: #0f766e;
    background: rgba(20, 184, 166, 0.12);
    border: 1px solid rgba(20, 184, 166, 0.25);
}
.stat-portal-log-badge-bot {
    color: #b45309;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.stat-portal-cell-ua {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: none;
}
.stat-portal-cell-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: none;
}
.stat-portal-table-wrap.is-loading { opacity: 0.55; pointer-events: none; transition: opacity .2s; }
.stat-portal-logs-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.stat-portal-logs-pager-size {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stat-portal-logs-pager-size label {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}
.stat-portal-logs-pager-size .form-control { width: auto; min-width: 88px; }
.stat-portal-logs-pager-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.stat-portal-logs-pager-goto {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.stat-portal-logs-pager-goto .form-control {
    width: 72px;
    min-width: 72px;
    text-align: center;
}
.stat-portal-logs-pager-info {
    margin: 0;
    flex: 1 1 180px;
    font-size: 13px;
}
.stat-portal-embed-block { margin-bottom: 20px; }
.stat-portal-embed-block label { display: block; font-weight: 600; margin-bottom: 8px; color: #334155; }
.stat-portal-copy-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.stat-portal-copy-row code { flex: 1; min-width: 200px; padding: 10px 12px; background: var(--sp-code-bg); border-radius: 8px; word-break: break-all; }
.stat-portal-code-break { word-break: break-all; white-space: pre-wrap; }
.stat-portal-pre {
    background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px;
    font-size: 12px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.stat-portal-settings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 16px;
}
.stat-portal-settings-card {
    display: block; padding: 16px; border: 1px solid var(--sp-border); border-radius: 12px;
    text-decoration: none; color: inherit; background: var(--sp-surface); transition: box-shadow .15s, border-color .15s;
}
.stat-portal-settings-card:hover { border-color: #2563eb; box-shadow: 0 4px 16px rgba(37,99,235,.12); text-decoration: none; color: inherit; }
.stat-portal-settings-card strong { display: block; margin-bottom: 6px; font-size: 15px; }
.stat-portal-settings-card span { font-size: 13px; color: #64748b; }
.stat-portal-live-hint {
    font-size: 13px; color: var(--sp-warning-text); background: var(--sp-warning-bg); border: 1px solid var(--sp-warning-border);
    padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
}
.stat-live-badge {
    display: inline-block; font-size: 11px; font-weight: 500; color: var(--sp-warning-text);
    background: var(--sp-warning-badge-bg); padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.stat-portal-pre-tall { max-height: 480px; }
.stat-portal-settings-form { max-width: 560px; }
.stat-portal-settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.stat-portal-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stat-portal-panel-card {
    background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px; padding: 20px;
}
.stat-portal-panel-card h3 { margin-top: 0; font-size: 16px; margin-bottom: 16px; }
.stat-compare-pick {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
    border: 1px solid var(--sp-border); border-radius: 8px; background: var(--sp-surface); cursor: pointer;
}
.stat-portal-share-url { margin-top: 12px; padding: 10px; background: var(--sp-success-bg); border-radius: 8px; word-break: break-all; color: var(--sp-text); }
.stat-portal-header-minimal { border-bottom: 1px solid var(--sp-border); }
.stat-portal-form-page .stat-portal-toolbar { margin-bottom: 20px; }
.stat-portal-section-divider { margin: 28px 0 20px; border-color: #e2e8f0; }
.stat-portal-crud-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-portal-crud-head h3 { margin: 0; font-size: 16px; }
.stat-portal-inline-form {
    background: var(--sp-surface-2); border: 1px solid var(--sp-border); border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.stat-portal-cleanup-warn {
    color: var(--sp-danger-text); background: var(--sp-danger-bg); border: 1px solid var(--sp-danger-border); padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
}
.stat-portal-check-group { display: flex; flex-wrap: wrap; gap: 12px 16px; }

/* ---------- 列表/管理页：电脑 / H5 自适应 ---------- */
.stat-portal-shell-page .stat-portal-main {
    width: 100%;
    box-sizing: border-box;
}
.stat-portal-toolbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
}
.stat-portal-toolbar-head h2 {
    margin: 0;
    font-size: 20px;
    flex: 1 1 auto;
    min-width: 0;
}
.stat-portal-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}
.stat-portal-manage-panel .stat-portal-table-wrap { margin-top: 0; }
.stat-portal-manage-table .table { margin-bottom: 0; }
.stat-portal-manage-table code {
    word-break: break-all;
    font-size: 12px;
    background: var(--sp-accent-bg, #f1f5f9);
    padding: 2px 6px;
    border-radius: 4px;
}
.stat-portal-manage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.stat-portal-form-panel {
    width: 100%;
}
.stat-portal-form-page .stat-portal-settings-form {
    max-width: none;
}

@media (min-width: 901px) {
    .stat-portal-shell-page .stat-portal-main {
        padding: 24px 28px;
        max-width: none;
    }
    .stat-portal-shell-page .stat-portal-panel-card {
        padding: 24px;
    }
    .stat-portal-toolbar-head {
        flex-wrap: nowrap;
    }
    .stat-portal-form-page .stat-portal-form-panel {
        max-width: 720px;
    }
    .stat-portal-form-page .stat-portal-settings-form {
        max-width: 640px;
    }
    .stat-portal-manage-table .table thead th {
        white-space: nowrap;
    }
}

@media (min-width: 1200px) {
    .stat-portal-shell-page .stat-portal-main {
        max-width: none;
        padding: 24px 32px;
    }
}

@media (max-width: 900px) {
    .stat-portal-shell-page .stat-portal-main {
        padding: 12px;
    }
    .stat-portal-shell-page .stat-portal-panel-card {
        padding: 14px;
    }
    .stat-portal-toolbar-head {
        align-items: stretch;
    }
    .stat-portal-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }
    .stat-portal-toolbar-actions .btn {
        flex: 1 1 auto;
    }
    /* 窄屏：表格改为卡片行，避免横向挤成一团 */
    .stat-portal-manage-table .table thead {
        display: none;
    }
    .stat-portal-manage-table .table,
    .stat-portal-manage-table .table tbody,
    .stat-portal-manage-table .table tr,
    .stat-portal-manage-table .table td {
        display: block;
        width: 100%;
    }
    .stat-portal-manage-table .table tbody tr {
        border: 1px solid var(--sp-border, #e2e8f0);
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 10px;
        background: var(--sp-surface, #fff);
    }
    .stat-portal-manage-table .table tbody td {
        border: none;
        padding: 7px 0;
        text-align: right;
    }
    .stat-portal-manage-table .table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--sp-muted, #64748b);
        text-align: left;
    }
    .stat-portal-manage-table .table tbody td[data-label=" "]::before {
        content: none;
    }
    .stat-portal-manage-table .stat-portal-manage-actions {
        justify-content: flex-start;
        padding-top: 4px;
    }
}

/* —— 专业站点：首页 / 品牌 / 页脚 —— */
.stat-portal-body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.stat-portal-brand-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.stat-portal-brand-link:hover { text-decoration: none; color: #2563eb; }
.stat-portal-brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.stat-portal-dot-lg { width: 14px; height: 14px; }
.stat-portal-header-sep { color: #cbd5e1; margin: 0 4px; }
.stat-portal-nav-toggle {
    display: none; border: 1px solid var(--sp-border); background: var(--sp-surface); border-radius: 8px;
    padding: 6px 10px; font-size: 16px; cursor: pointer;
}
.stat-portal-nav-divider { width: 1px; height: 20px; background: #e2e8f0; margin: 0 4px; align-self: center; }
.stat-portal-nav-secondary { font-size: 13px !important; }
.stat-portal-admin-link { opacity: 0.65; font-size: 12px !important; }
.stat-portal-badge {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.stat-portal-badge-web { background: var(--sp-accent-bg); color: #2563eb; }
.stat-portal-badge-app { background: #ecfdf5; color: #059669; }
.stat-portal-footer {
    border-top: 1px solid var(--sp-border); background: var(--sp-surface); padding: 16px 20px; margin-top: auto;
}
.stat-portal-footer-inner {
    max-width: 1440px; margin: 0 auto; text-align: center; font-size: 13px; color: #94a3b8;
}
.stat-portal-footer-brand { color: #64748b; font-weight: 600; }
.stat-portal-footer-sep { margin: 0 8px; }
.stat-portal-shell { display: flex; flex-direction: column; min-height: 100vh; }
.stat-portal-hero {
    display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
    gap: 16px; margin-bottom: 20px;
}
.stat-portal-hero h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.stat-portal-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 统计周期切换（6 项）：允许换行，窄屏略缩小 */
.stat-portal-period-toggle.btn-group {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
}
.stat-portal-period-toggle.btn-group > .btn {
    float: none;
    flex: 0 1 auto;
    padding: 6px 10px;
    font-size: 13px;
    margin: 0 0 4px 0;
    border-radius: 4px !important;
}
@media (max-width: 640px) {
    .stat-portal-period-toggle.btn-group > .btn {
        padding: 5px 8px;
        font-size: 12px;
    }
}
.stat-portal-home-section { margin-top: 28px; }
.stat-portal-section-title { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.stat-portal-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stat-portal-section-head .stat-portal-section-title { margin: 0; }
.stat-portal-section-links a { font-size: 13px; }
.stat-portal-channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stat-portal-channel-card {
    display: block; padding: 20px; border-radius: 14px; text-decoration: none; color: inherit;
    border: 1px solid var(--sp-border); background: var(--sp-surface); transition: box-shadow .15s, transform .15s;
}
.stat-portal-channel-card:hover { text-decoration: none; color: inherit; box-shadow: 0 8px 24px rgba(15,23,42,.08); transform: translateY(-1px); }
.stat-portal-channel-web { border-top: 3px solid #2563eb; }
.stat-portal-channel-app { border-top: 3px solid #059669; }
.stat-portal-channel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-portal-channel-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-portal-channel-metrics span { font-size: 12px; color: #64748b; }
.stat-portal-channel-metrics strong { display: block; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-portal-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat-portal-quick-card {
    display: block; padding: 16px; border: 1px solid var(--sp-border); border-radius: 12px; background: var(--sp-surface);
    text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s;
}
.stat-portal-quick-card:hover { border-color: #2563eb; box-shadow: 0 4px 16px rgba(37,99,235,.1); text-decoration: none; color: inherit; }
.stat-portal-quick-card strong { display: block; margin-bottom: 4px; font-size: 14px; }
.stat-portal-quick-card span:last-child { font-size: 12px; color: #64748b; }
.stat-portal-quick-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; background: var(--sp-accent-bg); color: #2563eb;
    font-weight: 700; font-size: 14px; margin-bottom: 10px;
}
.stat-portal-top-list { display: flex; flex-direction: column; gap: 8px; }
.stat-portal-top-item {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--sp-surface);
    border: 1px solid var(--sp-border); border-radius: 10px; text-decoration: none; color: inherit;
    transition: border-color .12s;
}
.stat-portal-top-item:hover { border-color: #2563eb; text-decoration: none; color: inherit; }
.stat-portal-top-rank { width: 24px; font-weight: 700; color: #94a3b8; font-size: 13px; }
.stat-portal-top-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-portal-top-pv, .stat-portal-top-uv { font-size: 13px; color: #64748b; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.stat-portal-login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.stat-portal-login-brand h1 { margin: 0; font-size: 22px; }
.stat-portal-login-tagline { margin: 4px 0 0; font-size: 13px; color: #64748b; }
.stat-portal-login-hint { margin-bottom: 20px; }
.stat-portal-login-foot { margin-top: 20px; text-align: center; font-size: 12px; color: #94a3b8; }
.stat-portal-main.is-loading { opacity: 0.55; pointer-events: none; transition: opacity .2s; }
.stat-portal-card { transition: box-shadow .15s, transform .15s; }
.stat-portal-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,.07); transform: translateY(-1px); }
.stat-portal-table-wrap .table { margin-bottom: 0; }
.stat-portal-table-wrap .table:not(.stat-portal-log-table) thead th {
    background: var(--sp-surface-2);
    border-bottom-width: 1px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

/* —— 专业图表卡片 —— */
.stat-chart-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 14px;
    padding: 16px 16px 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.stat-chart-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}
.stat-chart-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.02em;
}
.stat-chart-canvas {
    width: 100%;
    min-height: 120px;
    overflow: visible;
}
.stat-chart-type-select {
    min-width: 110px;
    max-width: 140px;
}
.stat-portal-trend-toolbar .stat-chart-type-select {
    flex: 0 0 auto;
}
.stat-sparkline {
    display: block;
    overflow: visible;
}
.stat-portal-card-spark {
    flex-shrink: 0;
    opacity: 0.9;
}
.stat-channel-spark {
    pointer-events: none;
    opacity: 0.85;
}
.stat-portal-channel-card:hover .stat-channel-spark {
    opacity: 1;
}
.stat-portal-metric {
    background: var(--sp-metric-bg);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: box-shadow .15s;
}
.stat-portal-metric:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.stat-portal-metric-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.stat-portal-metric-life .stat-portal-metric-value { color: #059669; }
.stat-portal-wb-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    margin-top: 16px;
}
.stat-wb-side-panels { display: flex; flex-direction: column; gap: 12px; }
.stat-wb-panel {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 14px 16px;
}
.stat-wb-panel h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: #64748b; }
.stat-wb-top-list { list-style: none; margin: 0; padding: 0; }
.stat-wb-top-list li {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
    border-bottom: 1px solid var(--sp-border); font-size: 13px;
}
.stat-wb-top-list li:last-child { border-bottom: none; }
.stat-wb-top-rank { width: 20px; color: #94a3b8; font-weight: 600; font-size: 12px; }
.stat-wb-top-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-wb-goals { display: flex; flex-direction: column; gap: 8px; }
.stat-wb-goal-item { display: flex; justify-content: space-between; font-size: 13px; }
.stat-drill-link { color: #2563eb; text-decoration: none; font-size: 12px; }
.stat-portal-workbench-overview.is-loading { opacity: 0.55; pointer-events: none; }
#sp-project-overview .stat-portal-summary { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.stat-chart-skeleton {
    height: 100%; min-height: 120px; border-radius: 10px;
    background: var(--sp-skeleton-bg);
    background-size: 200% 100%; animation: stat-shimmer 1.2s infinite;
}
@keyframes stat-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.stat-chart-loading { min-height: 120px; }

.stat-log-drawer-wrap { margin-top: 16px; }
.stat-log-drawer-wrap.is-loading { opacity: 0.7; pointer-events: none; }
.stat-log-drawer {
    background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px; padding: 16px;
    box-shadow: 0 4px 16px rgba(15,23,42,.06);
}
.stat-log-drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-log-trace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--sp-border, #e2e8f0);
}
.stat-log-trace-actions .stat-log-trace-label {
    width: 100%;
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--sp-muted, #64748b);
}
.stat-portal-log-table .sp-log-trace-inline {
    margin-left: 6px;
    vertical-align: middle;
}
.stat-trace-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.stat-trace-modal.hide { display: none !important; }
.stat-trace-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
.stat-trace-modal-panel {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: min(90vh, 880px);
    display: flex;
    flex-direction: column;
    background: var(--sp-surface, #fff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 24px 48px var(--sp-shadow, rgba(15, 23, 42, 0.18));
    overflow: hidden;
}
.stat-trace-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sp-border, #e2e8f0);
    background: var(--sp-metric-bg, #f8fafc);
}
.stat-trace-modal-head strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--sp-text, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-trace-modal-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
}
.stat-trace-modal-body {
    padding: 14px 16px 16px;
    overflow: auto;
    flex: 1 1 auto;
}
.stat-trace-modal-body.is-loading {
    opacity: 0.55;
    pointer-events: none;
}
.stat-trace-modal-close {
    min-width: 32px;
    font-size: 18px;
    line-height: 1;
    padding: 4px 10px;
}
@media (max-width: 600px) {
    .stat-trace-modal { padding: 0; align-items: flex-end; }
    .stat-trace-modal-panel {
        width: 100%;
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
    }
}
.stat-log-detail-list { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.stat-log-detail-list dt { color: #64748b; font-weight: 500; margin: 0; }
.stat-log-detail-list dd { margin: 0; word-break: break-all; }

.stat-portal-geo-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px;
}

.stat-portal-workbench-mobile {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--sp-surface); border-top: 1px solid var(--sp-border); padding: 6px 8px;
    justify-content: space-around; box-shadow: 0 -4px 16px rgba(15,23,42,.06);
}
.stat-portal-workbench-mobile a {
    font-size: 11px; color: #64748b; text-align: center; padding: 4px 8px; text-decoration: none;
}
.stat-portal-workbench-mobile a.active { color: #2563eb; font-weight: 600; }

/* ---------- 项目工作台：电脑 / H5 自适应 ---------- */
.stat-portal-shell-workbench {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
.stat-portal-header-workbench {
    gap: 12px;
}
.stat-portal-header-workbench .stat-portal-brand {
    flex-shrink: 1;
    min-width: 0;
}
.stat-portal-header-workbench .stat-portal-brand-link,
.stat-portal-header-workbench .stat-portal-back {
    min-width: 0;
}
.stat-portal-header-workbench .stat-portal-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-portal-header-workbench .stat-portal-project-title {
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}
.stat-portal-header-workbench .stat-portal-project-title .stat-portal-project-switcher {
    flex: 1 1 220px;
    min-width: 0;
    max-width: 100%;
}
.stat-portal-header-workbench .stat-portal-project-title h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(480px, 50vw);
}
.stat-portal-header-workbench .stat-portal-user {
    flex-shrink: 0;
}

@media (min-width: 901px) {
    .stat-portal-header-workbench {
        flex-wrap: nowrap;
        height: 56px;
        padding: 0 20px;
    }
    .stat-portal-header-workbench .stat-portal-user {
        width: auto;
        padding-top: 0;
        margin-left: auto;
    }
    .stat-portal-shell-workbench .stat-portal-workbench {
        flex-direction: row;
        align-items: flex-start;
        padding: 20px 24px;
        flex: 1;
    }
    .stat-portal-shell-workbench .stat-portal-side {
        display: block;
        width: 210px;
        position: sticky;
        top: 68px;
        align-self: flex-start;
        max-height: calc(100vh - 80px);
        overflow-x: hidden;
        overflow-y: auto;
    }
    .stat-portal-shell-workbench .stat-portal-side-link {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .stat-portal-shell-workbench .stat-portal-workbench-mobile {
        display: none !important;
    }
    .stat-portal-shell-workbench .stat-portal-panel {
        padding: 20px 24px;
        padding-bottom: 20px;
    }
    .stat-portal-wb-grid {
        grid-template-columns: minmax(0, 1fr) 340px;
    }
}

@media (min-width: 1200px) {
    .stat-portal-shell-workbench .stat-portal-workbench {
        padding: 24px 32px;
        max-width: none;
    }
    .stat-portal-shell-workbench .stat-portal-side {
        width: 220px;
    }
    .stat-portal-wb-grid {
        grid-template-columns: minmax(0, 1fr) 380px;
    }
    .stat-portal-header-workbench .stat-portal-project-title h2 {
        max-width: 640px;
    }
}

@media (max-width: 900px) {
    .stat-portal-header-workbench {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding: 10px 12px;
        gap: 8px;
        align-items: flex-start;
    }
    .stat-portal-header-workbench .stat-portal-brand {
        flex: 1 1 auto;
        min-width: 0;
        max-width: calc(100% - 120px);
    }
    .stat-portal-header-workbench .stat-portal-brand-name {
        max-width: 8em;
    }
    .stat-portal-header-workbench .stat-portal-header-sep {
        margin: 0 2px;
    }
    .stat-portal-header-workbench .stat-portal-project-title {
        order: 3;
        width: 100%;
        padding-top: 2px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .stat-portal-header-workbench .stat-portal-project-title h2 {
        max-width: none;
        white-space: normal;
    }
    .stat-portal-header-workbench .stat-portal-project-title .stat-portal-project-switcher {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }
    .stat-portal-header-workbench .stat-portal-user {
        flex: 0 0 auto;
        width: auto;
        max-width: 100%;
        margin-left: auto;
        padding-top: 0;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }
    .stat-portal-header-workbench .stat-portal-user-name {
        display: none;
    }
    .stat-portal-header-workbench .stat-portal-admin-link {
        display: none;
    }
    /* 手机：隐藏左侧栏，仅用底部 Tab，避免双导航 */
    .stat-portal-shell-workbench .stat-portal-side {
        display: none !important;
    }
    .stat-portal-shell-workbench .stat-portal-workbench {
        flex-direction: column;
        padding: 12px 12px 0;
    }
    .stat-portal-shell-workbench .stat-portal-panel {
        padding: 14px;
        padding-bottom: 72px;
        border-radius: 10px;
    }
    .stat-portal-shell-workbench .stat-portal-workbench-mobile {
        display: flex;
    }
    .stat-portal-shell-workbench .stat-portal-trend-toolbar .form-control {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .stat-log-detail-list {
        grid-template-columns: 1fr;
    }
    .stat-portal-card-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-portal-shell-workbench .stat-portal-trend-toolbar .form-control {
        flex: 1 1 100%;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .stat-portal-header-workbench .stat-portal-brand {
        max-width: 100%;
        width: 100%;
    }
    .stat-portal-header-workbench .stat-portal-user {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
    .stat-portal-header-workbench .stat-portal-project-title {
        order: 3;
    }
    .stat-portal-shell-workbench .stat-portal-workbench {
        padding: 8px 8px 0;
    }
    .stat-portal-shell-workbench .stat-portal-panel {
        padding: 12px;
        padding-bottom: 72px;
    }
    .stat-portal-logs-pager {
        flex-direction: column;
        align-items: stretch;
    }
    .stat-portal-logs-pager-nav {
        justify-content: center;
    }
    .stat-portal-logs-pager-info {
        text-align: center;
    }
}

@media (min-width: 901px) {
    .stat-portal-nav-toggle { display: none !important; }
    .stat-portal-nav {
        display: flex !important;
        position: static;
        flex-direction: row;
        background: transparent;
        border: none;
        padding: 0;
        box-shadow: none;
    }
    .stat-portal-header { flex-wrap: nowrap; height: 56px; padding: 0 20px; }
    .stat-portal-user { width: auto; padding-top: 0; }
    .stat-portal-workbench-mobile { display: none !important; }
    .stat-portal-panel { padding-bottom: 16px; }
}
@media (max-width: 900px) {
    .stat-portal-wb-grid { grid-template-columns: 1fr; }
    .stat-portal-nav-toggle { display: inline-block; }
    .stat-portal-nav {
        display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column;
        background: var(--sp-surface); border-bottom: 1px solid var(--sp-border); padding: 8px 12px 12px; box-shadow: 0 8px 24px rgba(15,23,42,.08);
    }
    .stat-portal-nav.is-open { display: flex; }
    .stat-portal-header { position: sticky; flex-wrap: wrap; height: auto; min-height: 56px; padding: 10px 12px; gap: 8px; }
    .stat-portal-nav-divider { display: none; }
    .stat-portal-user { width: 100%; justify-content: flex-end; padding-top: 4px; flex-wrap: wrap; gap: 6px; }
    .stat-portal-two-col { grid-template-columns: 1fr; }
    .stat-portal-workbench { flex-direction: column; padding: 12px; }
    .stat-portal-side { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
    .stat-portal-workbench-mobile { display: flex; }
    .stat-portal-panel { padding-bottom: 64px; }
    .stat-portal-main { padding: 12px; box-sizing: border-box; }
    .stat-portal-trend-toolbar .form-control {
        min-width: 0;
        max-width: 100%;
    }
}

/* ---------- 主题变量与深色模式（html 根级，登录/分享等全页生效） ---------- */
html {
    color-scheme: light;
    --sp-page-bg: #f4f6f8;
    --sp-bg: #f8fafc;
    --sp-surface: #ffffff;
    --sp-surface-2: #f1f5f9;
    --sp-code-bg: #f1f5f9;
    --sp-text: #0f172a;
    --sp-text-secondary: #334155;
    --sp-muted: #64748b;
    --sp-border: #e2e8f0;
    --sp-accent-bg: #eff6ff;
    --sp-accent: #2563eb;
    --sp-metric-bg: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    --sp-warning-bg: #fffbeb;
    --sp-warning-border: #fde68a;
    --sp-warning-text: #b45309;
    --sp-warning-badge-bg: #fef3c7;
    --sp-danger-bg: #fef2f2;
    --sp-danger-border: #fecaca;
    --sp-danger-text: #b91c1c;
    --sp-success-bg: #f0fdf4;
    --sp-btn-default-bg: #ffffff;
    --sp-btn-default-border: #cbd5e1;
    --sp-btn-default-text: #334155;
    --sp-btn-default-hover-bg: #f1f5f9;
    --sp-input-bg: #ffffff;
    --sp-shadow: rgba(15, 23, 42, 0.08);
    --sp-login-bg: linear-gradient(145deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%);
    --sp-skeleton-bg: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    --sp-badge-app-bg: #ecfdf5;
    --sp-badge-app-text: #059669;
    --sp-hover-border: #2563eb;
    --sp-hover-shadow: rgba(37, 99, 235, 0.12);
}
html[data-stat-theme="dark"] {
    color-scheme: dark;
    --sp-page-bg: #0f172a;
    --sp-bg: #0f172a;
    --sp-surface: #1e293b;
    --sp-surface-2: #334155;
    --sp-code-bg: #0f172a;
    --sp-text: #f1f5f9;
    --sp-text-secondary: #cbd5e1;
    --sp-muted: #94a3b8;
    --sp-border: #334155;
    --sp-accent-bg: #1e3a5f;
    --sp-accent: #60a5fa;
    --sp-metric-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --sp-warning-bg: rgba(180, 83, 9, 0.15);
    --sp-warning-border: rgba(251, 191, 36, 0.35);
    --sp-warning-text: #fcd34d;
    --sp-warning-badge-bg: rgba(251, 191, 36, 0.2);
    --sp-danger-bg: rgba(185, 28, 28, 0.15);
    --sp-danger-border: rgba(248, 113, 113, 0.35);
    --sp-danger-text: #fca5a5;
    --sp-success-bg: rgba(5, 150, 105, 0.15);
    --sp-btn-default-bg: #334155;
    --sp-btn-default-border: #475569;
    --sp-btn-default-text: #e2e8f0;
    --sp-btn-default-hover-bg: #475569;
    --sp-input-bg: #0f172a;
    --sp-shadow: rgba(0, 0, 0, 0.35);
    --sp-login-bg: linear-gradient(145deg, #0f172a 0%, #1e293b 45%, #0f172a 100%);
    --sp-skeleton-bg: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    --sp-badge-app-bg: rgba(5, 150, 105, 0.2);
    --sp-badge-app-text: #6ee7b7;
    --sp-hover-border: #60a5fa;
    --sp-hover-shadow: rgba(96, 165, 250, 0.15);
}
.stat-portal-body {
    background: var(--sp-bg);
    color: var(--sp-text);
}

/* 门户组件统一走变量 */
.stat-portal-header { background: var(--sp-surface); border-bottom-color: var(--sp-border); }
.stat-portal-nav a { color: var(--sp-muted); }
.stat-portal-nav a.active { background: var(--sp-accent-bg); color: var(--sp-accent); }
.stat-portal-footer { background: var(--sp-surface); border-top-color: var(--sp-border); color: var(--sp-muted); }
.stat-portal-footer-inner { color: var(--sp-muted); }
.stat-portal-footer-brand { color: var(--sp-muted); }
.stat-portal-panel,
.stat-portal-side,
.stat-wb-panel,
.stat-portal-inline-form,
.stat-portal-settings-card,
.stat-compare-pick,
.stat-portal-top-item,
.stat-portal-nav-toggle {
    background: var(--sp-surface);
    border-color: var(--sp-border);
    color: var(--sp-text);
}
.stat-portal-metric,
.stat-portal-card,
.stat-chart-card,
.stat-portal-login-card,
.stat-portal-panel-card {
    background: var(--sp-surface);
    border-color: var(--sp-border);
    color: var(--sp-text);
}
.stat-portal-metric { background: var(--sp-metric-bg); }
.stat-portal-card-metrics { color: var(--sp-muted); }
.stat-portal-card-metrics strong { color: var(--sp-text); }
.stat-portal-muted,
.stat-portal-empty,
.stat-portal-back,
.stat-portal-side-link,
.stat-portal-metric-label,
.stat-chart-card-title,
.stat-wb-panel h4,
.stat-log-detail-list dt,
.stat-portal-channel-metrics span,
.stat-portal-quick-card span:last-child,
.stat-portal-top-pv,
.stat-portal-top-uv,
.stat-portal-login-tagline,
.stat-portal-settings-card span,
.stat-portal-table-wrap .table thead th { color: var(--sp-muted); }
.stat-portal-side-link.active { background: var(--sp-accent-bg); color: var(--sp-accent); }
.stat-portal-embed-block label { color: var(--sp-text-secondary); }
.stat-portal-copy-row code { background: var(--sp-code-bg); color: var(--sp-text); }
.stat-portal-nav-divider { background: var(--sp-border); }
.stat-portal-section-divider { border-color: var(--sp-border); }
.stat-portal-inline-form { background: var(--sp-surface-2); }
.stat-portal-live-hint {
    color: var(--sp-warning-text);
    background: var(--sp-warning-bg);
    border-color: var(--sp-warning-border);
}
.stat-live-badge { color: var(--sp-warning-text); background: var(--sp-warning-badge-bg); }
.stat-portal-cleanup-warn {
    color: var(--sp-danger-text);
    background: var(--sp-danger-bg);
    border-color: var(--sp-danger-border);
}
.stat-portal-share-url { background: var(--sp-success-bg); color: var(--sp-text); }
.stat-portal-login { background: var(--sp-login-bg); }
.stat-chart-skeleton { background: var(--sp-skeleton-bg); }
.stat-wb-top-list li { border-bottom-color: var(--sp-border); }
.stat-log-drawer { background: var(--sp-surface); border-color: var(--sp-border); box-shadow: 0 4px 16px var(--sp-shadow); }
.stat-portal-logs-pager { background: var(--sp-metric-bg); border-color: var(--sp-border); }
.stat-portal-logs-pager-size label { color: var(--sp-muted); }
.stat-portal-channel-card,
.stat-portal-quick-card { background: var(--sp-surface); border-color: var(--sp-border); color: var(--sp-text); }
.stat-portal-workbench-mobile { background: var(--sp-surface); border-top-color: var(--sp-border); }
.stat-portal-workbench-mobile a { color: var(--sp-muted); }
.stat-portal-workbench-mobile a.active { color: var(--sp-accent); }
.stat-portal-theme-toggle {
    border: 1px solid var(--sp-border); background: transparent; color: var(--sp-muted);
    border-radius: 6px; padding: 2px 8px; font-size: 14px; cursor: pointer; line-height: 1.4;
}
.stat-portal-theme-toggle:hover { color: var(--sp-accent); border-color: var(--sp-accent); }
.stat-portal-lang-menu { background: var(--sp-surface); border-color: var(--sp-border); }
.stat-portal-lang-menu > li > a { color: var(--sp-text); }

/* Bootstrap / 表单 · 深色适配 */
html[data-stat-theme="dark"] .stat-portal-body .btn-default {
    background-color: var(--sp-btn-default-bg);
    border-color: var(--sp-btn-default-border);
    color: var(--sp-btn-default-text);
    text-shadow: none;
}
html[data-stat-theme="dark"] .stat-portal-body .btn-default:hover,
html[data-stat-theme="dark"] .stat-portal-body .btn-default:focus,
html[data-stat-theme="dark"] .stat-portal-body .btn-default:active,
html[data-stat-theme="dark"] .stat-portal-body .btn-default.active {
    background-color: var(--sp-accent-bg);
    border-color: var(--sp-accent);
    color: var(--sp-accent);
}
html[data-stat-theme="dark"] .stat-portal-body .btn-link { color: var(--sp-accent); }
html[data-stat-theme="dark"] .stat-portal-body .form-control,
html[data-stat-theme="dark"] .stat-portal-body select.form-control,
html[data-stat-theme="dark"] .stat-portal-body textarea.form-control {
    background-color: var(--sp-input-bg);
    border-color: var(--sp-border);
    color: var(--sp-text);
}
html[data-stat-theme="dark"] .stat-portal-body .form-control:focus {
    border-color: var(--sp-accent);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}
html[data-stat-theme="dark"] .stat-portal-body .input-group-addon {
    background: var(--sp-surface-2);
    border-color: var(--sp-border);
    color: var(--sp-muted);
}
html[data-stat-theme="dark"] .stat-portal-body .table {
    color: var(--sp-text);
    background: transparent;
}
html[data-stat-theme="dark"] .stat-portal-body .table > thead > tr > th,
html[data-stat-theme="dark"] .stat-portal-body .table > tbody > tr > td {
    border-color: var(--sp-border);
}
html[data-stat-theme="dark"] .stat-portal-body .table > thead > tr > th {
    background: var(--sp-surface-2);
    color: var(--sp-muted);
}
html[data-stat-theme="dark"] .stat-portal-body .table-striped > tbody > tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.03);
}
html[data-stat-theme="dark"] .stat-portal-body .table-hover > tbody > tr:hover {
    background: rgba(96, 165, 250, 0.08);
}
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs {
    border-bottom-color: var(--sp-border);
}
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs > li > a {
    color: var(--sp-muted);
    background: transparent;
}
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs > li > a:hover {
    background: var(--sp-surface-2);
    border-color: var(--sp-border);
    color: var(--sp-text);
}
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs > li.active > a,
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs > li.active > a:hover,
html[data-stat-theme="dark"] .stat-portal-body .nav-tabs > li.active > a:focus {
    background: var(--sp-surface);
    border-color: var(--sp-border);
    border-bottom-color: transparent;
    color: var(--sp-accent);
}
html[data-stat-theme="dark"] .stat-portal-body .dropdown-menu {
    background: var(--sp-surface);
    border-color: var(--sp-border);
    box-shadow: 0 8px 24px var(--sp-shadow);
}
html[data-stat-theme="dark"] .stat-portal-body .dropdown-menu > li > a {
    color: var(--sp-text);
}
html[data-stat-theme="dark"] .stat-portal-body .dropdown-menu > li > a:hover,
html[data-stat-theme="dark"] .stat-portal-body .dropdown-menu > li > a:focus {
    background: var(--sp-accent-bg);
    color: var(--sp-accent);
}
html[data-stat-theme="dark"] .stat-portal-body hr { border-color: var(--sp-border); }
html[data-stat-theme="dark"] .stat-portal-body label { color: var(--sp-text-secondary); }
html[data-stat-theme="dark"] .stat-portal-body .close { color: var(--sp-muted); opacity: 0.85; text-shadow: none; }
html[data-stat-theme="dark"] .stat-portal-body a { color: var(--sp-accent); }
html[data-stat-theme="dark"] .stat-portal-body .stat-drill-link { color: var(--sp-accent); }
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-brand-link:hover { color: var(--sp-accent); }
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-header-sep { color: var(--sp-border); }
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-nav { background: var(--sp-surface); border-bottom-color: var(--sp-border); }
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-badge-web { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-badge-app { background: rgba(5, 150, 105, 0.2); color: #6ee7b7; }
html[data-stat-theme="dark"] .stat-portal-body select option {
    background: var(--sp-surface);
    color: var(--sp-text);
}
html[data-stat-theme="dark"] .stat-portal-body .stat-portal-period-toggle.btn-group > .btn.active {
    background-color: var(--sp-accent-bg);
    border-color: var(--sp-accent);
    color: var(--sp-accent);
}

html[data-stat-theme="dark"] .layui-layer {
    background: var(--sp-surface) !important;
    color: var(--sp-text) !important;
    border: 1px solid var(--sp-border) !important;
}
html[data-stat-theme="dark"] .layui-layer-title {
    background: var(--sp-surface-2) !important;
    color: var(--sp-text) !important;
    border-bottom: 1px solid var(--sp-border) !important;
}
html[data-stat-theme="dark"] .layui-layer-content { color: var(--sp-text) !important; }
html[data-stat-theme="dark"] .layui-layer-btn a {
    background: var(--sp-btn-default-bg) !important;
    border-color: var(--sp-btn-default-border) !important;
    color: var(--sp-btn-default-text) !important;
}
html[data-stat-theme="dark"] .layui-layer-btn .layui-layer-btn0 {
    background: var(--sp-accent) !important;
    border-color: var(--sp-accent) !important;
    color: #fff !important;
}
html[data-stat-theme="dark"] .layui-layer-msg {
    background: var(--sp-surface) !important;
    color: var(--sp-text) !important;
    border: 1px solid var(--sp-border) !important;
    box-shadow: 0 8px 24px var(--sp-shadow) !important;
}

/* ---------- 帮助页与首页异常提示 ---------- */
.stat-portal-help-section {
    background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px;
    padding: 20px 24px; margin-bottom: 16px;
}
.stat-portal-help-section h3 { margin: 0 0 12px; font-size: 17px; }
.stat-portal-help-list { margin: 0; padding-left: 20px; color: var(--sp-muted); line-height: 1.7; }
.stat-portal-help-faq { margin: 0; }
.stat-portal-help-faq dt { font-weight: 600; margin-top: 12px; color: var(--sp-text); }
.stat-portal-help-faq dd { margin: 4px 0 0; color: var(--sp-muted); }
.stat-portal-help-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.stat-portal-anomaly-list { display: flex; flex-direction: column; gap: 8px; }
.stat-portal-anomaly-item {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--sp-surface); border: 1px solid var(--sp-border);
    border-radius: 10px; text-decoration: none; color: var(--sp-text);
    transition: border-color .15s, box-shadow .15s;
}
.stat-portal-anomaly-item:hover {
    border-color: #fca5a5; box-shadow: 0 2px 8px rgba(239, 68, 68, .08); text-decoration: none; color: var(--sp-text);
}
.stat-portal-anomaly-name { flex: 1; font-weight: 600; min-width: 120px; }
.stat-portal-anomaly-pv { font-variant-numeric: tabular-nums; }

/* 日报推送任务状态 */
.stat-portal-delivery-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--sp-accent, #2563EB);
}
.stat-portal-delivery-status.is-paused {
    background: rgba(100, 116, 139, 0.15);
    color: var(--sp-muted, #64748B);
}

/* ---------- 分享：项目勾选与链接卡片 ---------- */
.stat-portal-project-picks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    background: var(--sp-surface-2, var(--sp-surface));
}
.stat-portal-check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    line-height: 1.4;
}
.stat-portal-check-item input {
    margin: 3px 0 0;
    flex-shrink: 0;
}
.stat-portal-check-item span {
    word-break: break-word;
}

/* ---------- 接入代码（简化 JS / 图片） ---------- */
.stat-portal-embed-highlight {
    background: var(--sp-surface-2, rgba(37, 99, 235, 0.06));
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 14px 16px;
}
.stat-portal-embed-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.stat-portal-embed-block-head label {
    margin: 0;
    font-weight: 600;
}
.stat-portal-embed-tabs {
    margin-bottom: 12px;
}
.stat-portal-pre-sm {
    max-height: 120px;
    font-size: 12px;
    margin-bottom: 8px;
}
.stat-portal-embed-advanced {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--sp-border);
}
.stat-portal-embed-advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--sp-muted);
    margin-bottom: 10px;
}
.stat-portal-embed-dim-table {
    font-size: 13px;
}
.stat-portal-share-list {
    margin-top: 4px;
}
.stat-portal-share-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stat-portal-share-card {
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--sp-surface);
    box-shadow: 0 1px 3px var(--sp-shadow);
}
.stat-portal-share-card-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}
.stat-portal-share-card-url {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--sp-surface-2, rgba(0, 0, 0, 0.04));
    font-size: 12px;
    word-break: break-all;
    margin-bottom: 10px;
}
.stat-portal-share-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.stat-portal-share-url {
    margin-top: 12px;
    word-break: break-all;
}
.stat-portal-share-created-tip {
    margin: 0 0 6px;
    color: var(--sp-muted);
    font-size: 13px;
}

/* ---------- 日报推送任务卡片列表（编辑/发送按钮始终可见） ---------- */
.stat-portal-delivery-list {
    margin-top: 4px;
}
.stat-portal-delivery-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stat-portal-delivery-card {
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--sp-surface);
    box-shadow: 0 1px 3px var(--sp-shadow);
}
.stat-portal-delivery-card.is-paused {
    opacity: 0.88;
}
.stat-portal-delivery-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.stat-portal-delivery-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}
.stat-portal-delivery-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 0 0 12px;
    font-size: 13px;
}
.stat-portal-delivery-card-meta > div {
    min-width: 0;
}
.stat-portal-delivery-card-meta dt {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sp-muted);
}
.stat-portal-delivery-card-meta dd {
    margin: 0;
    color: var(--sp-text);
    word-break: break-all;
}
.stat-portal-delivery-card-target {
    grid-column: 1 / -1;
}
.stat-portal-delivery-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--sp-border);
}
.stat-portal-delivery-card-actions .btn {
    flex: 1 1 auto;
    min-width: 72px;
}
.stat-portal-delivery-card-actions .sp-delivery-edit {
    flex: 1.2 1 88px;
    font-weight: 600;
}
.stat-portal-delivery-card-actions .sp-delivery-del {
    flex: 0 0 40px;
    min-width: 40px;
    padding-left: 0;
    padding-right: 0;
}
@media (min-width: 768px) {
    .stat-portal-delivery-card-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .stat-portal-delivery-card-meta {
        grid-template-columns: 1fr;
    }
    .stat-portal-delivery-card-actions .btn {
        flex: 1 1 calc(50% - 4px);
    }
    .stat-portal-delivery-card-actions .sp-delivery-del {
        flex: 0 0 40px;
    }
}

/* ---------- 1.0.47 全站响应式 + 暗黑模式补全 ---------- */
.stat-portal-muted { color: var(--sp-muted); }
.stat-portal-dot { background: linear-gradient(135deg, var(--sp-accent), #0ea5e9); }
.stat-portal-nav a.active { color: var(--sp-accent); }
.stat-portal-brand-link:hover { color: var(--sp-accent); }
.stat-portal-header-sep { color: var(--sp-border); }
.stat-portal-nav-divider { background: var(--sp-border); }
.stat-portal-badge-web { background: var(--sp-accent-bg); color: var(--sp-accent); }
.stat-portal-badge-app { background: var(--sp-badge-app-bg); color: var(--sp-badge-app-text); }
.stat-portal-footer-inner,
.stat-portal-footer-brand { color: var(--sp-muted); }
.stat-portal-channel-web { border-top-color: var(--sp-accent); }
.stat-portal-channel-app { border-top-color: var(--sp-badge-app-text); }
.stat-portal-channel-card:hover,
.stat-portal-quick-card:hover,
.stat-portal-top-item:hover,
.stat-portal-settings-card:hover {
    border-color: var(--sp-hover-border);
    box-shadow: 0 4px 16px var(--sp-hover-shadow);
}
.stat-portal-quick-icon { background: var(--sp-accent-bg); color: var(--sp-accent); }
.stat-portal-home-channel-section { background: var(--sp-surface); border-color: var(--sp-border); }
.stat-portal-card { box-shadow: 0 1px 3px var(--sp-shadow); }
.stat-portal-lang-menu { box-shadow: 0 8px 24px var(--sp-shadow); }

/* 登录页：主题切换 */
.stat-portal-login-topbar {
    display: flex;
    justify-content: flex-end;
    margin: -8px 0 12px;
}
.stat-portal-login-card { position: relative; }

/* 分享只读页：顶栏与主题 */
.stat-portal-share-view .stat-portal-header-minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    min-height: 56px;
    height: auto;
}
.stat-portal-shareview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.stat-portal-shareview-badge { font-size: 13px; white-space: nowrap; }

/* 图表：高度随屏宽自适应 */
.stat-chart-canvas-responsive { width: 100%; min-height: 200px; height: clamp(200px, 42vw, 280px); }
.stat-chart-canvas-tall { height: clamp(260px, 52vw, 400px); }

/* 对比/分享/概览表格：窄屏卡片化（复用管理页模式） */
@media (max-width: 900px) {
    .stat-portal-responsive-table .stat-portal-manage-table .table thead { display: none; }
    .stat-portal-responsive-table .stat-portal-manage-table .table,
    .stat-portal-responsive-table .stat-portal-manage-table .table tbody,
    .stat-portal-responsive-table .stat-portal-manage-table .table tr,
    .stat-portal-responsive-table .stat-portal-manage-table .table td {
        display: block;
        width: 100%;
    }
    .stat-portal-responsive-table .stat-portal-manage-table .table tbody tr {
        border: 1px solid var(--sp-border);
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 10px;
        background: var(--sp-surface);
    }
    .stat-portal-responsive-table .stat-portal-manage-table .table tbody td {
        border: none;
        padding: 6px 0;
        text-align: right;
    }
    .stat-portal-responsive-table .stat-portal-manage-table .table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--sp-muted);
        text-align: left;
        margin-right: 12px;
    }
    .stat-portal-compare-select {
        max-width: 100%;
        width: 100%;
        min-height: 140px;
    }
    .stat-portal-hero {
        flex-direction: column;
        align-items: stretch;
    }
    .stat-portal-hero h1 { font-size: 22px; }
    .stat-portal-hero-actions {
        width: 100%;
        justify-content: stretch;
    }
    .stat-portal-hero-actions .btn,
    .stat-portal-trend-toolbar .btn,
    .stat-portal-toolbar-row-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
    .stat-portal-card-metrics { grid-template-columns: repeat(2, 1fr); }
    .stat-portal-grid { grid-template-columns: 1fr; }
    .stat-portal-quick-grid { grid-template-columns: 1fr; }
    .stat-portal-summary { grid-template-columns: repeat(2, 1fr); }
    .stat-portal-two-col { grid-template-columns: 1fr; }
    .stat-chart-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .stat-portal-summary { grid-template-columns: 1fr; }
    .stat-portal-card-metrics { grid-template-columns: 1fr; }
    .stat-portal-metric-value { font-size: 22px; }
    .stat-portal-login-card { padding: 24px 18px; }
    .stat-portal-shareview-badge { white-space: normal; text-align: right; max-width: 140px; }
}

/* 暗黑：登录/分享页表单（html 根变量已生效，补充无 layout 场景） */
html[data-stat-theme="dark"] .stat-portal-login .form-control,
html[data-stat-theme="dark"] .stat-portal-share-view .form-control,
html[data-stat-theme="dark"] .stat-portal-share-view select.form-control {
    background-color: var(--sp-input-bg);
    border-color: var(--sp-border);
    color: var(--sp-text);
}
html[data-stat-theme="dark"] .stat-portal-login label,
html[data-stat-theme="dark"] .stat-portal-share-view label {
    color: var(--sp-text-secondary);
}
html[data-stat-theme="dark"] .stat-portal-anomaly-item:hover {
    border-color: var(--sp-danger-border);
    box-shadow: 0 2px 8px var(--sp-shadow);
}
html[data-stat-theme="dark"] .stat-portal-pre {
    background: var(--sp-code-bg);
    color: var(--sp-text);
    border: 1px solid var(--sp-border);
}
html[data-stat-theme="dark"] .stat-portal-log-table .sp-log-row-bot {
    background: rgba(245, 158, 11, 0.12);
}
html[data-stat-theme="dark"] .stat-portal-log-badge-human {
    color: #5eead4;
    background: rgba(20, 184, 166, 0.18);
    border-color: rgba(20, 184, 166, 0.35);
}
html[data-stat-theme="dark"] .stat-portal-log-badge-bot {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
}
html[data-stat-theme="dark"] .stat-portal-cell-ua {
    color: var(--sp-muted);
}

/* ---------- 1.0.59 / 1.0.60 工作台宽屏自适应 + 明细表头不换行 ---------- */
.stat-portal-shell-fluid {
    width: 100%;
    max-width: none;
}
.stat-portal-shell-fluid .stat-portal-workbench {
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
}
.stat-portal-shell-fluid .stat-portal-panel {
    flex: 1 1 0;
    width: auto;
    max-width: none;
    min-width: 0;
}
.stat-portal-shell-workbench .stat-portal-panel {
    width: 100%;
    max-width: none;
}
.stat-portal-logs-wrap {
    width: 100%;
    min-width: 0;
}
.stat-portal-table-wrap-fluid {
    width: 100%;
    max-width: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.stat-portal-log-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}
.stat-portal-table-wrap .table.stat-portal-log-table thead th,
.stat-portal-shell-workbench .stat-portal-panel .table.stat-portal-log-table thead th,
.stat-portal-log-table thead th {
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    vertical-align: bottom;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-portal-log-table .sp-log-col-time,
.stat-portal-log-table .sp-log-col-ip,
.stat-portal-log-table .sp-log-col-event,
.stat-portal-log-table .sp-log-col-user,
.stat-portal-log-table .sp-log-col-location {
    width: 1%;
    white-space: nowrap;
}
.stat-portal-log-table .sp-log-col-traffic {
    width: 1%;
    min-width: 88px;
    white-space: nowrap;
}
.stat-portal-log-table .sp-log-col-url {
    width: auto;
    min-width: 200px;
}
.stat-portal-log-table .sp-log-col-title {
    width: auto;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-portal-log-table .sp-log-col-ua {
    width: auto;
    min-width: 220px;
}
.stat-portal-log-table .sp-log-col-screen,
.stat-portal-log-table .sp-log-col-device {
    width: auto;
    min-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (min-width: 1200px) {
    .stat-portal-shell-fluid .stat-portal-workbench {
        padding-left: 28px;
        padding-right: 28px;
    }
    .stat-portal-log-table .sp-log-col-url { min-width: 280px; }
    .stat-portal-log-table .sp-log-col-ua { min-width: 320px; }
}
@media (min-width: 1400px) {
    .stat-portal-shell-fluid .stat-portal-workbench {
        padding-left: 36px;
        padding-right: 36px;
    }
    .stat-portal-log-table .sp-log-col-url { min-width: 360px; }
    .stat-portal-log-table .sp-log-col-ua { min-width: 420px; }
}
@media (min-width: 1800px) {
    .stat-portal-shell-fluid .stat-portal-workbench {
        padding-left: 48px;
        padding-right: 48px;
    }
    .stat-portal-log-table .sp-log-col-url { min-width: 420px; }
    .stat-portal-log-table .sp-log-col-ua { min-width: 520px; }
}
@media (min-width: 2200px) {
    .stat-portal-log-table .sp-log-col-url { min-width: 520px; }
    .stat-portal-log-table .sp-log-col-ua { min-width: 640px; }
}

/* ---------- 1.0.51 首页电脑/手机自适应 ---------- */
.stat-portal-shell-home .stat-portal-main {
    width: 100%;
    max-width: 1440px;
    box-sizing: border-box;
}
.stat-portal-shell-home .stat-portal-home-hero {
    gap: 20px;
    margin-bottom: 8px;
}
.stat-portal-shell-home .stat-portal-home-toolbar {
    flex: 1 1 300px;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}
.stat-portal-shell-home .stat-portal-home-toolbar-period {
    width: 100%;
    min-width: 0;
}
.stat-portal-shell-home .stat-portal-home-toolbar-period .stat-portal-period-toggle {
    width: 100%;
}
.stat-portal-shell-home .stat-portal-home-refresh-btn {
    align-self: flex-start;
    white-space: nowrap;
}
.stat-portal-shell-home .stat-portal-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}
.stat-portal-shell-home .stat-portal-home-channel-section {
    min-width: 0;
}
.stat-portal-shell-home .stat-portal-quick-section {
    margin-bottom: 8px;
}

@media (min-width: 992px) {
    .stat-portal-shell-home .stat-portal-home-hero {
        align-items: center;
    }
    .stat-portal-shell-home .stat-portal-home-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: center;
    }
    .stat-portal-shell-home .stat-portal-home-toolbar-period {
        width: auto;
        flex: 1 1 auto;
        max-width: 100%;
    }
    .stat-portal-shell-home .stat-portal-home-refresh-btn {
        flex-shrink: 0;
    }
    .stat-portal-shell-home .stat-portal-quick-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 1099px) {
    .stat-portal-shell-home .stat-portal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stat-portal-shell-home .stat-portal-quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .stat-portal-shell-home .stat-portal-main {
        padding: 12px;
    }
    .stat-portal-shell-home .stat-portal-home-channel-section {
        padding: 14px 14px 16px;
        border-radius: 12px;
    }
    .stat-portal-shell-home .stat-portal-home-section {
        margin-top: 20px;
    }
    .stat-portal-shell-home .stat-portal-home-projects {
        gap: 16px;
    }
    .stat-portal-shell-home .stat-portal-card {
        padding: 14px;
    }
    .stat-portal-shell-home .stat-portal-card-metrics strong {
        font-size: 16px;
    }
    .stat-portal-shell-home .stat-portal-anomaly-item {
        flex-wrap: wrap;
        gap: 8px 12px;
        padding: 12px 14px;
    }
    .stat-portal-shell-home .stat-portal-anomaly-name {
        flex: 1 1 100%;
        min-width: 0;
    }
    .stat-portal-shell-home .stat-portal-anomaly-pv {
        margin-right: auto;
    }
}

@media (max-width: 640px) {
    .stat-portal-shell-home .stat-portal-hero h1 {
        font-size: 22px;
        line-height: 1.25;
    }
    .stat-portal-shell-home .stat-portal-hero-text p {
        font-size: 13px;
        line-height: 1.5;
    }
    .stat-portal-shell-home .stat-portal-period-toggle.btn-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }
    .stat-portal-shell-home .stat-portal-period-toggle.btn-group > .btn {
        width: 100%;
        margin: 0;
        padding: 8px 4px;
        font-size: 11px;
        line-height: 1.3;
        white-space: normal;
        min-height: 36px;
    }
    .stat-portal-shell-home .stat-portal-home-refresh-btn {
        width: 100%;
        align-self: stretch;
    }
    .stat-portal-shell-home .stat-portal-section-title {
        font-size: 15px;
    }
    .stat-portal-shell-home .stat-portal-quick-grid {
        grid-template-columns: 1fr;
    }
    .stat-portal-shell-home .stat-portal-quick-card {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }
    .stat-portal-shell-home .stat-portal-quick-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .stat-portal-shell-home .stat-portal-quick-card strong {
        margin-bottom: 2px;
    }
}

@media (max-width: 480px) {
    .stat-portal-shell-home .stat-portal-grid {
        grid-template-columns: 1fr;
    }
    .stat-portal-shell-home .stat-portal-card-head {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .stat-portal-shell-home .stat-portal-card-spark {
        align-self: flex-end;
    }
    .stat-portal-shell-home .stat-portal-card-spark .stat-sparkline {
        max-width: 100%;
        height: auto;
    }
    .stat-portal-shell-home .stat-portal-card-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }
    .stat-portal-shell-home .stat-portal-anomaly-item .stat-portal-muted:last-child {
        display: none;
    }
    .stat-portal-shell-home .stat-portal-empty {
        padding: 32px 12px;
    }
}

@media (min-width: 1200px) {
    .stat-portal-shell-home .stat-portal-main {
        padding: 24px 28px;
    }
    .stat-portal-shell-home .stat-portal-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}
