/* Palette: blu-notte neutro, superfici con contrasto leggero, accento blu-indaco */
:root {
    --bg-main: #080b12;
    --bg-sidebar: #0b0f18;
    --bg-card: #0f141f;
    --bg-card-hover: #151c2a;
    --border-color: #1d2535;
    --border-soft: rgba(148, 163, 184, 0.08);
    --text-primary: #e6ebf3;
    --text-secondary: #8b96a9;
    --text-muted: #5d6879;
    --primary-blue: #4f7dff;
    --primary-blue-hover: #3f6cf0;
    --accent-cyan: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #4f7dff 0%, #7c5cff 55%, #22d3ee 100%);
    --radius-lg: 14px;
    --radius-md: 10px;
    --side-nav-width: 252px;
    --side-nav-collapsed: 72px;
    --topbar-height: 64px;

    --sev-critical: #ef4444;
    --sev-critical-bg: rgba(239, 68, 68, 0.15);
    --sev-high: #f97316;
    --sev-high-bg: rgba(249, 115, 22, 0.15);
    --sev-medium: #eab308;
    --sev-medium-bg: rgba(234, 179, 8, 0.15);
    --sev-low: #3b82f6;
    --sev-low-bg: rgba(59, 130, 246, 0.15);
    --sev-info: #64748b;
    --sev-info-bg: rgba(100, 116, 139, 0.15);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    background-image: radial-gradient(1200px 600px at 85% -10%, rgba(79, 125, 255, 0.08), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* LOGIN LAYOUT */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a, #0b0f19);
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.shield-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* CARDS & CONTAINERS */
.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 40%), var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    margin-bottom: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: #2a3550;
}

.card h2 {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

/* FORMS & BUTTONS */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    background: #0a0e17;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.18);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: inherit;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-blue-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--border-color);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #ef444455;
    color: #f87171;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.07);
}

.btn-glow {
    background: var(--accent-gradient);
    background-size: 160% 100%;
    box-shadow: 0 6px 20px -6px rgba(79, 125, 255, 0.7);
}

.btn-glow:hover {
    background-position: 100% 0;
    box-shadow: 0 8px 26px -6px rgba(124, 92, 255, 0.8);
}

.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Icone SVG (sprite in index.html, stile lucide) */
.i {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.i-sm {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
    opacity: 0.7;
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}

.alert-error {
    background: var(--sev-critical-bg);
    border: 1px solid var(--sev-critical);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #86efac;
}

.hidden {
    display: none !important;
}

/* ==================== APP SHELL ====================
   Sidebar fissa a sinistra (brand, gruppi Sicurezza/Operatività/Contenuto, piede con Impostazioni/Logout/Comprimi)
   + colonna principale con topbar sticky. body.side-nav-collapsed = sole icone (desktop),
   body.side-nav-open = drawer aperto (sotto i 900px). */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.main-side-nav {
    position: sticky;
    top: 0;
    flex: 0 0 var(--side-nav-width);
    width: var(--side-nav-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 14px 12px;
    z-index: 70;
    transition: width 0.2s ease, flex-basis 0.2s ease;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
}

.brand-mark {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 6px 18px -6px rgba(79, 125, 255, 0.8);
}

.brand-mark .i {
    width: 20px;
    height: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-host {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.side-nav-groups {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
    scrollbar-width: thin;
}

.side-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 18px;
}

.nav-group-label {
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.main-side-nav .nav-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 38px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-tab-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-side-nav .nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.main-side-nav .nav-tab:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: -2px;
}

.main-side-nav .nav-tab.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79, 125, 255, 0.22), rgba(79, 125, 255, 0.06));
    box-shadow: inset 0 0 0 1px rgba(79, 125, 255, 0.25);
}

.main-side-nav .nav-tab.active .i {
    color: #8fb0ff;
}


.main-side-nav .nav-tab-danger:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

.side-nav-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.side-collapse-btn .i {
    transition: transform 0.2s ease;
}

/* Modalità compressa: solo icone, il nome compare come tooltip nativo (title) */
@media (min-width: 901px) {
    body.side-nav-collapsed .main-side-nav {
        flex-basis: var(--side-nav-collapsed);
        width: var(--side-nav-collapsed);
    }

    body.side-nav-collapsed .brand-text,
    body.side-nav-collapsed .nav-tab-text {
        display: none;
    }

    body.side-nav-collapsed .side-brand {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.side-nav-collapsed .nav-group-label {
        font-size: 0;
        height: 1px;
        margin: 4px 12px 8px;
        padding: 0;
        background: var(--border-soft);
    }

    body.side-nav-collapsed .main-side-nav .nav-tab {
        justify-content: center;
        padding: 8px 0;
    }

    body.side-nav-collapsed .side-collapse-btn .i {
        transform: scaleX(-1);
    }
}

/* Colonna principale + topbar */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--topbar-height);
    padding: 10px 28px;
    background: rgba(8, 11, 18, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.topbar-crumb {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.topbar-title h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
}

.side-nav-toggle,
.side-nav-backdrop {
    display: none;
}

/* SETTINGS DROPDOWN (top-right, account-menu style) */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 6px;
    z-index: 100;
}

.dropdown-menu-section {
    padding: 6px 10px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.dropdown-item .i {
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary-blue);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 4px;
}

/* Drawer sotto i 900px */
@media (max-width: 900px) {
    .side-nav-toggle {
        display: inline-grid;
    }

    .main-side-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: auto;
        width: 272px;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 200;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.55);
    }

    .side-collapse-btn {
        display: none !important;
    }

    body.side-nav-open .main-side-nav {
        transform: translateX(0);
    }

    body.side-nav-open .side-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 4, 8, 0.6);
        backdrop-filter: blur(2px);
        z-index: 150;
    }

    .topbar {
        padding: 10px 16px;
    }

    .topbar-title h1 {
        font-size: 16px;
    }

    #settings-dropdown-btn span {
        display: none;
    }
}

@media (max-width: 520px) {
    #run-audit-btn .btn-label {
        display: none;
    }
}

/* Icone nei titoli (h2/h3/h4) e nei pulsanti: sostituiscono le vecchie emoji */
h2 .h-icon,
h3 .h-icon,
h4 .h-icon {
    vertical-align: -3px;
    margin-right: 7px;
    color: var(--primary-blue);
}

.btn .i {
    flex-shrink: 0;
}

/* Pallini di severità nei filtri (al posto delle emoji colorate) */
.sev-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: 1px;
}

.sev-dot-critical { background: var(--sev-critical); }
.sev-dot-high { background: var(--sev-high); }
.sev-dot-medium { background: var(--sev-medium); }
.sev-dot-low { background: var(--sev-low); }

/* TAB PAGES */
.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

/* DASHBOARD MAIN — min-width: 0 evita che tabelle larghe allarghino la colonna oltre lo schermo */
.dashboard-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

@media (max-width: 900px) {
    .dashboard-container {
        padding: 16px 16px 40px;
    }
}

/* Pagina Impostazioni: due colonne, una sola su schermi stretti */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Card troppo densa di campi per stare in metà griglia (es. SEO Agent & HMAC) */
.settings-card-wide {
    grid-column: 1 / -1;
}

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

/* COMPACT BANNER (IMAGE 2 COMPACT) */
.banner-compact {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.score-card-compact {
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 0;
}

.score-circle-compact {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--sev-critical);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background: radial-gradient(circle, rgba(239,68,68,0.1) 0%, transparent 70%);
}

.score-card-compact .score-val {
    font-size: 24px;
    font-weight: 800;
}

.stats-card-compact {
    padding: 14px;
    margin-bottom: 0;
}

.stats-grid-compact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.stat-box-compact {
    padding: 8px 10px !important;
    border-radius: 6px;
    text-align: center;
}

.stat-box-compact .stat-num {
    font-size: 20px !important;
}

.stat-box-compact .stat-label {
    font-size: 11px !important;
}

.grade-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 12px;
    background: var(--border-color);
    margin-bottom: 4px;
}

.last-update {
    font-size: 11px;
    color: var(--text-secondary);
}

.agent-token-badge {
    font-size: 10px;
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid #38bdf855;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-family: monospace;
}

/* REAL-TIME PROCESS MONITOR */
.process-monitor-card {
    margin-bottom: 16px;
}

.process-monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 440px;
    overflow-y: auto;
}

.process-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.process-table th {
    background: #0d1322;
    padding: 10px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.process-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.process-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* TABELLA WAF/HTTP CLICCABILE - riga principale con solo i campi
   essenziali, i secondari (Header HTTP, User-Agent, Messaggio, Azione)
   compaiono in una riga di dettaglio ad espansione. Stile Material Design:
   elevazione al passaggio del mouse (box-shadow, non solo cambio colore),
   transizione morbida, chevron che ruota per indicare lo stato aperto/chiuso -
   niente libreria esterna, solo CSS sul sistema di classi già esistente. */
.waf-log-table tbody tr.waf-row-main {
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.waf-log-table tbody tr.waf-row-main:hover {
    background: var(--bg-card-hover);
    box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0.04);
}

.waf-row-expand-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    font-size: 11px;
}

.waf-row-main.expanded .waf-row-expand-icon {
    transform: rotate(90deg);
    color: var(--primary-blue);
}

.waf-row-detail {
    display: none;
}

.waf-row-detail.expanded {
    display: table-row;
}

.waf-row-detail td {
    background: #0d1322;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: inset 0 4px 6px -6px rgba(0, 0, 0, 0.5);
}

.waf-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 20px;
}

.waf-detail-field {
    font-size: 12px;
}

.waf-detail-field .waf-detail-label {
    display: block;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 3px;
}

.waf-detail-field .waf-detail-value {
    color: var(--text-primary);
    word-break: break-word;
}

/* FILTERS SECTION */
.filters-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.filter-tabs {
    display: flex;
    gap: 6px;
}

.tab-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.search-box {
    flex-grow: 1;
    max-width: 280px;
}

/* FINDINGS CARDS */
.findings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.finding-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--sev-info);
    border-radius: 8px;
    padding: 16px;
}

.finding-card.severity-CRITICAL { border-left-color: var(--sev-critical); }
.finding-card.severity-HIGH { border-left-color: var(--sev-high); }
.finding-card.severity-MEDIUM { border-left-color: var(--sev-medium); }
.finding-card.severity-LOW { border-left-color: var(--sev-low); }

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.finding-title {
    font-size: 15px;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-CRITICAL { background: var(--sev-critical-bg); color: var(--sev-critical); border: 1px solid var(--sev-critical); }
.badge-HIGH { background: var(--sev-high-bg); color: var(--sev-high); border: 1px solid var(--sev-high); }
.badge-MEDIUM { background: var(--sev-medium-bg); color: var(--sev-medium); border: 1px solid var(--sev-medium); }
.badge-LOW { background: var(--sev-low-bg); color: var(--sev-low); border: 1px solid var(--sev-low); }

/* AZIONE WAF (Block/Allow/Challenge) - riusa le stesse variabili colore
   della severità (--sev-critical=rosso, --sev-medium=giallo, --sev-low=blu),
   coincidenza comoda ma è un asse concettualmente diverso (esito della
   richiesta, non gravità della regola) - da qui classi semantiche a parte
   invece di riusare .badge-CRITICAL/MEDIUM/LOW direttamente.
   "Challenge" non ha un equivalente in ModSecurity (nessun dato lo popola
   oggi - vedi auditor/modsecurity_control.py): la classe resta pronta per
   quando/se un giorno arriverà una fonte WAF che lo supporta davvero (es.
   Cloudflare), non va usata con dati inventati. */
.badge-waf-block     { background: var(--sev-critical-bg); color: var(--sev-critical); border: 1px solid var(--sev-critical); }
.badge-waf-allow     { background: var(--sev-medium-bg);   color: var(--sev-medium);   border: 1px solid var(--sev-medium); }
.badge-waf-challenge { background: var(--sev-low-bg);      color: var(--sev-low);      border: 1px solid var(--sev-low); }

/* STATUS BADGES */
.status-PASS { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid #22c55e; }
.status-FAIL { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid #ef4444; }
.status-WARN { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid #eab308; }
.status-MANUAL { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid #a855f7; }
.status-NA { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid #64748b; }
.status-ERROR { background: rgba(225, 29, 72, 0.2); color: #fb7185; border: 1px solid #e11d48; }

.finding-desc {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: #0d1322;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 10px;
}

.setting-title {
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}

.setting-val {
    font-family: monospace;
    word-break: break-all;
}

.diff-box {
    background: #080c14;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.rationale {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.finding-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

.badge-custom {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
    border: 1px solid #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

.edit-textarea {
    width: 100%;
    background: #0d1322;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 8px;
    font-size: 13px;
    outline: none;
}

.code-font {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
}

/* SPINNER */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary-blue);
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* MODAL */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 750px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* VERTICAL TABS LAYOUT (Config WP Plugin) */
.vertical-tabs-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.vertical-tabs-menu {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-card, #0f172a);
    border: 1px solid var(--border-color, #1e293b);
    border-radius: 10px;
    padding: 12px;
}

.vtab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary, #94a3b8);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vtab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.vtab-btn.active {
    background: var(--primary-blue, #3b82f6);
    color: #ffffff;
    font-weight: 600;
    border-color: var(--primary-blue, #3b82f6);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.vtab-icon {
    font-size: 16px;
}

.vertical-tabs-content {
    flex: 1;
    min-width: 0;
}

.vtab-panel {
    display: none;
}

.vtab-panel.active {
    display: block;
}

@media (max-width: 768px) {
    .vertical-tabs-layout {
        flex-direction: column;
    }
    .vertical-tabs-menu {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
}

/* ==================== TOAST DI SALVATAGGIO ==================== */
/* Conferma visibile (non solo il testo accanto al pulsante, facile da
   perdere) quando un salvataggio finisce, successo o errore. */
#scc-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.scc-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-blue);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.scc-toast.scc-toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.scc-toast.scc-toast-success {
    border-left-color: #22c55e;
}

.scc-toast.scc-toast-error {
    border-left-color: #ef4444;
}

.scc-toast-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.scc-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 0 0 8px;
    flex-shrink: 0;
}

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

/* ===== RILIEVI SEO: chip di severita' + ricerca (redesign 2026-10-09,
   look Linear/Vercel - sostituisce le vecchie tab emoji della vista
   aggregata per regola; i dot usano la palette --sev-* esistente) ===== */
.seo-sev-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sev-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sev-chip:hover {
    border-color: var(--primary-blue);
    color: var(--text-primary);
}

.sev-chip.active {
    background: rgba(79, 125, 255, 0.12);
    border-color: var(--primary-blue);
    color: var(--text-primary);
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.chip-dot-all { background: var(--text-secondary); }
.chip-dot-critical { background: var(--sev-critical); }
.chip-dot-warning { background: var(--sev-medium); }
.chip-dot-info { background: var(--sev-low); }

/* La ricerca nella card rilievi e' larga al massimo 320px (il resto dei
   campi da form resta width:100% per la regola globale input[type=text]). */
.seo-search-input {
    width: auto;
    flex: 0 1 320px;
    max-width: 320px;
    padding: 8px 14px;
    font-size: 13px;
}
