:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #11161d;
    --bg-card: #161b22;
    --border: #1f2733;
    --border-bright: #2a3441;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #00aaff;
    --accent-dim: #0077b3;
    --accent-glow: rgba(0, 170, 255, 0.18);
    --danger: #ff4d6d;
    --danger-bg: rgba(255, 77, 109, 0.1);
    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

#dotted-surface {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

#dotted-surface canvas {
    display: block;
}

/* Ensure foreground content stays above the animated background */
.auth-container,
.topbar,
.page {
    position: relative;
    z-index: 1;
}

/* ----- Auth screens (Login + Register) ----- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow:
        0 0 0 1px var(--accent-glow),
        0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.auth-card--hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 8px 8px 0 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* ----- Splash overlay (shown before login form) ----- */
.splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    padding: 2rem;
    text-align: center;
    transition: opacity 0.6s ease, transform 0.6s ease;
    animation: splash-in 0.8s ease-out;
}

.splash--out {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.04);
}

.splash-hint {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation: splash-pulse 2.2s ease-in-out infinite;
}

@keyframes splash-pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

@keyframes splash-in {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.brand-logo-xl {
    max-width: min(676px, 92vw);
    margin: 0 auto 1rem;
    filter: drop-shadow(0 0 32px rgba(0, 170, 255, 0.5));
}

/* ----- Brand logo ----- */
.brand-logo {
    display: flex;
    justify-content: center;
    margin: 0 auto 1rem;
    max-width: 280px;
    filter: drop-shadow(0 0 18px rgba(0, 170, 255, 0.35));
}

.brand-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.brand-logo-sm {
    max-width: 130px;
    margin: 0;
    filter: drop-shadow(0 0 10px rgba(0, 170, 255, 0.35));
}

/* ----- Brand text ----- */
.brand-tagline {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.brand-divider {
    width: 60px;
    height: 1px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ----- Forms ----- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    margin-top: 0.5rem;
}

.btn-primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-bright);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ----- Auth footer link ----- */
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ----- Flash messages ----- */
.flash-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.flash {
    padding: 0.875rem 1rem;
    border-radius: 4px;
    border: 1px solid;
    font-size: 0.875rem;
    animation: slide-in 0.3s ease-out;
}

.flash-error {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

@keyframes slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ----- Topbar (Dashboard) ----- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-bright);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.brand-name-sub {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.user-info strong {
    color: var(--accent);
}

/* ----- Top navigation links ----- */
.topbar-nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

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

.nav-link--active {
    color: var(--accent);
    border-color: var(--border-bright);
    background: var(--bg-card);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ----- Page layout ----- */
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* ----- Stat cards (dashboard) ----- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card--critical {
    border-color: var(--danger);
    box-shadow: inset 0 0 20px rgba(255, 77, 109, 0.08);
}

.stat-card--critical .stat-value { color: var(--danger); }

.stat-card--high {
    border-color: #ff9d3d;
    box-shadow: inset 0 0 20px rgba(255, 157, 61, 0.08);
}

.stat-card--high .stat-value { color: #ff9d3d; }

/* ----- Dashboard / page header with live indicator + actions ----- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ----- Auto-refresh toggle ----- */
.btn-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.95rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 999px;
}

.auto-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-toggle[data-active="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

.btn-toggle[data-active="true"] .auto-dot {
    background: var(--accent);
    animation: live-pulse 1.5s ease-out infinite;
    box-shadow: 0 0 0 0 rgba(0, 170, 255, 0.7);
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3fb950;
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.7);
    animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(63, 185, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

.live-label { color: var(--success); font-weight: 600; }
.live-time  { color: var(--text-muted); }

/* Stat-grid override: 5 columns on wide screens */
.stats-grid-5 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* ----- Dashboard layout grids ----- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ----- Generic panel ----- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.panel-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.panel-link {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    text-decoration: none;
}

.panel-link:hover { text-decoration: underline; }

/* ----- Chart containers (fixed height for Chart.js responsive) ----- */
.chart-container {
    position: relative;
    height: 240px;
}

.chart-container--donut { height: 280px; }

/* ----- Top-IPs ranked list ----- */
.rank-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rank-item { display: block; }

.rank-link {
    display: grid;
    grid-template-columns: 28px 130px 1fr 50px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.rank-link:hover { background: rgba(0, 170, 255, 0.06); }

.rank-pos {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.rank-name {
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.rank-bar {
    display: block;
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.rank-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    border-radius: 999px;
}

.rank-count {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ----- Latest critical events list ----- */
.event-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.event-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    border-left: 3px solid var(--danger);
}

.event-body { min-width: 0; }

.event-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.event-type {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.event-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.event-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.event-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.event-meta code {
    color: var(--text-secondary);
    font-family: inherit;
    background: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ----- Dashboard card (generic content panel, kept for legacy) ----- */
.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 2rem;
}

.dashboard-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.dashboard-card p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dashboard-card a {
    color: var(--accent);
    text-decoration: none;
}

.dashboard-card a:hover { text-decoration: underline; }

/* ----- Filter bar (logs page) ----- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 180px;
}

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

.filter-group input,
.filter-group select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    padding: 0.55rem 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-actions .btn { margin-top: 0; padding: 0.55rem 1rem; }

/* ----- Log table ----- */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    overflow: hidden;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.log-table thead th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-bright);
    white-space: nowrap;
}

.log-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.1s;
}

.log-table tbody tr:hover {
    background: rgba(0, 170, 255, 0.04);
}

.log-table tbody tr:last-child { border-bottom: none; }

.log-table td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.cell-time { color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-type { font-weight: 500; }
.cell-ip   { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-msg  { color: var(--text-secondary); }

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem !important;
    font-style: italic;
}

/* ----- Severity badges ----- */
.severity-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid;
    white-space: nowrap;
}

.severity-low {
    color: #8b949e;
    border-color: #555c66;
    background: rgba(139, 148, 158, 0.1);
}

.severity-medium {
    color: #f1c40f;
    border-color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
}

.severity-high {
    color: #ff9d3d;
    border-color: #ff9d3d;
    background: rgba(255, 157, 61, 0.12);
}

.severity-critical {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(255, 77, 109, 0.12);
    box-shadow: 0 0 10px rgba(255, 77, 109, 0.25);
}

/* ----- Clickable log rows ----- */
.log-row {
    cursor: pointer;
}

.log-row:focus {
    outline: none;
    background: rgba(0, 170, 255, 0.07);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* ----- Detail modal ----- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}

.modal[aria-hidden="false"] {
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal[aria-hidden="false"] .modal-backdrop {
    opacity: 1;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 2rem);
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px var(--accent-glow),
        0 30px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    transform: translateY(16px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal[aria-hidden="false"] .modal-card {
    opacity: 1;
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.modal-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-fields > div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-fields dt {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.modal-fields dd {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.modal-section { margin-bottom: 1.25rem; }
.modal-section:last-child { margin-bottom: 0; }

.modal-section h3 {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modal-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block--hex {
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    white-space: pre;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.modal-footer .btn { margin-top: 0; }

/* ----- Playbook section in modal ----- */
.playbook-section {
    background: rgba(0, 170, 255, 0.04);
    border: 1px solid var(--accent-glow);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 1rem 1.25rem;
}

.playbook-section h3 { color: var(--accent); }

.playbook-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.playbook-tactic {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.playbook-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.playbook-subsection {
    margin-top: 1rem;
}

.playbook-subsection h4 {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.action-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-left: 0;
}

.action-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 0.4rem 0.6rem;
    background: var(--bg-primary);
    border-radius: 4px;
    border-left: 2px solid var(--accent-dim);
}

.action-check {
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}

.indicator-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-left: 0;
}

.indicator-list li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-left: 1rem;
    position: relative;
    line-height: 1.4;
}

.indicator-list li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: var(--text-muted);
    font-weight: 700;
}

/* ----- MITRE & priority badges ----- */
.mitre-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    background: rgba(0, 170, 255, 0.12);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid;
    white-space: nowrap;
}

.priority-low      { color: #8b949e; border-color: #555c66;  background: rgba(139, 148, 158, 0.1); }
.priority-medium   { color: #f1c40f; border-color: #f1c40f;  background: rgba(241, 196, 15, 0.1); }
.priority-high     { color: #ff9d3d; border-color: #ff9d3d;  background: rgba(255, 157, 61, 0.12); }
.priority-critical { color: var(--danger); border-color: var(--danger); background: rgba(255, 77, 109, 0.12); }

/* ----- Top threats panel on dashboard ----- */
.panel-full {
    margin-bottom: 1.5rem;
}

.threat-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.threat-link {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.threat-link:hover {
    background: rgba(0, 170, 255, 0.05);
    border-color: var(--accent-glow);
}

.threat-body { min-width: 0; }

.threat-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.threat-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.threat-tactic {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.threat-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   AI Analysis section (Llama)
   ============================================================ */
.ai-section {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.06), rgba(0, 170, 255, 0.02));
    border: 1px solid rgba(0, 170, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
}
.ai-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}
.ai-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(0, 170, 255, 0.18);
    color: var(--accent);
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}
.ai-hint {
    color: #8b949e;
    font-size: 0.85rem;
    margin: 4px 0 12px 0;
}
.ai-btn {
    margin-bottom: 12px;
}
.ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ai-output {
    background: #0a0e14;
    border: 1px solid #1f2733;
    border-radius: 6px;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #e6edf3;
    white-space: pre-wrap;
    min-height: 60px;
    position: relative;
}
.ai-output--streaming::after {
    content: '▊';
    color: var(--accent);
    animation: ai-blink 1s steps(2) infinite;
    margin-left: 2px;
}
.ai-output--done {
    border-color: rgba(0, 170, 255, 0.3);
}
@keyframes ai-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
