/* ═══════════════════════════════════════════════
   清核 EYE - FUI/HUD 暗红赛博蓝设计系统
   Dark Crimson & Cyber Blue & Gold Theme
   ═══════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    /* 主背景 - 深黑暖色调 */
    --bg-primary: #030508;
    --bg-secondary: #0a0e1a;
    --bg-card: rgba(15, 12, 22, 0.9);
    --bg-card-hover: rgba(25, 20, 35, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.015);

    /* 强调色 - 暗红与赛博蓝 + 金色 */
    --accent-crimson: #DC143C;
    --accent-red: #FF4D4D;
    --accent-neon-red: #FF2040;
    --accent-blue: #00E5FF;
    --accent-cyan: #00FFFF;
    --accent-gold: #FFD700;
    --accent-gold-light: #FFF6B8;
    --accent-gold-dark: #B8860B;
    --accent-green: #00e89d;
    --accent-orange: #ff9500;

    /* 渐变 */
    --gradient-gold: linear-gradient(180deg, #FFF6B8 0%, #FFD700 50%, #B8860B 100%);
    --gradient-crimson: linear-gradient(135deg, #DC143C 0%, #FF4D4D 100%);
    --gradient-cyber: linear-gradient(135deg, #00E5FF 0%, #0066FF 100%);
    --gradient-card: linear-gradient(135deg, rgba(220, 20, 60, 0.05) 0%, rgba(0, 229, 255, 0.04) 100%);
    --gradient-card-border: linear-gradient(135deg, rgba(220, 20, 60, 0.3), rgba(0, 229, 255, 0.2));

    /* 文字 - 高对比度 */
    --text-primary: #F0F4F8;
    --text-secondary: #b8ccd6;
    --text-muted: #6a8090;
    --text-accent: #00E5FF;
    --text-emphasis: #FF4D4D;

    /* 边框 */
    --border-color: rgba(220, 20, 60, 0.15);
    --border-glow: rgba(220, 20, 60, 0.4);
    --border-cyan: rgba(0, 229, 255, 0.25);

    /* 阴影 */
    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow-red: 0 0 25px rgba(220, 20, 60, 0.25);
    --shadow-glow-gold: 0 0 20px rgba(255, 215, 0, 0.2);
    --shadow-glow-cyan: 0 0 18px rgba(0, 229, 255, 0.15);

    /* 布局 */
    --sidebar-width: 240px;
    --top-bar-height: 68px;
    --border-radius: 4px;
    --border-radius-sm: 3px;

    /* 字体 */
    --font-main: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: radial-gradient(ellipse at 30% 50%, #0a0810 0%, #050308 40%, #020204 100%);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* 六边形网格背景纹理 + 赛博光效 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        /* 六边形网格纹理 */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23dc143c' fill-opacity='0.04'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
        /* 左侧暗红光晕 */
        radial-gradient(ellipse at 15% 50%, rgba(220, 20, 60, 0.06) 0%, transparent 50%),
        /* 右侧赛博蓝光晕 */
        radial-gradient(ellipse at 85% 30%, rgba(0, 229, 255, 0.04) 0%, transparent 50%),
        /* 底部金色微光 */
        radial-gradient(ellipse at 50% 95%, rgba(255, 215, 0, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* 扫描线效果 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 229, 255, 0.008) 2px,
            rgba(0, 229, 255, 0.008) 4px);
    pointer-events: none;
    z-index: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(220, 20, 60, 0.25);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(220, 20, 60, 0.4);
}

/* ═══════════════════════════════════════════════
   SIDEBAR - FUI风格侧边栏
   ═══════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, rgba(11, 16, 38, 0.95) 0%, rgba(5, 10, 20, 0.98) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

/* 侧边栏右侧发光边 */
.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(220, 20, 60, 0.5) 30%,
            rgba(255, 215, 0, 0.3) 50%,
            rgba(220, 20, 60, 0.5) 70%,
            transparent 100%);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 6px rgba(220, 20, 60, 0.4));
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.35rem;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
}

.logo-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    letter-spacing: 1px;
}

.nav-menu {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(220, 20, 60, 0.06);
    border-color: rgba(220, 20, 60, 0.15);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.12) 0%, rgba(0, 229, 255, 0.08) 100%);
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-glow-red), inset 0 0 30px rgba(220, 20, 60, 0.05);
}

/* HUD风格左侧指示条 */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    width: 3px;
    height: 70%;
    background: linear-gradient(180deg, #FFD700, #DC143C);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.25s ease;
}

.nav-item:hover .nav-label {
    color: var(--text-primary);
}

.nav-item.active .nav-label {
    color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 232, 157, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(0, 232, 157, 0);
    }
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.version {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.top-bar {
    height: var(--top-bar-height);
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(5, 10, 20, 0.85);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

/* 顶部栏底部发光线 */
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(220, 20, 60, 0.4) 20%,
            rgba(255, 215, 0, 0.3) 50%,
            rgba(0, 229, 255, 0.3) 80%,
            transparent 100%);
}

.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
}

.page-badge {
    font-size: 0.6rem;
    padding: 3px 10px;
    border-radius: 2px;
    background: var(--gradient-crimson);
    color: white;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.audit-info {
    text-align: right;
}

.audit-unit {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

.audit-period {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

/* ═══════════════════════════════════════════════
   LOADING - HUD风格加载
   ═══════════════════════════════════════════════ */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    gap: 20px;
}

.loading-screen p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.2);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 2px solid rgba(220, 20, 60, 0.2);
    border-top-color: var(--accent-crimson);
    border-right-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 15px rgba(220, 20, 60, 0.2);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════
   CARDS - 毛玻璃 HUD 卡片
   ═══════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    position: relative;
}

/* HUD角标装饰 */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--accent-crimson);
    border-left: 2px solid var(--accent-crimson);
    border-radius: var(--border-radius) 0 0 0;
    opacity: 0.6;
}

.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
    border-right: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 0 0 var(--border-radius) 0;
    opacity: 0.6;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(220, 20, 60, 0.2);
    box-shadow: var(--shadow-glow-red);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.2);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   KPI CARDS - 数据面板风格
   ═══════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-red);
    border-color: var(--border-glow);
}

/* 顶部发光条 */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.kpi-card.blue::before {
    background: linear-gradient(90deg, #00E5FF, #0066FF);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.kpi-card.green::before {
    background: linear-gradient(90deg, #00e89d, #00E5FF);
    box-shadow: 0 0 10px rgba(0, 232, 157, 0.4);
}

.kpi-card.red::before {
    background: var(--gradient-crimson);
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.4);
}

.kpi-card.purple::before {
    background: var(--gradient-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
}

/* 霓虹发光数值 */
.kpi-value.blue {
    color: var(--accent-blue);
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.6), 0 0 30px rgba(0, 229, 255, 0.25);
}

.kpi-value.green {
    color: var(--accent-green);
    text-shadow: 0 0 15px rgba(0, 232, 157, 0.6), 0 0 30px rgba(0, 232, 157, 0.25);
}

.kpi-value.red {
    color: var(--accent-red);
    text-shadow: 0 0 15px rgba(255, 77, 77, 0.6), 0 0 30px rgba(255, 77, 77, 0.25);
}

.kpi-value.purple {
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.25);
}

.kpi-change {
    font-size: 0.8rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.kpi-change.positive {
    color: var(--accent-green);
    text-shadow: 0 0 6px rgba(0, 232, 157, 0.3);
}

.kpi-change.negative {
    color: var(--accent-red);
    text-shadow: 0 0 6px rgba(255, 77, 77, 0.3);
}

/* ═══════════════════════════════════════════════
   DASHBOARD CHARTS GRID
   ═══════════════════════════════════════════════ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-container {
    width: 100%;
    height: 360px;
}

.charts-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════
   RISK GAUGE
   ═══════════════════════════════════════════════ */
.risk-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.risk-score-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.risk-score-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════
   BENFORD PAGE
   ═══════════════════════════════════════════════ */
.benford-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.benford-chart-area {
    min-height: 400px;
}

.benford-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-blue);
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 600;
}

.verdict-badge.high {
    background: rgba(255, 77, 77, 0.15);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--accent-red);
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.15);
}

.verdict-badge.medium {
    background: rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.3);
    color: var(--accent-orange);
}

.verdict-badge.low {
    background: rgba(0, 232, 157, 0.15);
    border: 1px solid rgba(0, 232, 157, 0.3);
    color: var(--accent-green);
}

.ai-interpretation {
    margin-top: 24px;
}

.ai-interpretation .card {
    position: relative;
}

.ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--gradient-crimson);
    color: white;
    box-shadow: 0 0 8px rgba(220, 20, 60, 0.3);
    letter-spacing: 0.5px;
}

.interpretation-content {
    margin-top: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.interpretation-content p {
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════
   ANOMALY PAGE
   ═══════════════════════════════════════════════ */
.anomaly-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.anomaly-summary-card {
    text-align: center;
    padding: 24px;
}

.anomaly-summary-number {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    text-shadow: 0 0 12px rgba(255, 77, 77, 0.4);
}

.anomaly-summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.anomaly-chart-container {
    margin-bottom: 24px;
}

.anomaly-list {
    margin-top: 16px;
}

.anomaly-item {
    display: grid;
    grid-template-columns: 40px 100px 1fr 120px 100px;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.anomaly-item:hover {
    background: rgba(220, 20, 60, 0.04);
}

.anomaly-severity-icon {
    font-size: 1.4rem;
    text-align: center;
}

.anomaly-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.anomaly-desc {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.anomaly-desc-main {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.anomaly-desc-type {
    font-size: 0.7rem;
    color: var(--accent-orange);
    font-weight: 500;
}

.anomaly-amount {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-red);
    text-align: right;
    text-shadow: 0 0 8px rgba(255, 77, 77, 0.3);
}

.anomaly-severity-tag {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 2px;
    text-align: center;
    font-weight: 500;
}

.anomaly-severity-tag.high {
    background: rgba(255, 77, 77, 0.15);
    color: var(--accent-red);
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.15);
}

.anomaly-severity-tag.medium {
    background: rgba(255, 149, 0, 0.15);
    color: var(--accent-orange);
}

.anomaly-list-header {
    display: grid;
    grid-template-columns: 40px 100px 1fr 120px 100px;
    gap: 16px;
    padding: 10px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════
   CHAT PAGE
   ═══════════════════════════════════════════════ */
.chat-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--top-bar-height) - 48px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-message.ai .chat-avatar {
    background: var(--gradient-crimson);
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

.chat-message.user .chat-avatar {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.chat-bubble {
    padding: 14px 18px;
    border-radius: 4px;
    line-height: 1.7;
    font-size: 0.9rem;
}

.chat-message.ai .chat-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top-left-radius: 0;
    color: var(--text-secondary);
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.2), rgba(0, 229, 255, 0.1));
    border: 1px solid rgba(220, 20, 60, 0.3);
    color: var(--text-primary);
    border-top-right-radius: 0;
}

.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3 {
    color: var(--accent-gold);
    margin: 12px 0 8px;
    font-size: 1rem;
}

.chat-bubble ul,
.chat-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.chat-bubble li {
    margin: 4px 0;
}

.chat-bubble strong {
    color: var(--text-primary);
}

.chat-input-area {
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
}

.quick-questions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 8px 14px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-main);
}

.quick-btn:hover {
    background: rgba(220, 20, 60, 0.08);
    border-color: var(--border-glow);
    color: var(--accent-red);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.25s;
}

.chat-input:focus {
    border-color: var(--accent-crimson);
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.15), 0 0 12px rgba(220, 20, 60, 0.1);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    background: var(--gradient-crimson);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-main);
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(220, 20, 60, 0.3);
}

.chat-send-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(220, 20, 60, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-crimson);
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════
   REPORT PAGE
   ═══════════════════════════════════════════════ */
.report-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.btn {
    padding: 10px 24px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-main);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(220, 20, 60, 0.2);
}

.btn-primary {
    background: var(--gradient-crimson);
    border-color: transparent;
    color: white;
    font-weight: 600;
    box-shadow: 0 0 12px rgba(220, 20, 60, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(220, 20, 60, 0.4);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.report-content {
    line-height: 1.9;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.report-content h1 {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin: 28px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-crimson);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.report-content h2 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.report-content h3 {
    font-size: 1rem;
    color: var(--accent-blue);
    margin: 16px 0 8px;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.2);
}

.report-content p {
    margin-bottom: 12px;
}

.report-content ul,
.report-content ol {
    padding-left: 24px;
    margin-bottom: 12px;
}

.report-content li {
    margin-bottom: 6px;
}

.report-content strong {
    color: var(--accent-red);
    text-shadow: 0 0 4px rgba(255, 77, 77, 0.2);
}

.report-placeholder {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.report-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.report-placeholder-text {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.report-placeholder-detail {
    font-size: 0.8rem;
}

/* Progress bar */
.progress-bar-container {
    margin: 24px 0;
    display: none;
}

.progress-bar-container.active {
    display: block;
}

.progress-bar-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    height: 3px;
    border-radius: 2px;
    background: var(--border-color);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gradient-crimson);
    transition: width 0.5s ease;
    width: 0%;
    box-shadow: 0 0 8px rgba(220, 20, 60, 0.4);
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-in-delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.animate-in-delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

.animate-in-delay-3 {
    animation-delay: 0.3s;
    opacity: 0;
}

.animate-in-delay-4 {
    animation-delay: 0.4s;
    opacity: 0;
}

/* Page transition */
.page-transition-enter {
    animation: pageEnter 0.3s ease forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Pulse for anomalies - 红色呼吸灯 */
@keyframes pulse-red {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(220, 20, 60, 0);
    }
}

.pulse-anomaly {
    animation: pulse-red 2s infinite;
}

.counter-animate {
    transition: all 0.6s ease;
}

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.gap-16 {
    gap: 16px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Chat welcome */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.chat-welcome-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    background: var(--gradient-crimson);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-welcome h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Deviation bars */
.deviation-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deviation-bar {
    height: 6px;
    border-radius: 3px;
    min-width: 2px;
}

.deviation-bar.positive {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(255, 77, 77, 0.3);
}

.deviation-bar.negative {
    background: var(--accent-green);
}

.deviation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.deviation-table th {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.deviation-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    color: var(--accent-blue);
}

/* ═══════════════════════════════════════════════
   YEAR FILTER - HUD模式切换
   ═══════════════════════════════════════════════ */
.year-filter {
    display: flex;
    gap: 2px;
    background: rgba(11, 16, 38, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 2px;
    position: relative;
}

.year-filter::before {
    content: '[ PERIOD ]';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.year-btn {
    padding: 6px 16px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 2px;
    letter-spacing: 0.5px;
    position: relative;
}

.year-btn:hover {
    color: var(--text-primary);
    background: rgba(220, 20, 60, 0.08);
    border-color: rgba(220, 20, 60, 0.2);
}

.year-btn.active {
    color: var(--accent-gold);
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.15), rgba(255, 215, 0, 0.1));
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.15), inset 0 0 12px rgba(220, 20, 60, 0.05);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* ═══════════════════════════════════════════════
   ENHANCED SCI-FI EFFECTS
   ═══════════════════════════════════════════════ */

/* 侧边栏呼吸光效 */
@keyframes sidebar-glow {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.sidebar::after {
    animation: sidebar-glow 4s ease-in-out infinite;
}

/* 顶部栏静态装饰光效 */
@keyframes top-bar-breathe {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.7;
    }
}

.top-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    animation: top-bar-breathe 4s ease-in-out infinite;
    z-index: 2;
}

/* KPI数值脉冲发光 */
@keyframes neon-pulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.15);
    }
}

.kpi-value {
    animation: neon-pulse 3s ease-in-out infinite;
}

/* 卡片悬浮增强 - 红色边框光效 */
.card:hover::before {
    border-color: var(--accent-crimson);
    opacity: 1;
    box-shadow: -2px -2px 8px rgba(220, 20, 60, 0.15);
}

.card:hover::after {
    border-color: var(--accent-blue);
    opacity: 1;
    box-shadow: 2px 2px 8px rgba(0, 229, 255, 0.15);
}

/* KPI卡片 - 悬浮时光标底座效果 */
.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover::after {
    opacity: 1;
}

/* 金色标题呼吸动画 */
@keyframes gold-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
    }
}

.logo-title {
    animation: gold-glow 4s ease-in-out infinite;
}

/* 异常数字动态闪烁 */
@keyframes data-flash {

    0%,
    90%,
    100% {
        opacity: 1;
    }

    95% {
        opacity: 0.7;
    }
}

.anomaly-summary-number {
    animation: data-flash 5s ease-in-out infinite;
}

/* HUD风格边角 - 增强卡片角标 */
.kpi-card {
    position: relative;
}

.kpi-card .kpi-value::after {
    content: '';
    display: block;
    margin-top: 4px;
    width: 30px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-crimson), transparent);
    opacity: 0.5;
}

/* 页面badge脉冲 */
@keyframes badge-pulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(220, 20, 60, 0.5);
    }
}

.page-badge {
    animation: badge-pulse 3s ease-in-out infinite;
}

/* 状态点增强 */
.status-dot {
    box-shadow: 0 0 6px rgba(0, 232, 157, 0.6);
}

/* 审计单位名称增强 */
.audit-unit {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .benford-layout {
        grid-template-columns: 1fr;
    }

    .anomaly-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .year-filter {
        gap: 1px;
    }

    .year-btn {
        padding: 4px 10px;
        font-size: 0.65rem;
    }
}

/* ═══════════════════════════════════════════════
   CASES MODULE - 审计案例库
   ═══════════════════════════════════════════════ */
.cases-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    text-align: center;
}

.cases-stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.cases-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.cases-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 20px 0;
}

.case-filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.case-filter-btn:hover {
    color: var(--text-primary);
    border-color: rgba(220, 20, 60, 0.3);
    background: rgba(220, 20, 60, 0.06);
}

.case-filter-btn.active {
    color: var(--accent-gold);
    border-color: rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.12), rgba(255, 215, 0, 0.08));
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.case-card {
    padding: 18px 20px !important;
    transition: all 0.3s ease;
}

.case-card:hover {
    transform: translateY(-2px);
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.case-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

.case-risk-tag {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 2px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.case-title {
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 10px;
    font-weight: 500;
}

.case-category-tag {
    font-size: 0.72rem;
    color: var(--accent-blue);
    padding: 2px 8px;
    border: 1px solid var(--border-cyan);
    border-radius: 2px;
    display: inline-block;
}

.cases-footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Welcome tags for compliance assistant */
.chat-welcome-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.welcome-tag {
    font-size: 0.75rem;
    padding: 4px 12px;
    border: 1px solid var(--border-cyan);
    border-radius: 3px;
    color: var(--accent-blue);
    background: rgba(0, 229, 255, 0.05);
}

/* =========================================================================
   Login Overlay
   ========================================================================= */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000511;
    /* fallback */
    background: var(--bg-1, #000511);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-box {
    background: rgba(10, 25, 47, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 4rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(220, 20, 60, 0.1);
    max-width: 450px;
    width: 90%;
    backdrop-filter: blur(10px);
}

.login-box h2 {
    color: var(--text-1);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-box p {
    color: var(--text-2);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.login-input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    color: var(--text-1);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    text-align: center;
    letter-spacing: 2px;
    box-sizing: border-box;
}

.login-input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.2);
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.login-error {
    color: var(--primary-color);
    font-size: 0.875rem;
    margin-top: 1rem;
    min-height: 20px;
}

/* =========================================================================
   Mobile Hamburger Menu Button (hidden on desktop)
   ========================================================================= */
.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--accent-gold);
    font-size: 1.4rem;
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    flex-shrink: 0;
}

/* Sidebar overlay for mobile (hidden on desktop) */
.sidebar-overlay {
    display: none;
}

/* =========================================================================
   RESPONSIVE — Mobile (≤768px)
   ========================================================================= */
@media (max-width: 768px) {

    /* --- Body --- */
    body {
        overflow: auto;
    }

    /* --- Sidebar: hidden by default, slide-in overlay --- */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Dark overlay behind sidebar */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* --- Main content: full width --- */
    .main-content {
        margin-left: 0;
        height: auto;
        min-height: 100vh;
    }

    /* --- Top bar --- */
    .top-bar {
        height: auto;
        min-height: 50px;
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .top-bar::after {
        left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .page-title h1 {
        font-size: 1.1rem;
    }

    .page-badge {
        font-size: 0.5rem;
        padding: 2px 6px;
    }

    .top-bar-right {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }

    .year-filter {
        order: -1;
    }

    .year-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .audit-info {
        font-size: 0.7rem;
    }

    .audit-unit {
        font-size: 0.72rem;
    }

    .audit-period {
        font-size: 0.6rem;
    }

    /* --- Page container --- */
    .page-container {
        padding: 12px;
    }

    /* --- KPI Grid: 2 columns, smaller numbers --- */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 14px 12px;
    }

    .kpi-label {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .kpi-value {
        font-size: 1rem;
        letter-spacing: -1px;
        overflow-wrap: break-word;
    }

    .kpi-change {
        font-size: 0.65rem;
        margin-top: 4px;
    }

    /* --- Charts Grid: single column --- */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    .charts-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    .chart-container {
        height: 260px;
    }

    /* --- Card padding --- */
    .card {
        padding: 14px;
    }

    .card-header {
        margin-bottom: 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .card-subtitle {
        font-size: 0.7rem;
    }

    /* --- Benford Layout: stack --- */
    .benford-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .benford-chart-area {
        min-height: 280px;
    }

    .stat-item {
        padding: 8px 0;
    }

    .stat-label {
        font-size: 0.78rem;
    }

    .stat-value {
        font-size: 0.85rem;
    }

    /* --- Anomaly Page --- */
    .anomaly-summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .anomaly-summary-card {
        padding: 16px;
    }

    .anomaly-summary-number {
        font-size: 1.8rem;
    }

    .anomaly-item {
        grid-template-columns: 30px 1fr;
        gap: 8px;
        padding: 10px 12px;
    }

    .anomaly-date,
    .anomaly-amount,
    .anomaly-severity-tag {
        grid-column: 2;
        text-align: left;
    }

    .anomaly-desc {
        grid-column: 2;
    }

    .anomaly-amount {
        font-size: 0.8rem;
    }

    /* --- Report Page --- */
    .report-section {
        padding: 16px;
    }

    /* --- Cases / Risk Map --- */
    .cases-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cases-filter-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .case-filter-btn {
        font-size: 0.7rem;
        padding: 4px 10px;
    }

    .cases-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* --- Chat page --- */
    .chat-container {
        height: calc(100vh - 120px);
    }

    .chat-input-area {
        padding: 8px;
    }

    .chat-input-area textarea {
        font-size: 0.85rem;
    }

    /* --- Login overlay --- */
    .login-box {
        padding: 2rem 1.5rem;
    }

    .login-box h2 {
        font-size: 1.2rem;
    }
}

/* =========================================================================
   RESPONSIVE — Small phones (≤400px)
   ========================================================================= */
@media (max-width: 400px) {

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.4rem;
    }

    .cases-stats-grid {
        grid-template-columns: 1fr;
    }

    .top-bar-right {
        width: 100%;
    }
}