/* ====================================================================
   Twitch Bot Detection Dashboard — Style System
   ====================================================================
   Premium dark-mode design with glassmorphism, smooth gradients,
   and micro-animations. Color palette inspired by Twitch's brand
   but adapted for a forensic/analytical dashboard aesthetic.
   ==================================================================== */

/* ── Design Tokens ─────────────────────────────────────────────────── */
:root {
    /* Base palette */
    --bg-primary: #0a0b0f;
    --bg-secondary: #12141c;
    --bg-card: #161821;
    --bg-elevated: #1c1f2e;
    --bg-glass: rgba(22, 24, 33, 0.65);

    /* Accent palette */
    --accent-purple: #9147ff;
    --accent-violet: #772ce8;
    --accent-blue: #1e90ff;
    --accent-cyan: #00c8ff;
    --accent-green: #00e676;
    --accent-yellow: #ffd600;
    --accent-orange: #ff9100;
    --accent-red: #ff1744;

    /* Gradients */
    --gradient-purple: linear-gradient(135deg, #9147ff 0%, #5c16c5 100%);
    --gradient-glow: linear-gradient(135deg, rgba(145, 71, 255, 0.15) 0%, rgba(0, 200, 255, 0.08) 100%);
    --gradient-danger: linear-gradient(135deg, #ff1744 0%, #d50000 100%);
    --gradient-safe: linear-gradient(135deg, #00e676 0%, #00c853 100%);

    /* Text */
    --text-primary: #e8eaf0;
    --text-secondary: #9399b2;
    --text-muted: #5a5f78;
    --text-accent: #b49aff;

    /* Borders */
    --border-subtle: rgba(147, 153, 178, 0.08);
    --border-card: rgba(147, 153, 178, 0.06);
    --border-glow: rgba(145, 71, 255, 0.25);

    /* Shadows */
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(145, 71, 255, 0.15);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

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

    /* Animation */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ambient background glow */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(145, 71, 255, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(0, 200, 255, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(147, 153, 178, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 153, 178, 0.35);
}

/* ── Global Layout ─────────────────────────────────────────────────── */
.dashboard-wrapper {
    width: 100%;
    position: relative;
}

/* ── Metrics Grid (Sticky Oversight) ───────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    padding: 12px 24px;
    position: sticky;
    top: 64px;
    /* Sits below app-header */
    z-index: 50;
    background: rgba(10, 11, 15, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}

/* ── Forensics Stack (VH Scaling) ──────────────────────────────────── */
.forensics-stack {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 12px 24px 0;
}

.forensics-stack .chart-panel {
    width: 100%;
}

.forensics-stack .chart-container {
    height: 25vh;
    min-height: 220px;
}

/* ── Analytical Footer Grid ────────────────────────────────────────── */
.analytical-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 24px;
}

.analytical-footer .chart-panel,
.analytical-footer .panel {
    height: 360px;
    /* Consistent height for footer row */
    display: flex;
    flex-direction: column;
}

/* ── Maximized State (Global) ─────────────────────────────────────── */
.chart-panel.maximized,
.panel.maximized {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    width: auto !important;
    height: calc(100vh - 40px) !important;
    max-height: none !important;
    z-index: 100000 !important;
    background: var(--bg-card) !important;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9) !important;
    border: 1px solid var(--accent-purple) !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    transform: none !important;
}

#panel-users.maximized {
    max-width: 550px;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.panel.maximized .user-list,
.panel.maximized .chat-feed,
.panel.maximized .event-log {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

/* ── Chat Feed Forensic Styling ────────────────────────────────────── */
.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-msg {
    line-height: 1.4;
    padding: 2px 0;
    word-break: break-word;
}

.chat-msg.is-bot {
    background: rgba(255, 23, 68, 0.05);
    border-radius: 4px;
}

.chat-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-right: 6px;
    font-family: var(--font-mono);
}

.chat-user {
    font-weight: 700;
}

.chat-text {
    color: var(--text-primary);
}

.chat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

/* ── Header ────────────────────────────────────────────────────────── */


.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gradient-purple);
    border-radius: var(--radius-md);
    color: #fff;
    box-shadow: 0 0 20px rgba(145, 71, 255, 0.3);
}

.header-titles h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #e8eaf0, #b49aff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.channel-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-purple);
    background: rgba(145, 71, 255, 0.1);
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(145, 71, 255, 0.2);
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.connection-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-yellow);
    animation: pulse-dot 2s ease-in-out infinite;
}

.connection-indicator.connected .dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

.connection-indicator.disconnected .dot {
    background: var(--accent-red);
    animation: none;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.uptime-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.uptime-badge .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.uptime-badge .value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Tooltip Toggle Switch ─────────────────────────────────────────── */
.tooltip-toggle,
.diagnostic-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}

.toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-muted);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-purple);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--accent-purple);
}

input:checked+.slider:before {
    transform: translateX(14px);
}

.slider.round {
    border-radius: 18px;
}

.slider.round:before {
    border-radius: 50%;
}

.global-banners {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* ── Quarantine Banner ─────────────────────────────────────────── */
.quarantine-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 24px 0;
    padding: 12px 24px;
    background: rgba(255, 145, 0, 0.1);
    border: 1px solid rgba(255, 145, 0, 0.25);
    border-radius: var(--radius-lg);
    color: var(--accent-orange);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(255, 145, 0, 0.05);
    animation: fadeInDown 0.5s var(--ease-out-expo);
}

.quarantine-banner.hidden {
    display: none;
}

.quarantine-banner .banner-icon {
    font-size: 1.1rem;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Pristine Banner ─────────────────────────────────────────── */
.pristine-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 24px 0;
    padding: 12px 24px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.25);
    border-radius: var(--radius-lg);
    color: var(--accent-green);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.05);
    animation: fadeInDown 0.5s var(--ease-out-expo);
}

.pristine-banner.hidden {
    display: none;
}

.pristine-banner .banner-icon {
    font-size: 1.1rem;
}

/* ── Suspicion Banner ──────────────────────────────────────────────── */
.suspicion-banner {
    display: flex;
    align-items: center;
    gap: 32px;
    margin: 20px 24px 0;
    padding: 24px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.suspicion-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-glow);
    opacity: 0.5;
    pointer-events: none;
}

.suspicion-gauge {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.gauge-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(147, 153, 178, 0.08);
    stroke-width: 8;
}

.gauge-fill {
    fill: none;
    stroke: var(--accent-green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 1.2s var(--ease-out-expo), stroke 0.6s ease;
    filter: drop-shadow(0 0 6px currentColor);
}

.gauge-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.gauge-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.level-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-green);
    transition: color 0.6s ease;
}

.level-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.suspicion-reasons {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
    max-height: 100px;
    overflow-y: auto;
}

.reason-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-orange);
    animation: fadeSlideIn 0.3s var(--ease-out-expo);
}

.reason-item .reason-icon {
    flex-shrink: 0;
}

.reason-placeholder {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Metric Cards ──────────────────────────────────────────────────── */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s ease, border-color 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
    border-color: var(--border-glow);
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-purple);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover::after {
    opacity: 1;
}

.metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: rgba(145, 71, 255, 0.08);
    color: var(--accent-purple);
    flex-shrink: 0;
}

.metric-body {
    flex: 1;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.metric-trend {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-trend.rising {
    color: var(--accent-green);
}

.metric-trend.falling {
    color: var(--accent-red);
}

.metric-trend.stable {
    color: var(--accent-cyan);
}

.metric-trend .trend-arrow {
    font-size: 1.1rem;
}

.metric-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.health-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
}

.health-dot.warning {
    background: var(--accent-orange);
}

.health-dot.danger {
    background: var(--accent-red);
}

.health-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.engagement-bar {
    flex: 1;
    height: 4px;
    background: rgba(147, 153, 178, 0.1);
    border-radius: 2px;
    overflow: hidden;
    max-width: 80px;
}

.bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--gradient-purple);
    border-radius: 2px;
    transition: width 1s var(--ease-out-expo);
}

.engagement-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Bot Estimate Card ────────────────────────────────────────────── */
.bot-estimate-card .metric-icon.bot-icon {
    background: rgba(255, 23, 68, 0.08);
    color: var(--accent-red);
}

.bot-estimate-card .metric-value {
    color: var(--accent-orange);
}

.bot-estimate-card:hover::after {
    background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-orange) 100%);
}

.confidence-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.confidence-badge.low {
    background: rgba(147, 153, 178, 0.1);
    color: var(--text-muted);
}

.confidence-badge.medium {
    background: rgba(255, 214, 0, 0.12);
    color: var(--accent-yellow);
}

.confidence-badge.high {
    background: rgba(255, 23, 68, 0.12);
    color: var(--accent-red);
    animation: pulse-badge 2s ease-in-out infinite;
}

.confidence-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 0.85;
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(255, 23, 68, 0.25);
    }
}

.bot-estimate-card.bot-warning {
    border-color: rgba(255, 145, 0, 0.25);
    box-shadow: var(--shadow-card), 0 0 20px rgba(255, 145, 0, 0.08);
}

.bot-estimate-card.bot-severe {
    border-color: rgba(255, 23, 68, 0.25);
    box-shadow: var(--shadow-card), 0 0 25px rgba(255, 23, 68, 0.1);
}

.bot-estimate-card.bot-severe .metric-value {
    color: var(--accent-red);
}

/* ── Charts Section ────────────────────────────────────────────────── */

.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
}

.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: rgba(145, 71, 255, 0.1);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s var(--ease-out-expo), visibility 1s;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-logo {
    animation: pulse-glow 2.5s infinite ease-in-out;
}

.loader-text {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.loader-progress {
    width: 240px;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1px;
    overflow: hidden;
}

.loader-bar {
    width: 35%;
    height: 100%;
    background: var(--accent-purple);
    animation: loader-slide 1.8s infinite cubic-bezier(0.65, 0, 0.35, 1);
    box-shadow: 0 0 20px var(--accent-purple);
}

@keyframes pulse-glow {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(145, 71, 255, 0.2));
    }

    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 25px rgba(145, 71, 255, 0.5));
    }
}

@keyframes loader-slide {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(300%);
    }
}

.chart-panel.maximized {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 85vh;
    z-index: 10000;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9);
}

.chart-panel.maximized .expand-btn {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}

.chart-panel.maximized .chart-container {
    flex: 1 !important;
    height: 100% !important;
}

.chart-panel.maximized .panel-header {
    padding: 20px 32px;
}

/* Gravity Well Focus Mode (Maximized) */
#gravity-well-panel.maximized .gravity-well-body {
    height: calc(100% - 65px) !important;
}

#gravity-well-panel.maximized #clique-inspector-panel {
    display: none; /* Hide the list to focus on the orbits */
}

#gravity-well-panel.maximized #gravity-well-container {
    flex: 0 0 100% !important;
    width: 100% !important;
}

#gravity-well-panel.maximized .gravity-controls {
    right: 24px !important;
    top: 24px !important;
}


/* ── Measurement Overlay ────────────────────────────────────────────── */
.measurement-overlay {
    position: fixed;
    top: 80px;
    right: 40px;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    z-index: 25000;
    pointer-events: none;
    display: none;
    box-shadow: var(--shadow-elevated);
    animation: fadeIn 0.2s ease;
}

.measurement-overlay.active {
    display: block;
}

/* ── Combined Forensic Panel ────────────────────────────────────────── */
.measurement-overlay.combined-panel {
    min-width: 280px;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--accent-purple);
    background: rgba(18, 20, 28, 0.95);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.overlay-header h4 {
    margin: 0;
    font-size: 0.85rem;
}

.duration-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent-purple);
    padding: 2px 8px;
    border-radius: 4px;
}

.overlay-grid-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.measurement-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.measurement-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.measurement-delta {
    font-family: var(--font-mono);
    font-weight: 700;
}

.measurement-delta small {
    font-size: 0.65rem;
    opacity: 0.8;
}

.measurement-current {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.measurement-delta.positive {
    color: var(--accent-green);
}

.measurement-delta.negative {
    color: var(--accent-red);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-controls {
    display: flex;
    gap: 4px;
}

.time-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-glow);
}

.time-btn.active {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}

.diagnostic-mode .debug-overlay,
.diagnostic-mode #sync-container,
.diagnostic-mode #db-stats {
    display: block !important;
}

#db-stats {
    display: none;
}

.chart-container {
    padding: 16px 20px 20px;
    height: 300px;
    position: relative;
    transition: background-color 0.3s ease, border 0.3s ease;
}


.diagnostic-mode .chart-container {
    background-color: rgba(255, 0, 0, 0.05);
    /* Forensic Visibility Guard */
    border: 1px dashed rgba(255, 0, 0, 0.2);
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Bottom Section ────────────────────────────────────────────────── */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px 24px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-stats {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ── Forensic Event Log ────────────────────────────────────────────── */
.event-log {
    flex: 1;
    max-height: 360px;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: eventSlideIn 0.3s var(--ease-out-expo);
    transition: all 0.2s ease;
    border-left: 4px solid var(--accent-orange);
}

.event-card.cliff-drop {
    border-left-color: var(--accent-red);
}

.event-card.is-labeled {
    opacity: 0.6;
    pointer-events: none;
    border-left-color: var(--accent-green);
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-channel {
    font-weight: 700;
    color: var(--accent-purple);
    font-size: 0.9rem;
}

.event-timestamp {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.event-trigger {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.event-snapshot {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}

.snapshot-item {
    display: flex;
    flex-direction: column;
}

.snapshot-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.snapshot-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.event-actions {
    display: flex;
    gap: 8px;
}

.label-btn {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 0;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.label-btn.confirm {
    background: rgba(255, 23, 68, 0.15);
    color: #ff5252;
    border-color: rgba(255, 23, 68, 0.3);
}

.label-btn.confirm:hover {
    background: rgba(255, 23, 68, 0.25);
}

.label-btn.false-positive {
    background: rgba(30, 144, 255, 0.15);
    color: #448aff;
    border-color: rgba(30, 144, 255, 0.3);
}

.label-btn.false-positive:hover {
    background: rgba(30, 144, 255, 0.25);
}

@keyframes eventSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── User List ─────────────────────────────────────────────────────── */
.user-list {
    flex: 1;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 16px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.user-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.user-rank {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.user-rank.top-3 {
    color: var(--accent-yellow);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-badges {
    display: flex;
    gap: 4px;
}

.user-badge {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-badge.sub {
    background: rgba(0, 200, 255, 0.12);
    color: var(--accent-cyan);
}

.user-badge.mod {
    background: rgba(0, 230, 118, 0.12);
    color: var(--accent-green);
}

.user-badge.vip {
    background: rgba(228, 16, 127, 0.15);
    color: #ff69b4;
}

.user-msg-count {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-left: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.user-msg-bar {
    margin-left: auto;
    width: 60px;
    height: 4px;
    background: rgba(147, 153, 178, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.user-msg-bar-fill {
    height: 100%;
    background: var(--gradient-purple);
    border-radius: 2px;
    transition: width 0.6s var(--ease-out-expo);
}

.user-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ── User Stats Grid ───────────────────────────────────────────────── */
.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    border-top: 1px solid var(--border-subtle);
    background: var(--border-subtle);
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-card);
}

.mini-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mini-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin-top: 2px;
}

/* ── Footer ────────────────────────────────────────────────────────── */
#app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

.footer-sep {
    color: rgba(147, 153, 178, 0.2);
}

/* ── Suspicion-level color overrides ───────────────────────────────── */
.suspicion-low .gauge-fill {
    stroke: var(--accent-green);
}

.suspicion-low .level-text {
    color: var(--accent-green);
}

.suspicion-moderate .gauge-fill {
    stroke: var(--accent-yellow);
}

.suspicion-moderate .level-text {
    color: var(--accent-yellow);
}

.suspicion-high .gauge-fill {
    stroke: var(--accent-orange);
}

.suspicion-high .level-text {
    color: var(--accent-orange);
}

.suspicion-critical .gauge-fill {
    stroke: var(--accent-red);
}

.suspicion-critical .level-text {
    color: var(--accent-red);
}

/* Glow effect on banner at high suspicion */
.suspicion-critical .suspicion-banner {
    border-color: rgba(255, 23, 68, 0.25);
    box-shadow: var(--shadow-card), 0 0 40px rgba(255, 23, 68, 0.1);
}

.suspicion-high .suspicion-banner {
    border-color: rgba(255, 145, 0, 0.2);
    box-shadow: var(--shadow-card), 0 0 30px rgba(255, 145, 0, 0.08);
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .bottom-section {
        grid-template-columns: 1fr;
    }

    .suspicion-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    #app-header {
        padding: 10px 16px;
    }

    .suspicion-banner {
        margin: 12px 12px 0;
        padding: 16px;
    }

    .metrics-grid {
        padding: 12px 12px 0;
    }

    .charts-section {
        padding: 12px 12px 0;
    }

    .bottom-section {
        padding: 12px;
    }

    .user-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .channel-tabs {
        padding: 0 12px;
    }
}

/* ── Channel Tabs ──────────────────────────────────────────────────── */
.channel-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px 0;
    overflow-x: auto;
    position: relative;
    z-index: 10;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s var(--ease-out-expo);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-glow);
    background: var(--bg-elevated);
}

.tab-btn.active {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
    box-shadow: 0 0 16px rgba(145, 71, 255, 0.25);
}

.tab-btn .tab-score {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
}

.tab-btn.active .tab-score {
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn .tab-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: pulse-dot 2s ease-in-out infinite;
}

.tab-btn .tab-live-dot.offline {
    background: var(--text-muted);
    animation: none;
}

.compare-tab {
    border-style: dashed;
    color: var(--text-muted);
}

.compare-tab:hover {
    color: var(--text-primary);
}

.compare-tab.active {
    border-style: solid;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(0, 200, 255, 0.15);
}

.offline-toggle-btn {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 4px;
}

.offline-toggle-btn:hover {
    background: rgba(145, 71, 255, 0.05);
    color: var(--text-secondary);
}

.offline-toggle-btn.active {
    background: rgba(145, 71, 255, 0.1);
    color: var(--accent-purple);
    border-style: solid;
    border-color: rgba(145, 71, 255, 0.3);
}

.offline-tab {
    opacity: 0.6;
    filter: grayscale(0.8) brightness(0.8);
    background: rgba(255, 255, 255, 0.01);
}

.offline-tab:hover,
.offline-tab.active {
    opacity: 1;
    filter: grayscale(0) brightness(1);
}

.offline-tab.active {
    background: var(--accent-purple);
    filter: none;
}

/* ── Bot Row Forensic Styling ───────────────────────────────────────── */
.user-row.bot-row .user-name {
    color: var(--accent-red) !important;
    text-decoration: none;
    opacity: 1;
}

.user-row.bot-row .user-avatar {
    background: rgba(255, 23, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255, 23, 68, 0.3);
}

.user-badge.bot {
    background: rgba(255, 23, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.2);
}

/* ── Comparison View ───────────────────────────────────────────────── */
.comparison-view {
    padding: 0 24px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px 0 0;
}

.compare-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-out-expo), border-color 0.3s ease;
}

.compare-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
}

.compare-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-purple);
}

.compare-card.suspicion-high::before {
    background: var(--gradient-danger);
}

.compare-card.suspicion-low::before {
    background: var(--gradient-safe);
}

.compare-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.compare-card-channel {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.compare-card-score {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 800;
}

.compare-card-score.low {
    color: var(--accent-green);
}

.compare-card-score.moderate {
    color: var(--accent-yellow);
}

.compare-card-score.high {
    color: var(--accent-orange);
}

.compare-card-score.critical {
    color: var(--accent-red);
}

.compare-card-level {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.compare-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compare-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.compare-metric-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.compare-metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.comparison-view .charts-section {
    padding: 20px 0;
}

.radar-container {
    padding: 12px 16px 16px;
}

/* -- Forensic Evidence Modal ------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 6, 8, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: all 0.4s var(--ease-out-expo);
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 120px rgba(0, 0, 0, 0.8);
    animation: modalSlideUp 0.5s var(--ease-spring);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#app-header {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid rgba(145, 71, 255, 0.4);
    animation: logo-bounce 4s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    background: transparent;
    box-shadow: 0 0 20px rgba(145, 71, 255, 0.15);
}

.logo-mark:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 0 25px rgba(145, 71, 255, 0.4);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes logo-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--accent-purple);
    background: rgba(145, 71, 255, 0.1);
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: var(--accent-red);
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.evidence-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.evidence-log-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.evidence-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.evidence-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

.evidence-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.evidence-table tr:hover {
    background: rgba(145, 71, 255, 0.04);
}

.evidence-table .username {
    color: var(--accent-purple);
    font-weight: 600;
}

.evidence-table .rep-high {
    color: var(--accent-red);
    font-weight: 700;
}

.evidence-footer {
    margin-top: 24px;
    padding: 16px;
    background: rgba(145, 71, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* -- Clickable Event Cards ------------------------------------------- */
.event-card {
    cursor: pointer;
    position: relative;
    transition: all 0.3s var(--ease-out-expo);
}

.event-card:hover {
    border-color: var(--accent-purple);
    background: rgba(145, 71, 255, 0.04);
    transform: translateX(4px);
}

.event-card:active {
    transform: scale(0.99) translateX(4px);
}

.event-card::before {
    content: 'Click to view evidence';
    position: absolute;
    top: 8px;
    right: 32px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-purple);
    opacity: 0;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.event-card:hover::before {
    opacity: 0.8;
}

/* -- Measurement Tool Overlay ---------------------------------------- */
.measurement-overlay {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(22, 24, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(145, 71, 255, 0.2);
    transition: transform 0.4s var(--ease-out-expo), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    min-width: 500px;
}

.measurement-overlay.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.measurement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.measurement-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-purple);
}

.measurement-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.measurement-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.measurement-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.measurement-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.measurement-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.measurement-value small {
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 4px;
}

.measurement-value.positive {
    color: var(--accent-green);
}

.measurement-value.negative {
    color: var(--accent-red);
}