/* ============================================================
   主播数据录入系统 v2 — Professional UI
   移动端优先 · 系统字体 · WCAG AA+
   ============================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Design Tokens ---- */
:root {
    --color-primary: #1E40AF;
    --color-primary-light: #3B82F6;
    --color-primary-bg: #EFF6FF;
    --color-accent: #D97706;
    --color-accent-light: #FDE68A;
    --color-success: #059669;
    --color-success-bg: #ECFDF5;
    --color-warning: #D97706;
    --color-warning-bg: #FFFBEB;
    --color-danger: #DC2626;
    --color-danger-bg: #FEF2F2;

    --color-bg: #F1F5F9;
    --color-surface: #FFFFFF;
    --color-text: #0F172A;
    --color-text-secondary: #475569;
    --color-muted: #94A3B8;
    --color-border: #E2E8F0;

    --color-nav: #1E3A8A;
    --color-nav-text: #FFFFFF;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;

    --transition: 180ms ease;
    --touch-min: 44px;

    /* 角色/语义色（供各模板引用，主题切换时自动换色） */
    --role-anchor: #7c3aed;
    --role-sales: #2563eb;
    --role-channel: #059669;
    --role-default: #6366F1;
    --hdr-danger-bg: #fdecea;
    --hdr-danger-fg: #c0392b;
    --hdr-info-bg: #e8f0fe;
    --hdr-info-fg: #1a73e8;
    --row-emph-bg: #F0F4FF;
    --row-input-emph-bg: #E8EDFA;
    --hl-gold-bg: #FFF7ED;
    --hl-gold-fg: #B45309;
    --hl-gold-soft-bg: #FFFDF5;
    --total-row-bg: #FFF9C4;

    /* 表格/单元格/提示等语义色（各模板引用，主题切换自动换色） */
    --cell-self-bg: #e6f4ea;
    --cell-self-fg: #1a7f37;
    --tbl-head-bg: #f5f7fa;
    --tbl-head-fg: #4a5568;
    --tbl-cat-bg: #f0f4f8;
    --tbl-subtle-bg: #fafbfc;
    --tbl-col-day-bg: #eef2f7;
    --tbl-col-type-bg: #f8f9fb;
    --readonly-bg: #f5f5f5;
    --readonly-fg: #888;
    --hint-bg: #fffbe6;
    --hint-border: #ffe58f;
    --hint-fg: #8a6d00;
    --review-bg: #f0f7ff;
    --review-border: #b3d4fc;
    --cell-tw-fg: #ea580c;
    --role-bg-anchor: #faf5ff;
    --role-bg-sales: #eff4ff;
    --role-bg-channel: #ecfdf5;
    --ch-purple-fg: #6D28D9;
    --ch-purple-bg: #F5F3FF;
    --notif-unread-bg: #fff5f5;
}

/* ---- Base ---- */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: var(--font-system);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Container ---- */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 12px 20px 40px;
}

/* ---- Navbar ---- */
.navbar {
    background: var(--color-nav);
    color: var(--color-nav-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-brand {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.nav-right::-webkit-scrollbar { display: none; }
.nav-user {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.nav-project-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    white-space: nowrap;
}
.nav-link {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
}
.nav-logout { color: rgba(255,255,255,0.65); }

/* ---- Flash Messages ---- */
.flash-container { margin-bottom: 12px; }
.flash {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    animation: slideDown 0.25s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--color-success-bg); color: #065F46; border-left: 4px solid var(--color-success); }
.flash-danger  { background: var(--color-danger-bg); color: #991B1B; border-left: 4px solid var(--color-danger); }
.flash-warning { background: var(--color-warning-bg); color: #92400E; border-left: 4px solid var(--color-warning); }
.flash-info    { background: var(--color-primary-bg); color: #1E40AF; border-left: 4px solid var(--color-primary); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-min);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-system);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--color-primary-light); outline-offset: 2px; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: #1E3A8A;
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline:hover {
    border-color: var(--color-primary-light);
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}
.btn-success:hover { background: #047857; }

.btn-warning {
    background: var(--color-warning);
    color: #fff;
}

.btn-danger {
    background: #DC2626;
    color: #fff;
}
.btn-danger:hover { background: #B91C1C; }
.btn-danger.armed {
    background: #991B1B;
    animation: btnPulse 0.9s ease-in-out infinite;
}
@keyframes btnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.btn-sm { min-height: 36px; padding: 5px 12px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.disabled-btn { opacity: 0.35; pointer-events: none; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-project { background: var(--color-primary-bg); color: var(--color-primary); }
.badge-name { background: #F1F5F9; color: var(--color-text-secondary); }
.badge-admin { background: #FEF2F2; color: #991B1B; }
.badge-user { background: #EFF6FF; color: #1E40AF; }
.badge-super { background: linear-gradient(135deg, #7C3AED, #4F46E5); color: #FFFFFF; box-shadow: 0 2px 6px rgba(124,58,237,.35); }

/* ---- Tags ---- */
.tag { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.tag-good { background: var(--color-success-bg); color: #065F46; }
.tag-warn { background: var(--color-danger-bg); color: #991B1B; }

/* ---- Cards ---- */
.field-card, .chart-card, .card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}
.card-header-live { background: #EFF6FF; color: #1E40AF; }
.card-header-video { background: #F0FDF4; color: #166534; }
.card-header-article { background: #FFF7ED; color: #9A3412; }
.card-count { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--color-muted); }
.card-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.card-header-live .card-dot { background: #3B82F6; }
.card-header-video .card-dot { background: #10B981; }
.card-header-article .card-dot { background: #F59E0B; }
.card-body { padding: 12px 16px; }
/* 宽屏下表单字段两列布局 */
@media (min-width: 640px) {
    .card-body {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 0 20px;
    }
}

/* ---- Form Fields ---- */
.field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}
.field-row label {
    min-width: 90px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    text-align: right;
}
.field-row input {
    flex: 1;
    min-height: var(--touch-min);
    padding: 8px 12px;
    font-size: 15px;
    font-family: var(--font-system);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}
.field-row input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.field-row input:disabled {
    background: #F8FAFC;
    color: var(--color-muted);
    cursor: not-allowed;
}
.field-row input::placeholder { color: var(--color-muted); }

/* ---- Date Picker ---- */
.date-picker-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    margin-bottom: 12px;
}
.date-input {
    min-height: var(--touch-min);
    padding: 6px 12px;
    font-size: 14px;
    font-family: var(--font-system);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
}
.day-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
}

/* ---- OCR Dropzone ---- */
.ocr-upload-bar { margin-bottom: 16px; }
.ocr-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    padding: 12px 20px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-primary-bg);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    color: var(--color-text-secondary);
}
.ocr-icon {
    display: inline-block;
    width: 28px; height: 28px;
    border: 2px solid currentColor;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
}
.ocr-icon::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.ocr-dropzone:hover .ocr-icon,
.ocr-dropzone.dragover .ocr-icon {
    color: var(--color-primary);
}
.ocr-dropzone:hover, .ocr-dropzone.dragover {
    border-color: var(--color-primary-light);
    background: #DBEAFE;
    color: var(--color-primary);
}
.ocr-hint { font-size: 12px; color: var(--color-muted); }
.ocr-thumb {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: #fff;
    object-fit: contain;
    cursor: zoom-in;
}
.ocr-dropzone.has-thumb {
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}
.ocr-dropzone.has-thumb .ocr-icon,
.ocr-dropzone.has-thumb > span:not(.ocr-hint) {
    display: none;
}
.img-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    padding: 24px;
    box-sizing: border-box;
}
.img-lightbox.show { display: flex; }
.img-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    background: #fff;
}
.img-lightbox .lb-hint {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    opacity: 0.85;
}
.ocr-status { margin-top: 8px; font-size: 13px; min-height: 20px; }
.ocr-loading { color: var(--color-primary-light); }
.ocr-success { color: var(--color-success); }
.ocr-error { color: var(--color-danger); }
.ocr-warn { color: var(--color-warning); }

/* ---- Form Actions ---- */
.form-actions { margin-top: 20px; text-align: center; }
.submit-hint { margin-top: 8px; font-size: 12px; color: var(--color-muted); }

/* ---- Login ---- */
.login-page {
    display: flex;
    justify-content: center;
    padding-top: 10vh;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 36px 28px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--color-muted); margin-bottom: 24px; }
.login-form { text-align: left; }
.login-form .field-row { flex-direction: column; align-items: stretch; gap: 4px; }
.login-form .field-row label { text-align: left; min-width: auto; }
.login-form .field-row input { width: 100%; }
.login-form .btn { margin-top: 16px; }
.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.8;
}

/* ---- Project Selection ---- */
.project-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 600px;
    margin: 0 auto;
}
.project-card {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 36px 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}
.project-card-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800;
    color: #fff;
}
.project-card:nth-child(1) .project-card-icon { background: linear-gradient(135deg, #3B82F6, #1E40AF); }
.project-card:nth-child(2) .project-card-icon { background: linear-gradient(135deg, #F59E0B, #D97706); }
.project-card-name { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.project-card .btn { width: 100%; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
.summary-table, .records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.summary-table thead th, .records-table thead th {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 8px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    position: sticky;
    top: 0;
}
.summary-table td, .records-table td {
    padding: 8px 8px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.summary-table tbody tr:hover { background: #F8FAFC; }
.row-total { background: #EFF6FF; font-weight: 600; }
.row-grand { background: #FEF3C7; font-weight: 700; border-top: 2px solid var(--color-accent); }
.project-sep td { background: #E0E7FF !important; font-weight: 700; }
.anchor-name {
    text-align: left !important;
    padding-left: 10px !important;
}
.anchor-name .anchor-avatar { margin-right: 8px; vertical-align: middle; }
.anchor-name .anchor-link { vertical-align: middle; }
.anchor-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.grand-avatar { background: var(--color-accent); }
.anchor-link { font-weight: 600; color: var(--color-primary); }
.top-val {
    background: #FEF3C7 !important;
    font-weight: 700 !important;
}
.col-rank-badge { font-size: 20px; text-align: center; width: 40px; }
.col-score { font-weight: 800; color: var(--color-primary); font-size: 16px; }
.col-cost { color: var(--color-success); font-weight: 600; }

/* ---- Ranking Table ---- */
.ranking-table thead th {
    background: var(--color-primary);
    color: #fff;
    padding: 8px 6px;
}
.rank-row { transition: background var(--transition); }
.rank-row:hover { background: #F1F5F9; }
.rank-1 { background: #FFF7ED; }
.rank-2, .rank-3 { background: #F8FAFC; }

/* ---- KPI Cards ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.kpi-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.kpi-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.kpi-name { font-weight: 700; font-size: 15px; }
.kpi-rank {
    margin-left: auto; font-size: 20px; font-weight: 800;
    color: var(--color-primary);
}
.kpi-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kpi-item { text-align: center; padding: 4px 2px; }
.kpi-label { display: block; font-size: 11px; color: var(--color-muted); margin-bottom: 2px; }
.kpi-value { display: block; font-size: 16px; font-weight: 700; }
.kpi-highlight .kpi-value { color: var(--color-success); }
.kpi-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---- Insights Bar ---- */
.insights-bar {
    display: flex; gap: 10px; overflow-x: auto;
    padding: 8px 0; margin-bottom: 8px;
    -ms-overflow-style: none; scrollbar-width: none;
}
.insights-bar::-webkit-scrollbar { display: none; }
.insight-tag {
    flex-shrink: 0; white-space: nowrap;
    padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 500;
}
.insight-best  { background: var(--color-success-bg); color: #065F46; }
.insight-good  { background: var(--color-primary-bg); color: #1E40AF; }
.insight-star  { background: #FFF7ED; color: #9A3412; }
.insight-up    { background: #F0FDF4; color: #166534; }
.insight-down  { background: var(--color-danger-bg); color: #991B1B; }
.insight-info  { background: #F5F3FF; color: #5B21B6; }

/* ---- Trend Grid ---- */
.trend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 768px) {
    .trend-grid { grid-template-columns: 1fr; }
}
.trend-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.trend-card-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px; padding: 0 6px;
}

/* ---- Chart Cards ---- */
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.chart-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.chart-card h5 { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bar-bg {
    flex: 1; height: 22px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ---- Period Tabs ---- */
/* ---- Section Nav ---- */
.section-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px;
    margin: 8px 0 20px;
    position: sticky;
    top: 52px;
    z-index: 90;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}
.section-nav-link {
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    position: relative;
}
.section-nav-link:hover {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}
.section-nav-link.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.35);
}
.nav-group {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-caret { font-size: 9px; margin-left: 2px; opacity: 0.8; }
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 150px;
    padding: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    z-index: 300;
}
.nav-group:hover .nav-dropdown { display: flex; }
.nav-dropdown-link {
    display: block;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all var(--transition);
}
.nav-dropdown-link:hover {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}
.nav-dropdown-group {
    padding: 6px 14px 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    margin-top: 4px;
    border-top: 1px solid var(--color-border);
    white-space: nowrap;
}

.period-tabs { display: flex; gap: 4px; }
.tab {
    padding: 5px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: all var(--transition);
    text-decoration: none;
}
.tab:hover { text-decoration: none; border-color: var(--color-primary-light); }
.tab-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ---- Misc ---- */
.summary-header { margin-bottom: 8px; }
.summary-header h2 { margin-bottom: 8px; }
.summary-toolbar {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 12px;
}
.period-range { font-size: 13px; color: var(--color-text-secondary); white-space: nowrap; }
.float-nav {
    position: fixed; bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 50;
}
.float-nav button {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition);
}
.float-nav button:hover { transform: scale(1.1); }

/* ---- Entry Page ---- */
.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}
.entry-meta { display: flex; gap: 6px; }
.records-page h2 { margin-bottom: 8px; }
.admin-page h2 { margin-bottom: 16px; }

/* ---- Modal ---- */
.modal {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
}
.modal-card {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin-bottom: 12px; }
.modal-card .field-row { flex-direction: column; align-items: stretch; gap: 4px; }
.editable-name {
    cursor: pointer;
    color: var(--color-primary);
    border-bottom: 1px dashed var(--color-primary-light);
}
.editable-name:hover { color: var(--color-primary-dark); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .container { padding: 8px 10px 32px; }
    .navbar { padding: 0 10px; height: 48px; }
    .nav-brand { font-size: 14px; }
    .nav-link { font-size: 12px; padding: 4px 6px; }
    .nav-user { font-size: 11px; padding: 3px 6px; }
    .field-row label { min-width: 72px; font-size: 13px; }
    .field-row input { font-size: 14px; min-height: 40px; }
    .summary-table, .records-table { font-size: 12px; }
    .sortable-header {
        cursor: pointer;
        user-select: none;
        transition: background var(--transition);
    }
    .sortable-header:hover {
        background: #1E3A8A !important;
    }
    .sortable-header .sort-arrow {
        display: inline-block;
        margin-left: 5px;
        font-size: 11px;
        color: rgba(255,255,255,0.4);
        vertical-align: middle;
        transition: color var(--transition);
    }
    .sortable-header.sort-asc .sort-arrow,
    .sortable-header.sort-desc .sort-arrow {
        color: #fff;
        font-size: 12px;
    }
    .summary-table thead .group-header {
        background: #1E3A8A;
        color: #BFDBFE;
        font-size: 12px;
        text-transform: none;
        letter-spacing: 0.5px;
    }
    .summary-table td, .records-table td { padding: 6px 4px; }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .trend-grid { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
    .project-card { min-width: 150px; max-width: 100%; padding: 24px 16px; }
    .login-card { padding: 28px 18px; }
}

/* ---- Theme Toggle ---- */
/* 深色主题变量与覆盖规则见文件末尾 [data-theme="dark"] 区块（由切换按钮 + localStorage 控制） */

/* 状态标签 */
.status-submitted { display:inline-block;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;background:#D4EDDA;color:#155724; }
.status-draft { display:inline-block;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;background:#E2E3E5;color:#383D41; }
.status-missing { display:inline-block;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;background:#FFF3CD;color:#856404;border:1px dashed #FFC107; }

/* 多场次直播 OCR */
.ocr-session {
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}
.ocr-session .session-label {
    background: #E8EDFA;
    color: #1a56db;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 12px;
}
.ocr-session .ocr-dropzone {
    margin: 0;
    border: none;
    border-radius: 0;
}
.ocr-session .ocr-status {
    padding: 4px 12px 8px;
    font-size: 12px;
    min-height: 20px;
}
.ocr-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.ocr-actions .ocr-hint {
    font-size: 12px;
    color: var(--color-muted, #999);
}
#sessionSummaryCard {
    margin-top: 16px;
}
/* 汇总卡片标题 — 简洁文字，不像导航栏 */
.summary-card-title {
    font-weight: 700;
    font-size: 14px;
    color: #1a56db;
    margin-bottom: 4px;
}
/* 汇总卡片内的表头用浅色，避免和导航栏一样的暗蓝色 */
#sessionSummaryCard .records-table thead th {
    background: #E8EDFA;
    color: #1E40AF;
    font-weight: 600;
    font-size: 13px;
    padding: 7px 8px;
}
/* 每场编辑字段 */
.session-fields {
    display: flex;
    gap: 8px;
    padding: 6px 12px 10px;
    flex-wrap: wrap;
}
.sf-item {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 70px;
}
.sf-item label {
    font-size: 10px;
    color: var(--color-muted);
    white-space: nowrap;
}
.sf-item input {
    width: 100%;
    min-height: 30px;
    padding: 3px 6px;
    font-size: 13px;
    font-family: var(--font-system);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    text-align: right;
}
.sf-item input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}
/* 删除场次按钮 */
.btn-del-session {
    margin-left: auto;
    background: none;
    border: 1px solid #d0d0d0;
    color: #999;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}
.btn-del-session:hover {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #DC2626;
}

/* 直播复盘文本 */
.session-review {
    margin: 6px 12px 10px;
}
.session-review .review-label {
    font-size: 12px;
    font-weight: 700;
    color: #1a56db;
    margin-bottom: 6px;
}
.session-review .review-text {
    width: 100%;
    min-height: 240px;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    padding: 10px 12px;
    resize: vertical;
    box-sizing: border-box;
}
.session-review .review-text:focus {
    outline: none;
    border-color: #1a56db;
}
.btn-copy-review {
    font-size: 12px;
    padding: 5px 12px;
    border: 1px solid #1a56db;
    background: #EFF6FF;
    color: #1a56db;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-copy-review:hover {
    background: #1a56db;
    color: #fff;
}

/* ============================================================
   深色主题（data-theme="dark"）— 海蓝/青色看板风格
   覆盖 :root 变量 + 所有硬编码浅色，切换按钮写入 <html data-theme>
   ============================================================ */
[data-theme="dark"] {
    --color-primary: #60A5FA;
    --color-primary-light: #2EE6FF;
    --color-primary-bg: rgba(96, 165, 250, 0.16);
    --color-accent: #2EE6FF;
    --color-accent-light: #7FE9FF;
    --color-success: #34D399;
    --color-success-bg: rgba(6, 78, 59, 0.5);
    --color-warning: #FBBF24;
    --color-warning-bg: rgba(120, 53, 15, 0.5);
    --color-danger: #F87171;
    --color-danger-bg: rgba(127, 29, 29, 0.5);

    --color-bg: #0F1E3A;
    --color-surface: #1A3054;
    --color-text: #EDF4FF;
    --color-text-secondary: #AFC7E8;
    --color-muted: #6E8DB0;
    --color-border: rgba(96, 165, 250, 0.22);

    --color-nav: #132647;
    --color-nav-text: #EDF4FF;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.45);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.55);

    /* 角色/语义色 */
    --role-anchor: #C4B5FD;
    --role-sales: #93C5FD;
    --role-channel: #6EE7B7;
    --role-default: #A5B4FC;
    --hdr-danger-bg: rgba(127, 29, 29, 0.35);
    --hdr-danger-fg: #FCA5A5;
    --hdr-info-bg: rgba(37, 99, 235, 0.3);
    --hdr-info-fg: #93C5FD;
    --row-emph-bg: rgba(37, 99, 235, 0.18);
    --row-input-emph-bg: rgba(37, 99, 235, 0.22);
    --hl-gold-bg: rgba(251, 191, 36, 0.15);
    --hl-gold-fg: #FDBA74;
    --hl-gold-soft-bg: rgba(251, 191, 36, 0.08);
    --total-row-bg: rgba(198, 136, 42, 0.28);

    --cell-self-bg: rgba(5, 150, 105, 0.22);
    --cell-self-fg: #6EE7B7;
    --tbl-head-bg: rgba(37, 99, 235, 0.2);
    --tbl-head-fg: #93C5FD;
    --tbl-cat-bg: rgba(22, 56, 120, 0.4);
    --tbl-subtle-bg: rgba(9, 27, 63, 0.5);
    --tbl-col-day-bg: rgba(22, 56, 120, 0.4);
    --tbl-col-type-bg: rgba(9, 27, 63, 0.5);
    --readonly-bg: rgba(9, 27, 63, 0.4);
    --readonly-fg: #7A9CC8;
    --hint-bg: rgba(198, 136, 42, 0.18);
    --hint-border: rgba(251, 191, 36, 0.35);
    --hint-fg: #FDE68A;
    --review-bg: rgba(37, 99, 235, 0.14);
    --review-border: rgba(46, 168, 255, 0.3);
    --cell-tw-fg: #FDBA74;
    --role-bg-anchor: rgba(124, 58, 237, 0.18);
    --role-bg-sales: rgba(37, 99, 235, 0.18);
    --role-bg-channel: rgba(5, 150, 105, 0.18);
    --ch-purple-fg: #C4B5FD;
    --ch-purple-bg: rgba(124, 58, 237, 0.25);
    --notif-unread-bg: rgba(127, 29, 29, 0.25);
}

/* 提示条 */
[data-theme="dark"] .flash-success { color: #6EE7B7; }
[data-theme="dark"] .flash-danger  { color: #FCA5A5; }
[data-theme="dark"] .flash-warning { color: #FDE68A; }
[data-theme="dark"] .flash-info    { color: #93C5FD; }

/* 徽章 / 标签 */
[data-theme="dark"] .badge-project { color: #93C5FD; }
[data-theme="dark"] .badge-name { background: rgba(100, 116, 139, 0.25); }
[data-theme="dark"] .badge-admin { background: rgba(127, 29, 29, 0.4); color: #FCA5A5; }
[data-theme="dark"] .badge-user { background: rgba(37, 99, 235, 0.2); color: #93C5FD; }
[data-theme="dark"] .tag-good { color: #6EE7B7; }
[data-theme="dark"] .tag-warn { color: #FCA5A5; }

/* 卡片头 */
[data-theme="dark"] .card-header-live { background: #1E3A5F; color: #93C5FD; }
[data-theme="dark"] .card-header-video { background: #064E3B; color: #6EE7B7; }
[data-theme="dark"] .card-header-article { background: #4A1D0A; color: #FED7AA; }

/* 输入禁用态 */
[data-theme="dark"] .field-row input:disabled,
[data-theme="dark"] .field-row select:disabled,
[data-theme="dark"] .field-row textarea:disabled {
    background: rgba(9, 27, 63, 0.6);
}

/* OCR 上传区 / 缩略图 / 灯箱 */
[data-theme="dark"] .ocr-dropzone:hover,
[data-theme="dark"] .ocr-dropzone.dragover {
    background: rgba(46, 168, 255, 0.15);
    color: var(--color-primary-light);
}
[data-theme="dark"] .ocr-thumb { background: #16294A; }
[data-theme="dark"] .img-lightbox img { background: #1A3054; }

/* 汇总表 */
[data-theme="dark"] .summary-table tbody tr:hover { background: rgba(46, 168, 255, 0.10); }
[data-theme="dark"] .row-total { background: rgba(22, 56, 120, 0.38); }
[data-theme="dark"] .row-grand { background: rgba(198, 136, 42, 0.28); }
[data-theme="dark"] .project-sep td { background: rgba(59, 130, 246, 0.28) !important; }
[data-theme="dark"] .top-val { background: rgba(198, 136, 42, 0.28) !important; }

/* 排行榜 */
[data-theme="dark"] .rank-row:hover { background: rgba(46, 168, 255, 0.10); }
[data-theme="dark"] .rank-1 { background: rgba(198, 136, 42, 0.22); }
[data-theme="dark"] .rank-2,
[data-theme="dark"] .rank-3 { background: rgba(46, 168, 255, 0.08); }

/* 洞察卡 */
[data-theme="dark"] .insight-best  { color: #6EE7B7; }
[data-theme="dark"] .insight-good  { color: #93C5FD; }
[data-theme="dark"] .insight-star  { background: rgba(198, 136, 42, 0.25); color: #FDE68A; }
[data-theme="dark"] .insight-up    { background: rgba(5, 150, 105, 0.22); color: #6EE7B7; }
[data-theme="dark"] .insight-down  { color: #FCA5A5; }
[data-theme="dark"] .insight-info  { background: rgba(124, 58, 237, 0.25); color: #C4B5FD; }

/* 图表 */
[data-theme="dark"] .bar-bg { background: rgba(46, 168, 255, 0.15); }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }

/* 状态标签 */
[data-theme="dark"] .status-submitted { background: rgba(5, 150, 105, 0.22); color: #6EE7B7; }
[data-theme="dark"] .status-draft { background: rgba(100, 116, 139, 0.25); color: #CBD5E1; }
[data-theme="dark"] .status-missing { background: rgba(198, 136, 42, 0.2); color: #FDE68A; border: 1px dashed #FBBF24; }

/* 多场次直播 OCR */
[data-theme="dark"] .ocr-session { border: 1px solid var(--color-border); }
[data-theme="dark"] .ocr-session .session-label { background: rgba(37, 99, 235, 0.25); color: #93C5FD; }
[data-theme="dark"] .summary-card-title { color: #93C5FD; }
[data-theme="dark"] #sessionSummaryCard .records-table thead th { background: rgba(37, 99, 235, 0.25); color: #93C5FD; }
[data-theme="dark"] .btn-del-session { border: 1px solid rgba(46, 168, 255, 0.25); color: #7A9CC8; }
[data-theme="dark"] .btn-del-session:hover { background: rgba(220, 38, 38, 0.2); color: #FCA5A5; border-color: #F87171; }

/* 直播复盘 */
[data-theme="dark"] .session-review .review-label { color: #93C5FD; }
[data-theme="dark"] .session-review .review-text {
    color: #EAF4FF;
    background: #16294A;
    border: 1px solid rgba(46, 168, 255, 0.25);
}
[data-theme="dark"] .session-review .review-text:focus { border-color: #2EE6FF; }
[data-theme="dark"] .btn-copy-review {
    border: 1px solid rgba(46, 168, 255, 0.5);
    background: rgba(37, 99, 235, 0.2);
    color: #93C5FD;
}
[data-theme="dark"] .btn-copy-review:hover { background: #2563EB; }

/* ============================================================
   深色主题：主色改亮后，实心蓝底回退为深蓝（避免白字压在亮蓝上）
   ============================================================ */
/* 表头：柔和钢蓝底 + 浅色字，不再用纯蓝高亮块 */
[data-theme="dark"] .summary-table thead th,
[data-theme="dark"] .records-table thead th {
    background: #1E3A5F;
    color: #C7D9F0;
}
[data-theme="dark"] .ranking-table thead th {
    background: #1E3A5F;
    color: #C7D9F0;
}
/* 头像 / 实心蓝按钮与选中态：保持白字可读的深蓝 */
[data-theme="dark"] .anchor-avatar { background: #2B6CB0; }
[data-theme="dark"] .btn-primary { background: #2B6CB0; border-color: #2B6CB0; }
[data-theme="dark"] .btn-primary:hover { background: #3B82F6; border-color: #3B82F6; }
[data-theme="dark"] .section-nav-link:hover,
[data-theme="dark"] .section-nav-link.active { background: #2B6CB0; color: #fff; }
[data-theme="dark"] .nav-dropdown-link:hover { background: #2B6CB0; color: #fff; }
[data-theme="dark"] .tab-active { background: #2B6CB0; border-color: #2B6CB0; color: #fff; }
[data-theme="dark"] .float-nav button { background: #2B6CB0; }
