:root {
    --bg: #12161c;
    --surface: #1a1f28;
    --surface-hover: #242a34;
    --border: #2a3040;
    --text: #e6edf3;
    --text-secondary: #a8b2bd;
    --text-muted: #6e7a88;
    --primary: #e8542e;
    --primary-light: #e8542e15;
    --primary-dark: #c73e1d;
    --primary-glow: #e8542e40;
    --success: #4ade80;
    --success-light: #4ade8015;
    --warning: #facc15;
    --warning-light: #facc1515;
    --danger: #f87171;
    --danger-light: #f8717115;
    --info: #60a5fa;
    --info-light: #60a5fa15;
    --neutral: #6e7a88;
    --neutral-light: #242a34;
    --super-active: #00cec9;
    --super-active-light: #00cec915;
    --excellent: #a855f7;
    --excellent-light: #a855f715;
    --sidebar-width: 220px;
    --header-height: 60px;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* NavLink active state */
a.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left: 2px solid var(--primary);
}

/* Progress Bottom Bar */
.progress-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-size: 0.55rem;
    font-weight: 600;
}

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-success .dot { background: var(--success); box-shadow: 0 0 4px #4ade8060; }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-warning .dot { background: var(--warning); box-shadow: 0 0 4px #facc1560; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-danger .dot { background: var(--danger); box-shadow: 0 0 4px #f8717160; }
.badge-neutral { background: var(--neutral-light); color: var(--text-secondary); }
.badge-neutral .dot { background: var(--text-secondary); box-shadow: 0 0 4px #6e7a8860; }
.badge-excellent { background: var(--excellent-light); color: var(--excellent); }
.badge-excellent .dot { background: var(--excellent); box-shadow: 0 0 4px #a855f760; }
.badge-positive { background: var(--success-light); color: var(--success); }
.badge-positive .dot { background: var(--success); box-shadow: 0 0 4px #4ade8060; }
.badge-negative { background: var(--danger-light); color: var(--danger); }
.badge-negative .dot { background: var(--danger); box-shadow: 0 0 4px #f8717160; }
.badge-attention { background: var(--warning-light); color: var(--warning); }
.badge-attention .dot { background: var(--warning); box-shadow: 0 0 4px #facc1560; }

/* Info tooltip */
.info-tip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.55rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
}
.info-tip:hover {
    background: var(--text-muted);
    color: var(--bg);
}
.info-tip-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
}
.info-tip-popover {
    display: block;
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 320px;
    min-width: 200px;
    z-index: 201;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    text-transform: none;
    letter-spacing: normal;
}

/* Topic Tags */
.topic-tag-1 { background: rgba(232, 84, 46, 0.12); color: #e8542e; }
.topic-tag-2 { background: rgba(250, 204, 21, 0.12); color: #facc15; }
.topic-tag-3 { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.topic-tag-4 { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.topic-tag-5 { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.topic-tag-6 { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.topic-tag-7 { background: rgba(45, 212, 191, 0.12); color: #2dd4bf; }
.topic-tag-8 { background: rgba(244, 114, 182, 0.12); color: #f472b6; }

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    color: var(--text-muted);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #2a304060;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table td.name {
    color: var(--text);
    font-weight: 600;
}

/* Sparkline */
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
}

.sparkline .spark-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-width: 0;
}

/* Signal Bars */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    margin-top: 0.4rem;
}

.signal-bar {
    width: 3px;
    border-radius: 1px;
    background: var(--border);
}

.signal-bar.active-1 { height: 8px; }
.signal-bar.active-2 { height: 12px; }
.signal-bar.active-3 { height: 16px; }
.signal-bar.active-4 { height: 20px; }
.signal-bar.active-5 { height: 24px; }

/* Heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: 40px repeat(24, 1fr);
    gap: 2px;
    font-size: 0.65rem;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-height: 16px;
}

/* Sentiment Gauge */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
}

.gauge {
    width: 160px;
    height: 80px;
    position: relative;
    overflow: hidden;
}

.gauge-bg {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(
        var(--danger) 0deg,
        var(--warning) 90deg,
        var(--success) 180deg
    );
    mask: radial-gradient(circle at center, transparent 55px, black 56px);
    -webkit-mask: radial-gradient(circle at center, transparent 55px, black 56px);
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 3px;
    height: 60px;
    background: var(--text);
    transform-origin: bottom center;
    border-radius: 2px;
    margin-left: -1.5px;
}

.gauge-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.gauge-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Ranked Hot Topics */
.rt-rank {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem; flex-shrink: 0; margin-top: 2px;
}
.rt-rank.r1 { background: var(--primary-light); color: var(--primary); }
.rt-rank.r2 { background: var(--warning-light); color: var(--warning); }
.rt-rank.r3 { background: var(--info-light); color: var(--info); }
.rt-rank.r4 { background: var(--success-light); color: var(--success); }
.rt-rank.r5 { background: var(--excellent-light); color: var(--excellent); }
.rt-rank.r6 { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.rt-rank.r7 { background: rgba(45, 212, 191, 0.12); color: #2dd4bf; }
.rt-rank.r8 { background: rgba(244, 114, 182, 0.12); color: #f472b6; }

/* Summary Cards */
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.summary-card.alert {
    border-color: #f8717130;
}

.summary-card .top-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.summary-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.summary-content strong {
    color: var(--text);
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}

.pagination-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled):not(.pagination-active) {
    background: var(--surface-hover);
    color: var(--text);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 0.3rem;
    font-size: 0.75rem;
}

/* Admin Status & Role Badges */
.connection-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.connection-dot.open { background: var(--success); }
.connection-dot.close { background: var(--danger); }
.connection-dot.connecting { background: var(--warning); }
.connection-dot.unknown { background: var(--neutral); }
.status-badge { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 4px; }
.status-badge.active { background: var(--success-light); color: var(--success); }
.status-badge.full { background: var(--warning-light); color: var(--warning); }
.status-badge.disabled, .status-badge.locked { background: var(--danger-light); color: var(--danger); }
.role-badge { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 4px; }
.role-badge.admin { background: var(--excellent-light); color: var(--excellent); }
.role-badge.user { background: var(--neutral-light); color: var(--text-secondary); }
