/* ============================================
   Enigma Operations Dashboard - Professional Theme
   ============================================ */

/* CSS Variables - Light Theme (Default) */
:root {
    /* Backgrounds - Slate-tinted, sophisticated */
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --bg-elevated: #FFFFFF;
    --bg-hover: #E2E8F0;

    /* Text - Slate palette, refined hierarchy */
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-tertiary: #64748B;
    --text-muted: #94A3B8;

    /* Borders - Subtle slate */
    --border-color: #CBD5E1;
    --border-light: #E2E8F0;

    /* Accent colors - Teal/Petrol */
    --accent-primary: #1D4E4E;
    --accent-primary-hover: #163B3B;
    --accent-secondary: #5A9A9A;

    /* Status colors - Refined */
    --status-success: #3D8B8B;
    --status-warning: #C4873B;
    --status-error: #C93545;
    --status-info: #1D4E4E;

    /* Sentiment colors - Teal spectrum */
    --sentiment-positive: #3D8B8B;
    --sentiment-negative: #C93545;
    --sentiment-neutral: #6B7280;

    /* Chart colors */
    --chart-secondary: #5A9A9A;

    /* Shadows - Soft, minimal */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Select arrow */
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #1E293B;
    --bg-elevated: #334155;
    --bg-hover: #334155;

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-tertiary: #94A3B8;
    --text-muted: #64748B;

    --border-color: #334155;
    --border-light: #475569;

    --accent-primary: #6BAEAE;
    --accent-primary-hover: #5A9A9A;
    --accent-secondary: #7FBFBF;

    --status-success: #5AAA9A;
    --status-warning: #D4A050;
    --status-error: #E05565;
    --status-info: #6BAEAE;

    --sentiment-positive: #5AAA9A;
    --sentiment-negative: #E05565;
    --sentiment-neutral: #8B95A5;

    --chart-secondary: #6BAEAE;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);
}

/* ============================================
   Base Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: block;
    padding: 0 20px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-tertiary);
}

.status-indicator.online {
    background-color: var(--status-success);
    box-shadow: 0 0 8px var(--status-success);
}

.status-indicator.offline {
    background-color: var(--status-error);
}

.status-indicator.checking {
    background-color: var(--status-warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

/* Header */
.main-header {
    height: var(--header-height);
    padding: 0 24px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-tertiary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-mono);
}

.header-time #currentTime {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.header-time #currentDate {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: var(--bg-primary);
}

/* Pages that handle their own scrolling */
.page-content.no-scroll {
    overflow: hidden;
    padding: 24px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Realtime & Observations pages - scroll entire content */
#page-realtime.active,
#page-observations.active {
    height: 100%;
    overflow-y: auto;
}

/* Keywords page layout */
#page-keywords.active {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Components
   ============================================ */

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon.btn-danger {
    color: var(--status-error);
    border-color: transparent;
    background-color: transparent;
}

.btn-icon.btn-danger:hover {
    background-color: rgba(255, 82, 82, 0.15);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: var(--accent-primary-hover);
}

.btn-danger {
    background-color: var(--status-error);
    color: white;
}

.btn-danger:hover {
    background-color: #e04848;
}

/* Inputs */
.text-input, .select-input, .textarea-input {
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.text-input:focus, .select-input:focus, .textarea-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.2);
}

.text-input::placeholder, .textarea-input::placeholder {
    color: var(--text-tertiary);
}

.select-input {
    cursor: pointer;
    min-width: 150px;
    padding-right: 32px;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.textarea-input {
    resize: vertical;
    min-height: 80px;
}

.full-width {
    width: 100%;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 16px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.metrics-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.metrics-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.metric-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    transition: all var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

#realtimeMetrics .metric-card,
#observationsMetrics .metric-card {
    text-align: center;
}

#realtimeMetrics .metric-value,
#observationsMetrics .metric-value {
    font-size: 24px;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-weight: 500;
}

.metric-badge.success {
    background-color: rgba(0, 200, 83, 0.15);
    color: var(--status-success);
}

.metric-badge.warning {
    background-color: rgba(255, 171, 0, 0.15);
    color: var(--status-warning);
}

.metric-badge.error {
    background-color: rgba(255, 82, 82, 0.15);
    color: var(--status-error);
}

.metric-badge.info {
    background-color: rgba(29, 155, 240, 0.15);
    color: var(--status-info);
}

.metric-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.metric-value.status-text {
    font-size: 24px;
}

.metric-change {
    font-size: 13px;
    color: var(--text-tertiary);
}

.metric-change.positive {
    color: var(--status-success);
}

.metric-change.negative {
    color: var(--status-error);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Panel */
.panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel.full-width {
    grid-column: 1 / -1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-body {
    padding: 20px;
}

.panel-body.logs-panel {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
}

.panel-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Health List */
.health-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.health-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.health-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.health-status.healthy {
    background-color: rgba(0, 200, 83, 0.15);
    color: var(--status-success);
}

.health-status.unhealthy {
    background-color: rgba(255, 82, 82, 0.15);
    color: var(--status-error);
}

.health-status.checking {
    background-color: rgba(255, 171, 0, 0.15);
    color: var(--status-warning);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.success { background-color: var(--status-success); }
.activity-dot.warning { background-color: var(--status-warning); }
.activity-dot.error { background-color: var(--status-error); }
.activity-dot.info { background-color: var(--status-info); }

.activity-content {
    flex: 1;
}

.activity-text {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--bg-tertiary);
}

.data-table td {
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.data-table .table-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 16px;
}

/* Status Badges in Tables */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active, .status-badge.success, .status-badge.healthy, .status-badge.running {
    background-color: rgba(0, 200, 83, 0.15);
    color: var(--status-success);
}

.status-badge.pending, .status-badge.warning, .status-badge.paused {
    background-color: rgba(255, 171, 0, 0.15);
    color: var(--status-warning);
}

.status-badge.error, .status-badge.failed {
    background-color: rgba(255, 82, 82, 0.15);
    color: var(--status-error);
}

.status-badge.inactive, .status-badge.disabled {
    background-color: rgba(139, 152, 165, 0.15);
    color: var(--text-secondary);
}

.status-badge.completed, .status-badge.info {
    background-color: rgba(29, 155, 240, 0.15);
    color: var(--status-info);
}

/* Action Buttons in Tables */
.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions button {
    padding: 6px 10px;
    font-size: 12px;
}

/* Keywords Grid */
.keywords-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
}

.keyword-tag .remove-keyword {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.keyword-tag .remove-keyword:hover {
    background-color: var(--status-error);
    color: white;
}

.keyword-count {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
}

/* Log Viewer */
.log-viewer {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}

.log-entry:hover {
    background-color: var(--bg-hover);
}

.log-entry.error {
    background-color: rgba(255, 82, 82, 0.05);
}

.log-entry.warning {
    background-color: rgba(255, 171, 0, 0.05);
}

.log-time {
    color: var(--text-tertiary);
    white-space: nowrap;
}

.log-level {
    font-weight: 600;
    min-width: 60px;
}

.log-level.ERROR { color: var(--status-error); }
.log-level.WARNING { color: var(--status-warning); }
.log-level.INFO { color: var(--status-info); }
.log-level.DEBUG { color: var(--text-tertiary); }

.log-source {
    color: var(--accent-secondary);
    min-width: 80px;
}

.log-message {
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.text-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Page Actions */
.page-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

/* Details Grid for Modals */
.details-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    text-align: right;
}

.detail-value.mono {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Cooldowns Modal */
.cooldowns-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cooldown-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
}

.cooldown-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cooldown-section-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cooldown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cooldown-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cooldown-table tbody td {
    padding: 10px 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.cooldown-table tbody tr:last-child td {
    border-bottom: none;
}

.cooldown-table tbody tr:hover {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.text-muted {
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--status-success);
}

.toast.error {
    border-left: 4px solid var(--status-error);
}

.toast.warning {
    border-left: 4px solid var(--status-warning);
}

.toast.info {
    border-left: 4px solid var(--status-info);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--status-success); }
.toast.error .toast-icon { color: var(--status-error); }
.toast.warning .toast-icon { color: var(--status-warning); }
.toast.info .toast-icon { color: var(--status-info); }

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination button {
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Analytics Page */
.analytics-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.analytics-row {
    display: flex;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.analytics-row:last-child {
    margin-bottom: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group.flex-grow {
    flex: 1;
    min-width: 250px;
}

.control-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-group {
    display: flex;
    gap: 0;
}

.btn-toggle {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle:first-child {
    border-radius: 6px 0 0 6px;
}

.btn-toggle:last-child {
    border-radius: 0 6px 6px 0;
}

.btn-toggle:not(:last-child) {
    border-right: none;
}

.btn-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-toggle.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-inputs span {
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
}

.date-inputs .text-input {
    min-width: 140px;
}

.filter-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-input-group .text-input {
    flex: 1;
    min-width: 300px;
}

.metrics-grid.cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1400px) {
    .metrics-grid.cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .metrics-grid.cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.graphs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .graphs-grid {
        grid-template-columns: 1fr;
    }
}

.graph-container {
    height: 450px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    position: relative;
    border: 1px solid var(--border-color);
}

.graph-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-tertiary);
    font-size: 14px;
}

.timeseries-container {
    height: 200px;
    min-height: 200px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.timeseries-container .graph-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.timeseries-chart {
    display: block;
    width: 100%;
    height: 165px;
}

.timeseries-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.timeseries-line.primary {
    stroke: var(--accent-primary);
}

.timeseries-line.secondary {
    stroke: var(--chart-secondary);
}

.timeseries-area {
    opacity: 0.1;
}

.timeseries-area.primary {
    fill: var(--accent-primary);
}

.timeseries-area.secondary {
    fill: var(--chart-secondary);
}

.timeseries-dot {
    r: 3;
    opacity: 0;
    transition: opacity 0.2s;
}

.timeseries-dot.primary {
    fill: var(--accent-primary);
}

.timeseries-dot.secondary {
    fill: var(--chart-secondary);
}

.timeseries-chart:hover .timeseries-dot {
    opacity: 1;
}

.timeseries-axis text {
    fill: var(--text-tertiary);
    font-size: 10px;
}

.timeseries-axis.primary text {
    fill: var(--accent-primary);
}

.timeseries-axis.secondary text {
    fill: var(--chart-secondary);
}

.timeseries-axis line,
.timeseries-axis path {
    stroke: var(--border-color);
}

.timeseries-grid line {
    stroke: var(--border-color);
    stroke-opacity: 0.3;
    stroke-dasharray: 2,2;
}

.timeseries-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 8px;
    font-size: 11px;
}

.timeseries-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.timeseries-legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.timeseries-legend-color.primary {
    background: var(--accent-primary);
}

.timeseries-legend-color.secondary {
    background: var(--chart-secondary);
}

.control-separator {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 500;
}

.timeseries-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.timeseries-tooltip .tooltip-label {
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.timeseries-tooltip .tooltip-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Real-time Analytics Page */
#page-realtime .metrics-grid {
    margin-bottom: 16px;
}

#page-realtime .panel.full-width {
    margin-bottom: 16px;
}

#page-realtime .panel-header {
    padding: 12px 16px;
}

#page-realtime .panel-body {
    padding: 16px;
}

/* Activity Timeline - edge to edge chart */
#page-realtime .panel:has(.timeseries-container) .panel-body {
    padding: 0;
}

#page-realtime .timeseries-container {
    border-top: 1px solid var(--border-color);
}

/* Content Stream panel */
#page-realtime .panel:has(.content-table-wrapper) .panel-body {
    padding: 0;
}

/* Networks grid */
#page-realtime .graphs-grid {
    margin-top: 0;
    margin-bottom: 0;
    gap: 16px;
}

/* N-grams Panel */
.ngram-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 8px 0;
}

.ngram-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
}

.ngram-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ngram-column-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.ngram-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ngram-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.ngram-item:hover {
    background: var(--bg-hover);
}

.ngram-rank {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 18px;
}

.ngram-text {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.ngram-stats {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ngram-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.ngram-score {
    font-size: 10px;
    color: var(--accent-primary);
    font-weight: 500;
}

.ngram-doc-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

.ngram-empty {
    color: var(--text-tertiary);
    font-size: 12px;
    font-style: italic;
    padding: 12px 0;
    text-align: center;
}

.content-table-wrapper {
    max-height: 350px;
    overflow-y: auto;
}

.content-table-wrapper .data-table tbody tr {
    cursor: pointer;
}

.content-table-wrapper .data-table tbody tr:hover {
    background: var(--bg-hover);
}

.content-table-wrapper .data-table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.sentiment-badge.positive {
    background: color-mix(in srgb, var(--sentiment-positive) 20%, transparent);
    color: var(--sentiment-positive);
}

.sentiment-badge.negative {
    background: color-mix(in srgb, var(--sentiment-negative) 20%, transparent);
    color: var(--sentiment-negative);
}

.sentiment-badge.neutral {
    background: color-mix(in srgb, var(--sentiment-neutral) 20%, transparent);
    color: var(--sentiment-neutral);
}

.sentiment-badge.unknown {
    background: rgba(149, 165, 166, 0.1);
    color: var(--text-tertiary);
}

/* Clusters Container */
/* Observations Page */
.observations-header {
    margin-bottom: 24px;
}

.observations-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-top: 16px;
}

.observations-summary .summary-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.observations-summary .summary-stats {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.observations-summary .stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.observations-summary .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.observations-summary .stat-label {
    font-size: 13px;
    color: var(--text-tertiary);
}

.clusters-panel {
    margin-bottom: 24px;
}

.clusters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .clusters-grid {
        grid-template-columns: 1fr;
    }
}

/* Legacy support */
.clusters-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .clusters-container {
        grid-template-columns: 1fr;
    }
}

.cluster-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.cluster-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.cluster-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.cluster-card-header-left {
    flex: 1;
    min-width: 0;
}

.cluster-card-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cluster-representation {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.cluster-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.cluster-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cluster-meta-item svg {
    width: 14px;
    height: 14px;
}

.cluster-id-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

/* Sentiment Donut */
.cluster-sentiment-donut {
    position: relative;
    width: 56px;
    height: 56px;
}

.cluster-sentiment-donut svg {
    transform: rotate(-90deg);
}

.cluster-sentiment-donut circle {
    fill: none;
    stroke-width: 6;
}

.cluster-sentiment-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Summary Section */
.cluster-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Topics Tags */
.cluster-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.topic-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(29, 155, 240, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(29, 155, 240, 0.2);
}

.topic-tag:hover {
    background: rgba(29, 155, 240, 0.2);
}

/* Hashtags Tags */
.cluster-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.hashtag-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-secondary);
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.hashtag-tag:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Sentiment Legend */
.cluster-sentiment-legend {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.sentiment-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.sentiment-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sentiment-legend-dot.positive { background: var(--sentiment-positive); }
.sentiment-legend-dot.negative { background: var(--sentiment-negative); }
.sentiment-legend-dot.neutral { background: var(--sentiment-neutral); }

.sentiment-legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

.sentiment-legend-label {
    color: var(--text-tertiary);
}

/* Engagement Stats Grid */
.cluster-engagement {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.engagement-stat {
    text-align: center;
}

.engagement-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.engagement-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Panel Icon */
.panel-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Badge styles */
.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.badge-info {
    background: rgba(29, 155, 240, 0.15);
    color: var(--accent-primary);
}

/* Button group small variant */
.btn-group-sm .btn-toggle {
    padding: 6px 12px;
    font-size: 12px;
}

/* Graph panels */
.graphs-grid .panel {
    overflow: hidden;
}

.graphs-grid .panel-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.graphs-grid .panel-body {
    padding: 0;
}

.graphs-grid .graph-container {
    border: none;
    border-radius: 0;
    height: 380px;
}

/* Cluster count badge */
.cluster-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Expand button */
.cluster-expand-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cluster-expand-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Legacy cluster grid - keep for compatibility */
.clusters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.cluster-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cluster-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cluster-id {
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.cluster-sentiment {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sentiment-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.sentiment-bar-fill {
    height: 100%;
    transition: width var(--transition-normal);
}

.sentiment-bar-fill.positive {
    background: var(--sentiment-positive);
}

.sentiment-bar-fill.negative {
    background: var(--sentiment-negative);
}

.sentiment-bar-fill.neutral {
    background: var(--sentiment-neutral);
}

.cluster-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    font-size: 12px;
}

.cluster-stat {
    text-align: center;
}

.cluster-stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.cluster-stat-label {
    color: var(--text-tertiary);
}

/* Cluster Detail Modal */
.cluster-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cluster-detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.cluster-detail-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

.cluster-detail-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .cluster-detail-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .cluster-detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.detail-stat {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.detail-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Influential Accounts List */
.influential-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.influential-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.account-name {
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 120px;
}

.account-display-name {
    flex: 1;
    color: var(--text-secondary);
    font-size: 13px;
}

.account-metric {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: right;
}

/* Top Tweets List */
.top-tweets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-tweet {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

.tweet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tweet-author {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 13px;
}

.tweet-date {
    font-size: 11px;
    color: var(--text-tertiary);
}

.tweet-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-word;
}

.tweet-metrics {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.tweet-metrics span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading placeholder */
.loading-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.text-muted {
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Additional analytics elements */
.graph-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    font-size: 14px;
}

.graph-load-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-tertiary);
    text-align: center;
}

.graph-load-prompt p {
    margin: 0;
    font-size: 14px;
}

.graph-load-prompt button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
}

.graph-load-prompt button svg {
    flex-shrink: 0;
}

.graph-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.cluster-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cluster-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.cluster-type.hashtag {
    background: rgba(29, 155, 240, 0.2);
    color: #1d9bf0;
}

.cluster-type.account {
    background: rgba(120, 86, 255, 0.2);
    color: #7856ff;
}

.cluster-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.item-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    color: var(--text-secondary);
}

/* Sentiment bar segments */
.sentiment-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.sentiment-bar .sentiment-positive {
    background: var(--sentiment-positive);
}

.sentiment-bar .sentiment-neutral {
    background: var(--sentiment-neutral);
}

.sentiment-bar .sentiment-negative {
    background: var(--sentiment-negative);
}

.content-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#analyticsPagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Sortable table headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px !important;
}

.sortable-header:hover {
    background: var(--bg-hover);
}

.sortable-header::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-tertiary);
    margin-top: 2px;
    opacity: 0.3;
}

.sortable-header.sort-desc::after {
    border-top-color: var(--accent-primary);
    opacity: 1;
}

.sortable-header.sort-asc::after {
    border-top: none;
    border-bottom: 4px solid var(--accent-primary);
    margin-top: -4px;
    opacity: 1;
}

#customDateRange {
    display: none;
}

.content-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1400px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .metrics-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .metrics-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
        z-index: 100;
        transition: left var(--transition-normal);
    }

    .sidebar.open {
        left: 0;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* Wide Modal for Cluster Details */
.modal.modal-wide {
    max-width: 1100px;
    max-height: 92vh;
    width: 95vw;
}

.modal.modal-wide .modal-header {
    padding: 20px 28px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
}

.modal.modal-wide .modal-body {
    max-height: calc(92vh - 160px);
    padding: 0;
    background: var(--bg-primary);
}

/* ============================================
   Full Content View Modal
   ============================================ */

.full-content-view {
    padding: 20px 28px;
}

.full-content-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.full-content-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.full-content-meta .meta-item strong {
    color: var(--text-primary);
}

.full-content-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.full-content-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.full-content-rank {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    border-radius: 50%;
}

.full-content-body {
    flex: 1;
    min-width: 0;
}

.full-content-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}

.full-content-author strong {
    color: var(--accent-primary);
}

.full-content-time {
    color: var(--text-tertiary);
}

.full-content-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 12px;
}

.full-content-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.full-content-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   Cluster Detail Modal - Enhanced Layout
   ============================================ */

.cluster-modal-content {
    display: flex;
    flex-direction: column;
}

/* Modal Hero Section */
.cluster-modal-hero {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    padding: 24px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.cluster-modal-summary {
    min-width: 0;
}

.cluster-modal-summary h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cluster-modal-summary h3 svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.cluster-modal-summary-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    margin: 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

/* Sentiment Panel in Hero */
.cluster-modal-sentiment {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cluster-modal-sentiment h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    text-align: center;
}

.sentiment-donut-large {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    position: relative;
}

.sentiment-donut-large svg {
    transform: rotate(-90deg);
}

.sentiment-donut-large circle {
    fill: none;
    stroke-width: 10;
}

.sentiment-donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.sentiment-donut-center .dominant {
    font-size: 20px;
    font-weight: 700;
}

.sentiment-donut-center .label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.sentiment-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sentiment-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sentiment-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 60px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sentiment-bar-label .dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sentiment-bar-label .dot.positive { background: var(--sentiment-positive); }
.sentiment-bar-label .dot.negative { background: var(--sentiment-negative); }
.sentiment-bar-label .dot.neutral { background: var(--sentiment-neutral); }

.sentiment-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.sentiment-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sentiment-bar-fill.positive { background: var(--sentiment-positive); }
.sentiment-bar-fill.negative { background: var(--sentiment-negative); }
.sentiment-bar-fill.neutral { background: var(--sentiment-neutral); }

.sentiment-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 40px;
    text-align: right;
}

/* Modal Body Sections */
.cluster-modal-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Tags Section */
.cluster-modal-tags {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.cluster-modal-tag-group {
    flex: 1;
    min-width: 200px;
    max-width: 100%;
    overflow: hidden;
}

.cluster-modal-tag-group h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cluster-modal-tag-group h4 svg {
    width: 14px;
    height: 14px;
}

.cluster-modal-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Stats Grid */
.cluster-modal-stats {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid var(--border-color);
}

.cluster-modal-stats h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cluster-modal-stats h4 svg {
    width: 14px;
    height: 14px;
}

.cluster-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.cluster-stat-item {
    text-align: center;
    padding: 16px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.cluster-stat-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.cluster-stat-item.loading {
    opacity: 0.6;
}

.cluster-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.cluster-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Two Column Layout */
.cluster-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.cluster-modal-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: 420px;
    display: flex;
    flex-direction: column;
}

.cluster-modal-panel-header {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cluster-modal-panel-header svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.cluster-modal-panel-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cluster-modal-panel-header .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    color: var(--text-secondary);
}

.cluster-modal-panel-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Account Cards */
.account-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.account-card:last-child {
    margin-bottom: 0;
}

.account-card:hover {
    border-color: var(--accent-primary);
}

.account-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-handle {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

.account-displayname {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-bio {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.account-stats {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.account-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.account-stats svg {
    width: 12px;
    height: 12px;
}

/* Mentioned Account Cards */
.account-card.mentioned {
    border-left: 3px solid var(--status-warning);
}

.account-card.mentioned:hover {
    border-color: var(--status-warning);
}

.account-avatar.mentioned {
    background: linear-gradient(135deg, var(--status-warning), #D4A050);
}

/* Full width panel for mentioned accounts */
.cluster-modal-panel-full {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.cluster-modal-panel-full .cluster-modal-panel-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

/* Tweet Cards */
.tweet-card {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border-left: 3px solid var(--accent-primary);
    transition: all var(--transition-fast);
}

.tweet-card:last-child {
    margin-bottom: 0;
}

.tweet-card:hover {
    background: var(--bg-hover);
}

.tweet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tweet-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tweet-card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.tweet-card-handle {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
}

.tweet-card-date {
    font-size: 11px;
    color: var(--text-tertiary);
}

.tweet-card-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    word-break: break-word;
}

.tweet-card-metrics {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.tweet-card-metrics span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tweet-card-metrics svg {
    width: 14px;
    height: 14px;
}

/* Hashtag List Detailed */
.hashtag-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.hashtag-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    overflow: hidden;
    min-width: 0;
}

.hashtag-card:hover {
    border-color: var(--accent-secondary);
    background: var(--bg-hover);
}

.hashtag-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-secondary);
    word-break: break-all;
    max-width: 60%;
}

.hashtag-card-stats {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: right;
}

.hashtag-card-stats span {
    display: block;
}

/* Executive Report in Modal */
.cluster-modal-report {
    margin-top: 8px;
    padding-top: 24px;
    border-top: 2px solid var(--accent-primary);
}

.cluster-modal-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cluster-modal-report-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cluster-modal-report-header h4 svg {
    width: 20px;
    height: 20px;
}

.cluster-modal-report-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Empty and Loading States */
.cluster-modal-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-tertiary);
}

.cluster-modal-empty svg {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.cluster-modal-empty p {
    font-size: 13px;
    margin: 0;
}

.cluster-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.cluster-modal-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.cluster-modal-loading p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive */
@media (max-width: 900px) {
    .cluster-modal-hero {
        grid-template-columns: 1fr;
    }

    .cluster-modal-columns {
        grid-template-columns: 1fr;
    }

    .cluster-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .cluster-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cluster-modal-hero {
        padding: 16px 20px;
    }

    .cluster-modal-body {
        padding: 16px 20px;
    }
}

/* Legacy support - keep existing classes working */
.cluster-detail-wide {
    gap: 20px;
}

.cluster-detail-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: start;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.cluster-detail-header .cluster-detail-section {
    min-width: 0;
}

.cluster-detail-meta {
    min-width: 180px;
    max-width: 220px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.cluster-summary-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
}

/* Sentiment Bar in Modal */
.cluster-sentiment-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
    background: var(--bg-secondary);
}

.sentiment-segment {
    transition: width 0.3s ease;
}

.sentiment-segment.positive {
    background: var(--sentiment-positive);
}

.sentiment-segment.negative {
    background: var(--sentiment-negative);
}

.sentiment-segment.neutral {
    background: var(--sentiment-neutral);
}

.cluster-sentiment-legend.compact {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.cluster-sentiment-legend.compact .legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cluster-sentiment-legend.compact .dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cluster-sentiment-legend.compact .dot.positive {
    background: var(--sentiment-positive);
}

.cluster-sentiment-legend.compact .dot.negative {
    background: var(--sentiment-negative);
}

.cluster-sentiment-legend.compact .dot.neutral {
    background: var(--sentiment-neutral);
}

/* Two-Column Layout for Authors and Tweets */
.cluster-detail-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 8px;
}

.cluster-detail-columns .cluster-detail-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.cluster-detail-columns .cluster-detail-section h4 {
    position: sticky;
    top: -16px;
    background: var(--bg-secondary);
    padding: 8px 0;
    margin: -16px -16px 12px -16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

@media (max-width: 900px) {
    .cluster-detail-columns {
        grid-template-columns: 1fr;
    }

    .cluster-detail-header {
        grid-template-columns: 1fr;
    }

    .cluster-detail-meta {
        max-width: 100%;
    }
}

/* Detailed Hashtag List */
.hashtag-list-detailed {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hashtag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.hashtag-name {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 13px;
}

.hashtag-stats {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Enhanced Account Cards */
.influential-account {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.influential-account .account-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.influential-account .account-name {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 13px;
}

.influential-account .account-display-name {
    color: var(--text-secondary);
    font-size: 12px;
}

.influential-account .account-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.influential-account .account-metrics {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.influential-account .account-metrics .metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading state for stats */
.detail-stat.loading {
    opacity: 0.5;
}

.detail-stat.loading .detail-stat-value {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Executive Report Styles */
.executive-report-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--accent-primary);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.report-header h4 {
    color: var(--accent-primary);
    margin: 0;
}

.report-generated-at {
    font-size: 11px;
    color: var(--text-tertiary);
}

.report-loading {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.report-error {
    text-align: center;
    padding: 20px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: var(--radius-md);
}

.executive-report {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.report-section {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.report-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.takeaways-list,
.recommendations-list {
    margin: 0;
    padding-left: 20px;
}

.takeaways-list li,
.recommendations-list li {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.takeaways-list li:last-child,
.recommendations-list li:last-child {
    margin-bottom: 0;
}

.sentiment-tone {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.tone-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.tone-value {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: capitalize;
}

.tone-value.tone-positif,
.tone-value.tone-positive {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.tone-value.tone-negatif,
.tone-value.tone-negative {
    background: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

.tone-value.tone-netral,
.tone-value.tone-neutral {
    background: rgba(149, 165, 166, 0.2);
    color: #7f8c8d;
}

.tone-value.tone-campuran,
.tone-value.tone-mixed {
    background: rgba(241, 196, 15, 0.2);
    color: #f39c12;
}

.sentiment-interpretation {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.insight-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

.insight-number {
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.insight-content {
    flex: 1;
    min-width: 0;
}

.insight-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.insight-evidence,
.insight-implication {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.insight-evidence strong,
.insight-implication strong {
    color: var(--text-primary);
}

/* Primary button style */
.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Observations Page - New Layout
   ============================================ */

/* Page Header */
.obs-page-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.obs-controls {
    display: flex;
    gap: 24px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.obs-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.obs-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.obs-select {
    padding: 10px 32px 10px 14px;
    background: var(--bg-tertiary);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    min-width: 220px;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.obs-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.15);
}

.obs-select:hover {
    border-color: var(--border-light);
}

/* Summary Dashboard */
.obs-dashboard {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.obs-dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    text-align: center;
}

.obs-dashboard-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.obs-dashboard-empty p {
    font-size: 14px;
    margin: 0;
}

/* Dashboard Stats Row */
.obs-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.obs-stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.obs-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.obs-stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Clusters Wrapper */
.obs-clusters-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Section Container */
.obs-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Section Header */
.obs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.obs-section-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.obs-section-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.obs-section-icon svg {
    width: 22px;
    height: 22px;
}

.obs-section-icon.hashtag-icon {
    background: rgba(29, 155, 240, 0.15);
    color: var(--accent-primary);
}

.obs-section-icon.account-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
}

.obs-section-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.obs-section-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 4px 0 0 0;
}

/* Section Meta */
.obs-section-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.obs-date-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.obs-count-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(29, 155, 240, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* Clusters Grid */
.obs-clusters-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

@media (max-width: 800px) {
    .obs-clusters-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
}

/* Empty State */
.obs-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
}

.obs-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Enhanced Cluster Card */
.obs-cluster-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all var(--transition-fast);
    cursor: pointer;
    overflow: hidden;
}

.obs-cluster-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Card Header */
.obs-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.obs-card-title {
    flex: 1;
    min-width: 0;
}

.obs-card-title h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.obs-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.obs-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.obs-card-meta-item svg {
    width: 14px;
    height: 14px;
}

/* Sentiment Donut in Card */
.obs-sentiment-donut {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    position: relative;
}

.obs-sentiment-donut svg {
    transform: rotate(-90deg);
}

.obs-sentiment-donut circle {
    fill: none;
    stroke-width: 5;
}

.obs-sentiment-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Card Body */
.obs-card-body {
    padding: 16px 20px;
}

.obs-card-summary {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Topics Tags */
.obs-card-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.obs-topic-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(29, 155, 240, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(29, 155, 240, 0.2);
    transition: all var(--transition-fast);
}

.obs-topic-tag:hover {
    background: rgba(29, 155, 240, 0.2);
}

/* Hashtag Tags */
.obs-card-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.obs-hashtag-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-secondary);
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all var(--transition-fast);
    word-break: break-all;
    max-width: 100%;
}

.obs-hashtag-tag:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Sentiment Legend */
.obs-sentiment-legend {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.obs-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.obs-legend-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.obs-legend-dot.positive { background: var(--sentiment-positive); }
.obs-legend-dot.negative { background: var(--sentiment-negative); }
.obs-legend-dot.neutral { background: var(--sentiment-neutral); }

.obs-legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

.obs-legend-label {
    color: var(--text-tertiary);
}

/* Card Footer - Engagement Stats */
.obs-card-footer {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.obs-engagement-stat {
    text-align: center;
}

.obs-engagement-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.obs-engagement-label {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
    text-transform: uppercase;
}

/* Cluster ID Badge */
.obs-cluster-id {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Card hover effect enhancement */
.obs-cluster-card {
    position: relative;
}

.obs-cluster-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.obs-cluster-card:hover::before {
    opacity: 1;
}

/* Account cluster card color variation */
.obs-cluster-card[data-cluster-type="account"]::before {
    background: linear-gradient(90deg, var(--accent-secondary), #9b59b6);
}

/* Sentiment donut text improvements */
.obs-sentiment-center {
    font-size: 10px;
    font-weight: 700;
}

.obs-sentiment-center span {
    font-size: 10px;
}

/* Better summary text styling */
.obs-card-summary {
    position: relative;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
}

/* Topics and hashtags hover animation */
.obs-topic-tag,
.obs-hashtag-tag {
    cursor: default;
    transition: all var(--transition-fast);
}

.obs-topic-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(29, 155, 240, 0.2);
}

.obs-hashtag-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

/* Loading state for cluster cards */
.obs-cluster-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.obs-cluster-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty state improvements */
.obs-empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    opacity: 0.4;
    margin-bottom: 12px;
}

/* Section separator line */
.obs-section + .obs-section {
    margin-top: 0;
}

/* Footer engagement stat hover */
.obs-engagement-stat {
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.obs-engagement-stat:hover {
    background: var(--bg-secondary);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .obs-controls {
        flex-direction: column;
        gap: 16px;
    }

    .obs-control-group {
        width: 100%;
    }

    .obs-select {
        width: 100%;
    }

    .obs-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .obs-section-meta {
        width: 100%;
        justify-content: flex-start;
    }

    .obs-card-footer {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   Keywords Management Page
   ============================================ */

/* Keywords layout wrapper */
.keywords-layout {
    display: contents;
}

/* Left sidebar - project list */
.keywords-sidebar .panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.keywords-sidebar .panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.keywords-sidebar .panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Right side - keywords management */
.keywords-main {
    overflow-y: auto;
}

/* Project List in Sidebar */
.project-list {
    display: flex;
    flex-direction: column;
}

.project-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 12px;
}

.project-list-item:last-child {
    border-bottom: none;
}

.project-list-item:hover {
    background-color: var(--bg-hover);
}

.project-list-item.selected {
    background-color: var(--accent-primary);
    color: white;
}

.project-list-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.project-list-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.project-list-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.project-list-status.active {
    color: var(--status-success);
}

.project-list-status.inactive {
    color: var(--text-tertiary);
}

.project-list-item.selected .project-list-status {
    color: rgba(255, 255, 255, 0.75);
}

.project-list-count {
    font-size: 12px;
    font-weight: 600;
    background-color: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 10px;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 32px;
    text-align: center;
}

.project-list-item.selected .project-list-count {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Keywords Header Card */
.keywords-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    gap: 16px;
    flex-shrink: 0;
    margin-bottom: 16px;
}

.keywords-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.keywords-project-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.keywords-project-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.keywords-project-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keywords-project-meta .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-success);
}

.keywords-project-meta .status-dot.inactive {
    background-color: var(--text-tertiary);
}

.keywords-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.keywords-header-actions .btn-secondary,
.keywords-header-actions .btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
}

.keywords-header-actions .btn-secondary svg,
.keywords-header-actions .btn-primary svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Add Keywords Panel */
#addKeywordsPanel .panel-header {
    padding: 14px 20px;
}

#addKeywordsPanel .panel-body {
    padding: 16px 20px;
}

.add-keywords-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.add-keywords-form .textarea-input {
    flex: 1;
    min-height: 80px;
    resize: vertical;
    font-size: 13px;
    padding: 12px 14px;
}

.add-keywords-form .btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 12px 20px;
    height: fit-content;
}

/* Add Keywords Panel */
#addKeywordsPanel {
    margin-bottom: 16px;
}

/* Keywords Table Panel */
#keywordsTablePanel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

#keywordsTablePanel .panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

/* Scrollable table body - SIMPLE max-height approach */
.keywords-table-body {
    max-height: calc(100vh - 380px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Bulk actions bar */
.bulk-actions-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-tertiary);
}

/* Pagination footer */
#keywordsTablePanel .table-pagination {
    border-top: 1px solid var(--border-color);
}

#keywordsTablePanel .panel-actions {
    gap: 12px;
}

#keywordsTablePanel .panel-actions .text-input {
    width: 200px;
    padding: 8px 12px;
    font-size: 13px;
}

#keywordsTablePanel .panel-actions .select-input {
    width: 130px;
    padding: 8px 12px;
    font-size: 13px;
}

/* Keywords Table */
.keywords-table {
    width: 100%;
    border-collapse: collapse;
}

.keywords-table thead {
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    z-index: 1;
}

.keywords-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.keywords-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.keywords-table .th-checkbox,
.keywords-table .td-checkbox {
    width: 48px;
    text-align: center;
    padding: 12px 16px;
}

.keywords-table tbody tr {
    transition: background-color var(--transition-fast);
}

.keywords-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.keywords-table tbody tr.selected {
    background-color: rgba(29, 155, 240, 0.08);
}

.keywords-table tbody tr:last-child td {
    border-bottom: none;
}

/* Keyword Cell */
.keyword-cell {
    max-width: 400px;
}

.keyword-text {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
    color: var(--text-primary);
}

/* Table Actions Column */
.keywords-table .table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.keywords-table .table-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.keywords-table .table-actions .btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background-color: rgba(29, 155, 240, 0.08);
    border-bottom: 1px solid var(--border-color);
}

.bulk-actions-bar .selected-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-right: auto;
}

.btn-small {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-small:hover {
    background-color: var(--bg-hover);
}

.btn-small.btn-success {
    background-color: rgba(0, 200, 83, 0.15);
    color: var(--status-success);
}

.btn-small.btn-success:hover {
    background-color: rgba(0, 200, 83, 0.25);
}

.btn-small.btn-warning {
    background-color: rgba(255, 171, 0, 0.15);
    color: var(--status-warning);
}

.btn-small.btn-warning:hover {
    background-color: rgba(255, 171, 0, 0.25);
}

.btn-small.btn-danger {
    background-color: rgba(255, 82, 82, 0.15);
    color: var(--status-error);
}

.btn-small.btn-danger:hover {
    background-color: rgba(255, 82, 82, 0.25);
}

/* Keyword Count Badge in Panel Title */
.keyword-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    margin-left: 10px;
    font-size: 12px;
    font-weight: 600;
    background-color: var(--accent-primary);
    color: white;
    border-radius: 11px;
}

/* Keywords Empty State */
.keywords-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    flex: 1;
}

.keywords-empty-state .empty-icon {
    margin-bottom: 20px;
    opacity: 0.3;
}

.keywords-empty-state .empty-icon svg {
    width: 72px;
    height: 72px;
}

.keywords-empty-state h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.keywords-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Keywords Table Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-pagination:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-pagination:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-pages .page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-pages .page-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-pages .page-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.pagination-pages .page-ellipsis {
    padding: 0 4px;
    color: var(--text-tertiary);
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-size select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.pagination-size select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Panel utilities */
.panel-body.no-padding {
    padding: 0;
}

.empty-state.small {
    padding: 20px;
}

.empty-state.small p {
    font-size: 13px;
}

/* Responsive - Keywords Page */
@media (max-width: 1200px) {
    #page-keywords.active {
        grid-template-columns: 260px 1fr;
    }

    .keywords-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .keywords-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 1024px) {
    #page-keywords.active {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        max-height: calc(100vh - var(--header-height) - 48px);
        overflow-y: auto;
    }

    .keywords-sidebar {
        max-height: 250px;
    }

    #keywordsTablePanel {
        max-height: none;
    }

    .add-keywords-form {
        flex-direction: column;
        gap: 12px;
    }

    .add-keywords-form .btn-primary {
        width: 100%;
        justify-content: center;
    }

    #keywordsTablePanel .panel-actions {
        flex-wrap: wrap;
    }

    #keywordsTablePanel .panel-actions .text-input,
    #keywordsTablePanel .panel-actions .select-input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .keywords-header-actions .btn-secondary span,
    .keywords-header-actions .btn-primary span {
        display: none;
    }

    .keywords-header-actions .btn-secondary,
    .keywords-header-actions .btn-primary {
        padding: 10px;
    }

    .bulk-actions-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bulk-actions-bar .selected-count {
        width: 100%;
        margin-right: 0;
        margin-bottom: 4px;
    }
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--accent-primary);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.login-header p {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0;
}

.login-form-group {
    margin-bottom: 20px;
}

.login-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.login-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 78, 0.15);
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-error {
    padding: 12px 16px;
    background: rgba(201, 53, 69, 0.1);
    border: 1px solid var(--status-error);
    border-radius: var(--radius-md);
    color: var(--status-error);
    font-size: 13px;
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.login-btn:hover {
    background: var(--accent-primary-hover);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* User Menu in Header */
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
    margin-left: 8px;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Hide nav items for viewers */
.nav-item.admin-only {
    display: none;
}

.nav-item.admin-only.visible {
    display: flex;
}

/* ============================================
   User Management Styles
   ============================================ */

.panel-full-width {
    grid-column: 1 / -1;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
}

.role-badge.role-admin {
    background: rgba(29, 78, 78, 0.15);
    color: var(--accent-primary);
}

.role-badge.role-viewer {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
}

.badge-small {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border-radius: 4px;
    margin-left: 8px;
}

.btn-danger-icon {
    color: var(--status-error);
    opacity: 0.7;
}

.btn-danger-icon:hover {
    opacity: 1;
    background: rgba(201, 53, 69, 0.1);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-primary.btn-small {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary.btn-small:hover {
    background: var(--accent-primary-hover);
}
