/* ============================================================
   style.css — Stile comune Monitor Siti
   ============================================================ */

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

:root {
    --bg:        #0f1117;
    --surface:   #1a1d27;
    --border:    #2a2e3d;
    --accent:    #4f7ef8;
    --accent-h:  #3d6de6;
    --text:      #e8eaf0;
    --text-muted:#7b8099;
    --ok:        #4ade80;
    --ok-bg:     #0f2a1a;
    --warn:      #facc15;
    --warn-bg:   #2a2200;
    --err:       #f87171;
    --err-bg:    #2a1010;
    --radius:    10px;
    --font:      'DM Sans', sans-serif;
    --mono:      'DM Mono', monospace;
    --nav-w:     220px;
}

/* ============================================================
   BASE
   ============================================================ */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    background-image:
        linear-gradient(rgba(79,126,248,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,126,248,.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Body per pagine standalone (login) */
body.centered {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--nav-w);
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    margin-bottom: 36px;
}

.logo-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 16px; height: 16px;
    fill: none; stroke: #fff;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.logo-name { font-size: 14px; font-weight: 500; }

.nav-section {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin: 20px 0 6px;
    opacity: .6;
}

nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}

nav a:hover  { background: rgba(255,255,255,.05); color: var(--text); }
nav a.active { background: rgba(79,126,248,.15);  color: var(--accent); }

nav a svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
}

.avatar {
    width: 30px; height: 30px;
    background: rgba(79,126,248,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 500;
    color: var(--accent);
    flex-shrink: 0;
}

.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 4px;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.btn-logout:hover { background: rgba(248,113,113,.1); color: var(--err); }
.btn-logout svg   { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
    margin-left: var(--nav-w);
    flex: 1;
    padding: 32px;
    max-width: calc(100vw - var(--nav-w));
}

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

.page-title { font-size: 22px; font-weight: 500; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   BOTTONI
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity .15s, transform .1s, background .15s;
}

.btn:active { transform: scale(.97); }

.btn svg {
    width: 14px; height: 14px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #3d4259; background: rgba(255,255,255,.03); }

.btn-danger { background: transparent; border: 1px solid rgba(248,113,113,.3); color: var(--err); }
.btn-danger:hover { background: var(--err-bg); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s;
}

.btn-icon:hover { background: rgba(255,255,255,.06); color: var(--text); }
.btn-icon.danger:hover { background: var(--err-bg); color: var(--err); border-color: rgba(248,113,113,.3); }
.btn-icon svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeUp .3s ease both;
}

.card-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    width: 16px; height: 16px;
    fill: none; stroke: var(--accent);
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ============================================================
   FORM
   ============================================================ */
.form-grid   { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.form-full   { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 16px; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: .03em;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,126,248,.12);
}

input::placeholder, textarea::placeholder { color: #3d4259; }
textarea { resize: vertical; min-height: 70px; }

select { appearance: none; cursor: pointer; }

/* ============================================================
   FLASH / ALERT
   ============================================================ */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-ok  { background: var(--ok-bg);  border: 1px solid rgba(74,222,128,.2);  color: var(--ok);  }
.flash-err { background: var(--err-bg); border: 1px solid rgba(248,113,113,.2); color: var(--err); }
.flash-warn{ background: var(--warn-bg);border: 1px solid rgba(250,204,21,.2);  color: var(--warn);}

/* ============================================================
   BADGE
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.badge::before {
    content: '';
    display: block;
    width: 6px; height: 6px;
    border-radius: 50%;
}

.badge-ok::before      { background: var(--ok); }
.badge-warning::before { background: var(--warn); }
.badge-error::before   { background: var(--err); }
.badge-nodata::before,
.badge-off::before     { background: var(--text-muted); }

.badge-ok      { background: var(--ok-bg);                    color: var(--ok); }
.badge-warning { background: var(--warn-bg);                  color: var(--warn); }
.badge-error   { background: var(--err-bg);                   color: var(--err); }
.badge-nodata,
.badge-off     { background: rgba(123,128,153,.1);            color: var(--text-muted); }

/* ============================================================
   TABELLA
   ============================================================ */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    animation: fadeUp .3s ease .1s both;
}

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

.table-title { font-size: 15px; font-weight: 500; }
.table-count { font-size: 12px; color: var(--text-muted); font-family: var(--mono); margin-left: 8px; }

.search-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    padding: 7px 12px;
    outline: none;
    width: 200px;
    transition: border-color .15s;
}

.search-box:focus { border-color: var(--accent); }
.search-box::placeholder { color: #3d4259; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
    text-align: left;
    padding: 10px 20px;
    font-size: 11px;
    font-family: var(--mono);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 400;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
}

tbody tr {
    border-bottom: 1px solid rgba(42,46,61,.6);
    transition: background .12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: rgba(255,255,255,.02); }
tbody tr.inactive   { opacity: .45; }

td { padding: 12px 20px; vertical-align: middle; }

.date-cell { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
.actions   { display: flex; gap: 6px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    animation: fadeUp .3s ease both;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.stat-card:hover              { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.08); }
.stat-card--active            { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.12); background: var(--surface-alt); }

.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .10s; }
.stat-card:nth-child(4) { animation-delay: .15s; }

.stat-label {
    font-size: 12px;
    font-family: var(--mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-value      { font-size: 32px; font-weight: 300; line-height: 1; }
.stat-value.ok   { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.err  { color: var(--err); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    animation: fadeUp .2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-title  { font-size: 17px; font-weight: 500; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-danger .modal-title { color: var(--err); }

/* ============================================================
   LOGIN CARD (pagina standalone)
   ============================================================ */
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    animation: fadeUp .4s ease both;
}

.login-card .logo { margin-bottom: 32px; }
.login-card h1    { font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.login-card .subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }

.pw-toggle {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer; padding: 4px; line-height: 0;
}

.pw-toggle:hover { color: var(--text); }
.pw-toggle svg   { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.card-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    font-family: var(--mono);
    letter-spacing: .03em;
}

/* ============================================================
   SOTTOMENU SIDEBAR
   ============================================================ */
.nav-group { display: flex; flex-direction: column; }

.nav-parent-wrap {
    display: flex;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2px;
}

.nav-parent-wrap:hover { background: rgba(255,255,255,.05); }

.nav-parent-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px 9px 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    flex: 1;
    transition: color .15s;
    border-radius: 0;
    margin-bottom: 0;
}

.nav-parent-link:hover { background: none; color: var(--text); }
.nav-parent-link.active { color: var(--accent); }

.nav-parent-link svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}

.nav-arrow {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    transition: color .15s;
}

.nav-arrow:hover { color: var(--text); }

.nav-arrow svg {
    width: 14px; height: 14px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round;
    transition: transform .2s ease;
}

.nav-arrow.open svg { transform: rotate(180deg); }

.submenu {
    display: none;
    flex-direction: column;
    padding-left: 14px;
    border-left: 1px solid var(--border);
    margin-left: 20px;
    margin-top: 2px;
    margin-bottom: 2px;
}

.submenu.open { display: flex; }
.submenu a { font-size: 13px; padding: 7px 12px; }

/* Voci disabilitate (sezioni future) */
.nav-disabled {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--border);
    cursor: not-allowed;
    margin-bottom: 2px;
    user-select: none;
}

.nav-disabled svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}

/* ============================================================
   UTILITY CLASSES — sostituiscono stili inline ripetuti
   ============================================================ */

/* Testo */
.text-sm       { font-size: 13px; }
.text-xs       { font-size: 12px; }
.text-xxs      { font-size: 11px; }
.text-muted    { color: var(--text-muted); }
.text-ok       { color: var(--ok); }
.text-warn     { color: var(--warn); }
.text-err      { color: var(--err); }
.text-accent   { color: var(--accent); }
.text-mono     { font-family: var(--mono); }
.text-bold     { font-weight: 500; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.no-underline  { text-decoration: none; color: inherit; }

/* Subtitolo sezione (es. label sopra valore) */
.section-label {
    font-size: 11px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Testo secondario sotto un valore principale */
.sub-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sub-text-mono {
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-muted);
    margin-top: 2px;
}

/* Layout flex comuni */
.flex           { display: flex; }
.flex-center    { display: flex; align-items: center; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-end       { display: flex; align-items: center; justify-content: flex-end; }
.gap-6          { gap: 6px; }
.gap-8          { gap: 8px; }
.gap-10         { gap: 10px; }
.gap-12         { gap: 12px; }
.gap-16         { gap: 16px; }

/* Separatori */
.border-bottom  { border-bottom: 1px solid var(--border); }
.border-top     { border-top: 1px solid var(--border); }
.py-10          { padding-top: 10px; padding-bottom: 10px; }
.pt-16          { padding-top: 16px; }
.mt-4           { margin-top: 4px; }
.mt-8           { margin-top: 8px; }
.mt-12          { margin-top: 12px; }
.mt-16          { margin-top: 16px; }
.mb-12          { margin-bottom: 12px; }
.mb-16          { margin-bottom: 16px; }
.mb-20          { margin-bottom: 20px; }
.mb-24          { margin-bottom: 24px; }

/* Riga separata con bordo (usata in dettagli cliente, alert ecc.) */
.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

/* Box info (usato in sezioni tipo spazio disco, alert ecc.) */
.info-box {
    padding: 12px;
    background: rgba(79,126,248,.06);
    border: 1px solid rgba(79,126,248,.15);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

/* Paginazione */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: background .12s, color .12s;
}

.pagination-page:hover     { background: rgba(255,255,255,.05); color: var(--text); }
.pagination-page.active    { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Details/summary accordion: bordi e radius coerenti */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.accordion > summary {
    border-radius: var(--radius);
    transition: border-radius 0s;
}
details.accordion[open] > summary {
    border-radius: var(--radius) var(--radius) 0 0;
}
.accordion-arrow { transition: transform .2s; }
details.accordion[open] .accordion-arrow { transform: rotate(180deg); }

/* Accordion button */
.accordion-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.accordion-btn:hover { background: rgba(255,255,255,.02); }

.accordion-body {
    padding: 0 24px 24px;
    border-top: 1px solid var(--border);
}

/* Checkbox label inline */
.checkbox-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.checkbox-label input[type="checkbox"] { width: auto; }
.checkbox-label label { cursor: pointer; margin: 0; font-size: 13px; color: var(--text); }

/* Intestazione tabella light (usata in tabelle senza .table-wrap) */
.th-light {
    text-align: left;
    padding: 8px 0;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

/* ============================================================
   MOBILE TOPBAR + SIDEBAR OVERLAY
   (nascosti su desktop, attivi su mobile)
   ============================================================ */
.mobile-topbar {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   RESPONSIVE — mobile first
   ============================================================ */
@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid   { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    /* Previeni overflow orizzontale su mobile */
    html, body { overflow-x: hidden; }

    /* Topbar mobile fissa in cima */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 52px;
        padding: 0 16px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        z-index: 100;
    }

    .hamburger {
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 6px;
        border-radius: var(--radius);
        flex-shrink: 0;
        line-height: 0;
    }
    .hamburger:hover { background: var(--border); }
    .hamburger svg   { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

    .mobile-logo-name {
        flex: 1;
        font-size: 15px;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-logout {
        color: var(--text-muted);
        padding: 6px;
        border-radius: var(--radius);
        line-height: 0;
        text-decoration: none;
    }
    .mobile-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: block; }

    /* Sidebar nascosta di default, visibile con .open */
    .sidebar        { display: none; }
    .sidebar.open   {
        display: flex !important;
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 200;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
    }

    /* Main: offset per topbar fissa */
    .main {
        margin-left: 0;
        max-width: 100vw;
        padding: 16px;
        padding-top: 68px;
    }

    /* Griglia */
    .stats           { grid-template-columns: 1fr 1fr; }
    .form-grid       { grid-template-columns: 1fr; }
    .form-grid-3     { grid-template-columns: 1fr; }

    /* Page header su mobile diventa verticale */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Tabelle scrollabili orizzontalmente */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table       { min-width: 560px; }

    /* Azioni tabella più grandi su touch */
    .btn-icon { width: 36px; height: 36px; }

    /* Modal fullscreen su mobile */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        border-radius: 16px 16px 0 0;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Nasconde colonne non essenziali su mobile */
    .hide-mobile { display: none; }

    /* Bottoni affiancati diventano colonna */
    .page-header .btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
    .stats { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
}


/* ============================================================
   TOGGLE LABEL — checkbox stilizzato per flag monitoraggio
   ============================================================ */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    padding: 8px 0;
}
.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-label span { line-height: 1.4; }

/* BACK LINK */
.back-link {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 4px;
}
.back-link:hover { color: var(--accent); }

/* ============================================================
   TABS — navigazione a tab nelle schede detail
   ============================================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    transition: color .15s, background .15s;
    white-space: nowrap;
}
.tab:hover {
    color: var(--text);
    background: var(--hover);
}
.tab.active {
    color: var(--accent);
    background: var(--surface);
    border-color: var(--border);
    border-bottom: 2px solid var(--surface);
    margin-bottom: -2px;
    font-weight: 600;
}

/* BTN-ICON DANGER */
.btn-icon-danger { color: var(--err); }
.btn-icon-danger:hover { background: rgba(var(--err-rgb, 220,53,69),.1); }

/* ============================================================
   INFO TOOLTIP
   ============================================================ */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
}
.info-tip-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    color: var(--text-muted);
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    font-family: serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: border-color .15s, color .15s;
    user-select: none;
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: 0;
}
.info-tip:hover .info-tip-icon {
    border-color: var(--accent);
    color: var(--accent);
}
.info-tip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.4;
    padding: 7px 10px;
    border-radius: 6px;
    width: max-content;
    max-width: 200px;
    white-space: normal;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    pointer-events: none;
    text-transform: none;
    letter-spacing: 0;
}
.info-tip-text::after {
    content: '';
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a2e;
}
.info-tip:hover .info-tip-text { display: block; }

/* ============================================================
   Privacy Mode — blur dati sensibili per demo/video
   ============================================================ */
body.privacy-mode .sub-text-mono,
body.privacy-mode td .text-bold,
body.privacy-mode .detail-row .text-bold,
body.privacy-mode .uptime-row .text-bold,
body.privacy-mode .prospect-row .text-bold,
body.privacy-mode .sens,
body.privacy-mode [data-sensitive] {
    filter: blur(7px);
    user-select: none;
    transition: filter .25s;
    cursor: not-allowed;
}

#privacy-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: background .2s, color .2s, border-color .2s;
    font-family: inherit;
}
#privacy-toggle:hover {
    background: var(--hover);
    color: var(--text);
}
#privacy-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
#privacy-toggle svg {
    width: 14px; height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ============================================================
   LANDING PAGE — pricing.php, compare.php e pagine pubbliche
   ============================================================ */
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 40px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 100; }
.lp-nav .logo { font-size: 20px; font-weight: 800; text-decoration: none; color: var(--text); letter-spacing: -0.5px; }
.lp-nav .logo span { color: var(--accent); }
.lp-nav .nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.lp-nav .nav-links a { color: var(--text-muted); text-decoration: none; }
.lp-nav .nav-links a:hover { color: var(--text); }

.lp-section { max-width: 1080px; margin: 0 auto; padding: 80px 24px; }
.lp-section.narrow { max-width: 720px; }

.hero { text-align: center; padding: 100px 24px 80px; background: linear-gradient(160deg, var(--surface) 0%, var(--bg) 60%); }
.hero-badge { display: inline-block; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 20px; padding: 4px 14px; font-size: 12px; font-weight: 600; margin-bottom: 20px; letter-spacing: .4px; text-transform: uppercase; }
.hero h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 800; line-height: 1.15; margin: 0 0 20px; letter-spacing: -1px; max-width: 760px; margin-left: auto; margin-right: auto; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 17px; color: var(--text-muted); max-width: 560px; margin: 0 auto 36px; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 12px; color: var(--text-muted); }

.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); margin-bottom: 10px; }
.section-title { font-size: clamp(22px, 3vw, 32px); font-weight: 800; letter-spacing: -0.5px; margin: 0 0 12px; }
.section-sub { color: var(--text-muted); font-size: 15px; margin-bottom: 48px; max-width: 520px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.feat-icon { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feat-icon svg { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feat-card h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.feat-card p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; counter-reset: steps; }
.step { position: relative; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; counter-increment: steps; }
.step::before { content: counter(steps); position: absolute; top: -14px; left: 20px; width: 28px; height: 28px; background: var(--accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.step h4 { font-size: 14px; font-weight: 700; margin: 6px 0 8px; }
.step p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; align-items: start; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; position: relative; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card .popular-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 14px; border-radius: 20px; white-space: nowrap; letter-spacing: .4px; }
.plan-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: 8px; }
.plan-price { font-size: 36px; font-weight: 800; letter-spacing: -1px; line-height: 1; margin-bottom: 4px; }
.plan-price span { font-size: 16px; font-weight: 400; color: var(--text-muted); }
.plan-period { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 24px; }
.plan-features li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border-bottom: none; }
.plan-features li .check { color: #38a169; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.plan-features li .cross { color: var(--text-muted); font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.plan-features li.muted { color: var(--text-muted); }

.faq { max-width: 640px; margin: 0 auto; }
details.faq-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
details.faq-item summary { padding: 16px 20px; font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.faq-item summary::after { content: '+'; font-size: 18px; color: var(--text-muted); }
details.faq-item[open] summary::after { content: '−'; }
details.faq-item p { padding: 0 20px 16px; font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; }

.final-cta { text-align: center; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 16px; padding: 56px 40px; }
.final-cta h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 800; margin: 0 0 12px; }
.final-cta p { color: var(--text-muted); margin: 0 0 32px; font-size: 15px; }

.lp-footer { border-top: 1px solid var(--border); padding: 28px 40px; text-align: center; font-size: 12px; color: var(--text-muted); }
.lp-footer a { color: var(--text-muted); margin: 0 8px; }

/* Tabella comparativa */
.compare-wrap { max-width: 1020px; margin: 0 auto; padding: 56px 20px 80px; }
.compare-header { text-align: center; margin-bottom: 40px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); text-decoration: none; margin-bottom: 32px; }
.back-link:hover { color: var(--accent); }
.compare-toggle { display: block; width: 100%; text-align: center; background: none; border: 1.5px solid var(--border); border-radius: 10px; padding: 13px 20px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; margin-top: 28px; transition: border-color .2s, color .2s; }
.compare-toggle:hover { border-color: var(--accent); color: var(--accent); }
details.compare-details summary { list-style: none; }
details.compare-details summary::-webkit-details-marker { display: none; }
.compare-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 14px; margin-top: 20px; }
.compare-table { width: 100%; border-collapse: collapse; min-width: 620px; table-layout: fixed; }
.compare-table col.feat-col { width: 230px; }
.compare-table thead th { position: sticky; top: 63px; z-index: 10; background: var(--surface); border-bottom: 2px solid var(--border); padding: 22px 18px 18px; text-align: center; vertical-align: bottom; }
.compare-table thead th.feat-head { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding-left: 20px; }
.compare-table thead th.col-starter { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-top: 3px solid var(--accent); }
.compare-table td.col-starter { background: color-mix(in srgb, var(--accent) 3%, var(--bg)); }
.plan-badge-sm { display: inline-block; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 20px; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 8px; }
.compare-table tbody tr td { padding: 10px 18px; font-size: 13px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table tbody tr td:first-child { text-align: left; padding-left: 20px; }
.compare-table tr.cat-row td { background: var(--bg); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.1px; color: var(--text-muted); padding: 12px 20px 8px; border-top: 1px solid var(--border); text-align: left; }
.compare-table tr.cat-row td.col-starter { background: color-mix(in srgb, var(--accent) 3%, var(--bg)); }
.ic-yes { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; font-size: 12px; font-weight: 700; }
.ic-no  { display: inline-block; color: var(--border); font-size: 18px; line-height: 1; }
.val-b  { font-size: 13px; font-weight: 600; }
.val-m  { font-size: 12px; color: var(--text-muted); }
.feat-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.badge-new { display: inline-block; background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; margin-left: 5px; vertical-align: middle; }
.compare-table tfoot td { padding: 22px 18px; text-align: center; background: var(--surface); border-top: 2px solid var(--border); }
.compare-table tfoot td.col-starter { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }

@media (max-width: 640px) {
    .lp-nav { padding: 14px 16px; }
    .lp-nav .nav-links { gap: 12px; font-size: 13px; }
    .hero { padding: 60px 16px 50px; }
    .lp-section { padding: 56px 16px; }
    .final-cta { padding: 36px 20px; }
    .compare-wrap { padding: 32px 12px 60px; }
}

/* --- Chip filtro indicatori sicurezza (sites.php) --- */
.sec-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: opacity .15s;
}
.sec-chip:hover { opacity: .8; }
.sec-chip--ok   { border-color: var(--ok);   color: var(--ok); }
.sec-chip--warn { border-color: var(--err);   color: var(--err); }
.sec-chip--mid  { border-color: var(--warn);  color: var(--warn); }
.sec-chip--active { outline: 2px solid currentColor; outline-offset: 2px; font-weight: 700; }
.sec-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: currentColor;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.sec-chip__count span { color: var(--bg); }
.sec-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

/* --- Modificatori card riepilogo statistiche (sites.php, client_detail.php, clients.php) --- */
.stat-card__value             { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-card__label             { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; }
.stat-card--ok .stat-card__value      { color: var(--ok); }
.stat-card--ok:hover                  { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.08); }
.stat-card--ok.stat-card--active      { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.stat-card--warning .stat-card__value           { color: var(--text-muted); }
.stat-card--warning.stat-card--has-alerts .stat-card__value { color: var(--err); }
.stat-card--warning:hover             { border-color: var(--err); box-shadow: 0 0 0 3px rgba(220,38,38,.08); }
.stat-card--warning.stat-card--active { border-color: var(--err); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
