/* ═══════════════════════════════════════════════════════════════
   CrypGuard Command Center - Dark Mode Cybersecurity Theme
   Colors from DASHBOARD_MASTER_BLUEPRINT.md Section 5
   ═══════════════════════════════════════════════════════════════ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Variables (Blueprint Color Palette) --- */
:root {
    /* Backgrounds */
    --bg-page: #0d1117;
    --bg-card: #161b22;
    --bg-sidebar: #0d1117;
    --bg-hover: #21262d;
    --bg-input: #0d1117;
    --border-color: #30363d;
    --border-subtle: #21262d;

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-link: #58a6ff;
    --text-body: #c9d1d9;

    /* Severity (Splunk RBA scale) */
    --severity-critical: #f85149;
    --severity-high: #f0883e;
    --severity-medium: #d29922;
    --severity-low: #58a6ff;
    --severity-safe: #3fb950;

    /* Accents */
    --accent-teal: #00d1b2;
    --accent-purple: #8957e5;
    --accent-blue: #1f6feb;

    /* Sidebar */
    --sidebar-width: 240px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Layout --- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo h1 {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo .logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo .logo-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 8px 8px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-body);
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--accent-blue);
    color: white;
    font-weight: 500;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link.active svg {
    opacity: 1;
}

/* Sidebar Quick Stats */
.sidebar-stats {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.sidebar-stat-label {
    color: var(--text-secondary);
}

.sidebar-stat-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

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

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.page-body {
    padding: 24px;
}

/* --- Stat Cards --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.15s;
}

.stat-card:hover {
    border-color: var(--border-subtle);
}

.stat-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.stat-card-value.teal { color: var(--accent-teal); }
.stat-card-value.red { color: var(--severity-critical); }
.stat-card-value.green { color: var(--severity-safe); }
.stat-card-value.amber { color: var(--severity-high); }
.stat-card-value.blue { color: var(--accent-blue); }
.stat-card-value.purple { color: var(--accent-purple); }

.stat-card-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* --- Cards / Panels --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
}

.card-body {
    padding: 0;
}

.card-body-padded {
    padding: 20px;
}

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

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

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

.data-table .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.data-table .timestamp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Clickable row */
.data-table tr.clickable {
    cursor: pointer;
}

.data-table tr.clickable:hover td {
    background: rgba(31, 111, 235, 0.08);
}

/* Severity row tinting */
.data-table tr.severity-critical td {
    border-left: 3px solid var(--severity-critical);
}
.data-table tr.severity-high td {
    border-left: 3px solid var(--severity-high);
}
.data-table tr.severity-medium td {
    border-left: 3px solid var(--severity-medium);
}
.data-table tr.severity-low td {
    border-left: 3px solid var(--severity-low);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Confidence Bar --- */
.confidence-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.confidence-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-page);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.confidence-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.confidence-bar-fill.critical { background: var(--severity-critical); }
.confidence-bar-fill.high { background: var(--severity-high); }
.confidence-bar-fill.medium { background: var(--severity-medium); }
.confidence-bar-fill.low { background: var(--severity-low); }

.confidence-bar-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    min-width: 36px;
    text-align: right;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-select,
.filter-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.filter-select:focus,
.filter-input:focus {
    border-color: var(--accent-blue);
}

.filter-select {
    padding-right: 28px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #388bfd;
}

.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    border-color: var(--severity-critical);
    color: var(--severity-critical);
}

.btn-success {
    background: rgba(63, 185, 80, 0.15);
    border-color: var(--severity-safe);
    color: var(--severity-safe);
}

.btn-warning {
    background: rgba(210, 153, 34, 0.15);
    border-color: var(--severity-medium);
    color: var(--severity-medium);
}

/* --- Investigation Page --- */
.investigation-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.investigation-message {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-all;
}

.investigation-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.investigation-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.investigation-meta-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.investigation-meta-value {
    font-size: 13px;
    font-weight: 500;
}

/* Detector Breakdown */
.detector-grid {
    display: grid;
    gap: 12px;
}

.detector-row {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.15s;
}

.detector-row:hover {
    border-color: var(--accent-blue);
}

.detector-row.fired {
    border-left: 3px solid var(--severity-critical);
}

.detector-row.not-fired {
    border-left: 3px solid var(--border-color);
    opacity: 0.75;
}

.detector-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.detector-name {
    font-size: 14px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.detector-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detector-status.fired { color: var(--severity-critical); }
.detector-status.not-fired { color: var(--text-secondary); }

.detector-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.detector-detail strong {
    color: var(--text-body);
}

/* Fusion Decision Box */
.fusion-box {
    background: var(--bg-card);
    border: 2px solid var(--accent-purple);
    border-radius: 8px;
    padding: 20px;
    margin-top: 24px;
}

.fusion-box-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-purple);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.fusion-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.fusion-stat {
    text-align: center;
}

.fusion-stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.fusion-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Action buttons row */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.15s;
}

.pagination a:hover {
    background: var(--bg-hover);
}

.pagination .active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* --- Login Page --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-page);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-body);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.login-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--severity-critical);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    color: var(--severity-critical);
    font-size: 13px;
    text-align: center;
}

/* --- Utilities --- */
.text-secondary { color: var(--text-secondary); }
.text-mono { font-family: 'JetBrains Mono', monospace; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 14px;
}

/* --- HTMX Loading Indicator --- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Chart Container --- */
.chart-container {
    position: relative;
    height: 200px;
    padding: 16px;
}

/* --- Environment Color Themes --- Session 184: visual distinction for Local vs Hetzner */
/* Top accent bar on main content */
.main-content {
    border-top: 3px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}

/* Environment label badge */
.env-label {
    position: fixed;
    top: 0;
    right: 0;
    padding: 2px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 200;
    border-radius: 0 0 0 6px;
}

/* Theme: Breeze (teal) — background only, cards stay default */
body[data-env-theme="breeze"] { background: #1a4540 !important; }
body[data-env-theme="breeze"] .main-content { border-top-color: #00d1b2; background: #1a4540 !important; }
body[data-env-theme="breeze"] .env-label { background: rgba(0, 209, 178, 0.9); color: #000; }

/* Theme: Slate (cool grey) */
body[data-env-theme="slate"] { background: #282d3a !important; }
body[data-env-theme="slate"] .main-content { border-top-color: #6e7681; background: #282d3a !important; }
body[data-env-theme="slate"] .env-label { background: rgba(110, 118, 129, 0.9); color: #fff; }

/* Theme: Sand (light warm sand) */
body[data-env-theme="sand"] { background: #3a3228 !important; }
body[data-env-theme="sand"] .main-content { border-top-color: #c9a96e; background: #3a3228 !important; }
body[data-env-theme="sand"] .env-label { background: rgba(201, 169, 110, 0.9); color: #000; }

/* Theme: Ember (warm orange) */
body[data-env-theme="ember"] { background: #3a2a1e !important; }
body[data-env-theme="ember"] .main-content { border-top-color: #f0883e; background: #3a2a1e !important; }
body[data-env-theme="ember"] .env-label { background: rgba(240, 136, 62, 0.9); color: #000; }

/* Theme: Forest (green) */
body[data-env-theme="forest"] { background: #1a4028 !important; }
body[data-env-theme="forest"] .main-content { border-top-color: #3fb950; background: #1a4028 !important; }
body[data-env-theme="forest"] .env-label { background: rgba(63, 185, 80, 0.9); color: #000; }

/* Theme: Ice (blue) */
body[data-env-theme="ice"] { background: #1a2a48 !important; }
body[data-env-theme="ice"] .main-content { border-top-color: #58a6ff; background: #1a2a48 !important; }
body[data-env-theme="ice"] .env-label { background: rgba(88, 166, 255, 0.9); color: #000; }

/* No theme / local default — no tint */
body:not([data-env-theme]) .env-label,
body[data-env-theme=""] .env-label {
    display: none;
}

/* Theme picker dots */
.theme-picker {
    display: flex;
    gap: 5px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.theme-dot:hover {
    transform: scale(1.2);
}

.theme-dot.active {
    border-color: var(--text-primary);
}

.theme-dot[data-theme="breeze"]  { background: #00d1b2; }
.theme-dot[data-theme="slate"]   { background: #6e7681; }
.theme-dot[data-theme="sand"]    { background: #c9a96e; }
.theme-dot[data-theme="ember"]   { background: #f0883e; }
.theme-dot[data-theme="forest"]  { background: #3fb950; }
.theme-dot[data-theme="ice"]     { background: #58a6ff; }
.theme-dot[data-theme="none"]    { background: var(--bg-page); border: 2px solid var(--border-color); }

/* --- Session 187: SOC-style Detections Page --- */

/* Severity summary bar (Sentinel-inspired) */
.severity-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.severity-bar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.severity-bar-count {
    font-size: 20px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 24px;
    text-align: right;
}

.severity-bar-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.severity-bar-item.critical .severity-bar-count { color: var(--severity-critical); }
.severity-bar-item.high .severity-bar-count { color: var(--severity-high); }
.severity-bar-item.medium .severity-bar-count { color: var(--severity-medium); }
.severity-bar-item.low .severity-bar-count { color: var(--severity-low); }
.severity-bar-item.triage-new .severity-bar-count { color: #58a6ff; }
.severity-bar-item.triage-inv .severity-bar-count { color: #d29922; }
.severity-bar-item.triage-ok .severity-bar-count { color: #3fb950; }

.severity-bar-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Incident table */
.incident-table tr.incident-row {
    cursor: pointer;
    transition: background 0.15s;
}

.incident-table tr.incident-row:hover {
    background: var(--bg-hover);
}

.incident-table tr.incident-row.expanded {
    background: var(--bg-hover);
    border-bottom: none;
}

.incident-table tr.incident-detail-row td {
    border-top: none;
}

/* Detector pill (compact badge for detector names) */
.detector-pill {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(88,166,255,0.1);
    color: #58a6ff;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

/* Fused count badge */
.fused-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: rgba(137,87,229,0.2);
    color: #8957e5;
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* Confidence inline (no bar, just colored text) */
.confidence-inline {
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.confidence-inline.critical { color: var(--severity-critical); }
.confidence-inline.high { color: var(--severity-high); }
.confidence-inline.medium { color: var(--severity-medium); }
.confidence-inline.low { color: var(--severity-low); }

/* Expanded incident detail panel */
.incident-detail-panel {
    padding: 16px 20px;
    border-left: 3px solid var(--accent-purple);
    background: var(--bg-page);
}

/* Fusion summary bar in detail */
.detail-fusion-bar {
    display: flex;
    gap: 24px;
    padding: 10px 14px;
    background: rgba(137,87,229,0.08);
    border: 1px solid rgba(137,87,229,0.2);
    border-radius: 6px;
    margin-bottom: 16px;
}

.detail-fusion-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-fusion-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-fusion-value {
    font-size: 16px;
    font-weight: 700;
}

/* Sections within detail panel */
.detail-section {
    margin-bottom: 16px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Individual detection card within expanded incident */
.detail-detection-card {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 6px;
}

.detail-detection-card:last-child {
    margin-bottom: 0;
}

.detail-detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.detail-detection-details {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    line-height: 1.4;
}

.detail-detection-actions {
    display: flex;
    align-items: center;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 6px;
}

/* Detector scores grid in detail */
.detail-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.detail-score-item {
    padding: 8px 10px;
    border-radius: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.detail-score-item.fired {
    border-left: 3px solid var(--severity-critical);
}

.detail-score-item.silent {
    opacity: 0.6;
}

/* Log timeline (trace_id correlated entries) */
.log-timeline {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    max-height: 300px;
    overflow-y: auto;
}

.log-timeline-entry {
    display: flex;
    gap: 8px;
    padding: 3px 10px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: baseline;
    line-height: 1.5;
}

.log-timeline-entry:last-child {
    border-bottom: none;
}

.log-timeline-entry:hover {
    background: var(--bg-hover);
}

.log-timeline-entry.error {
    background: rgba(248,81,73,0.06);
}

.log-timeline-entry.warning {
    background: rgba(210,153,34,0.06);
}

.log-ts {
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 10px;
}

.log-level {
    font-weight: 700;
    font-size: 9px;
    padding: 0px 4px;
    border-radius: 2px;
    flex-shrink: 0;
    text-align: center;
    min-width: 32px;
}

.log-level-info { color: var(--accent-teal); }
.log-level-debug { color: var(--text-secondary); }
.log-level-warning { color: var(--severity-medium); }
.log-level-error { color: var(--severity-critical); }

.log-module {
    color: var(--accent-purple);
    flex-shrink: 0;
    min-width: 90px;
    font-size: 10px;
}

.log-msg {
    color: var(--text-body);
    word-break: break-word;
}

/* Spin animation for loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

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

    .filter-bar {
        flex-direction: column;
    }
}
