/* ==========================================================
 * _restyle-v2.css — Restyling 2026 (stile moderno: chiaro, arrotondato, sidebar scura, blu mare).
 * Tutte le regole sono sotto `html.imr-v2`: attivo solo se il browser ha il cookie di anteprima
 * (inc/mainhead.php, ?stile=nuovo / ?stile=vecchio). Quando approvato diventerà lo stile di tutti.
 * Caricato DOPO _custom-styles.css.
 * ========================================================== */

html.imr-v2 {
    --imr-blue: #0b6e8a;
    --imr-blue-dark: #08546a;
    --imr-blue-soft: #e6f3f7;
    --imr-green: #2f8f55;
    --imr-danger: #b42318;
    --imr-ink: #18232d;
    --imr-text: #17212b;
    --imr-muted: #5b6b7a;
    --imr-line: #e3e8ee;
    --imr-field: #cfd8e0;
    --imr-bg: #f4f6f9;
    --imr-radius: 8px;
    --bs-primary: #0b6e8a;
    --bs-primary-rgb: 11, 110, 138;
    --bs-link-color: #0b6e8a;
    --bs-link-color-rgb: 11, 110, 138;
    --bs-link-hover-color: #08546a;
    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: #17212b;
    --bs-body-bg: #f4f6f9;
}
html.imr-v2 body { font-family: var(--bs-body-font-family); color: var(--imr-text); background: var(--imr-bg); }
html.imr-v2 .body-wrapper { background: var(--imr-bg); }
html.imr-v2 h1, html.imr-v2 h2, html.imr-v2 h3, html.imr-v2 h4, html.imr-v2 h5, html.imr-v2 h6 { color: var(--imr-text); letter-spacing: -.01em; }

/* ---------- Sidebar scura ---------- */
html.imr-v2 .sidenav-menu { background: var(--imr-ink) !important; }
html.imr-v2 .side-nav .side-nav-title { color: #7f909f !important; font-size: .68rem; letter-spacing: .07em; }
html.imr-v2 .side-nav .side-nav-link { color: #c5d0da !important; border-radius: 8px; margin: 1px 10px; font-weight: 500; }
html.imr-v2 .side-nav .side-nav-link:hover { color: #fff !important; background: rgba(255,255,255,.07) !important; }
html.imr-v2 .side-nav .side-nav-item .side-nav-link.active,
html.imr-v2 .side-nav .side-nav-item.active > .side-nav-link { color: #fff !important; background: var(--imr-blue) !important; font-weight: 600; }

/* ---------- Topbar ---------- */
html.imr-v2 .app-topbar { background: #fff; border-bottom: 1px solid var(--imr-line); box-shadow: none; }
html.imr-v2 #globalSearch { border: 1px solid var(--imr-field); background: var(--imr-bg); border-radius: 10px; height: 42px; }
html.imr-v2 #globalSearch:focus { background: #fff; border-color: var(--imr-blue); box-shadow: 0 0 0 3px rgba(11,110,138,.15); }
html.imr-v2 #globalSearchBox .ri-search-line { color: var(--imr-muted); }

/* ---------- Riquadri (card) ---------- */
html.imr-v2 .card { border: 1px solid var(--imr-line); border-radius: 12px; box-shadow: none; background: #fff; }
html.imr-v2 .card-header { background: #fff; border-bottom: 1px solid #eef1f4; padding: .95rem 1.25rem; border-radius: 12px 12px 0 0 !important; }
html.imr-v2 .card-header strong, html.imr-v2 .card-title { font-weight: 700; font-size: .95rem; }
html.imr-v2 .card-body { padding: 1.25rem; }

/* ---------- Pulsanti ---------- */
html.imr-v2 .btn { border-radius: 9px; font-weight: 600; --bs-btn-padding-y: .5rem; --bs-btn-padding-x: 1rem; --bs-btn-font-size: .875rem; }
html.imr-v2 .btn-sm { border-radius: 8px; --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; }
html.imr-v2 .btn-lg { border-radius: 10px; }
html.imr-v2 .btn-primary { --bs-btn-bg: #0b6e8a; --bs-btn-border-color: #0b6e8a; --bs-btn-hover-bg: #08546a; --bs-btn-hover-border-color: #08546a; --bs-btn-active-bg: #08546a; --bs-btn-active-border-color: #08546a; --bs-btn-disabled-bg: #0b6e8a; --bs-btn-disabled-border-color: #0b6e8a; }
html.imr-v2 .btn-outline-primary { --bs-btn-color: #0b6e8a; --bs-btn-border-color: #0b6e8a; --bs-btn-hover-bg: #0b6e8a; --bs-btn-hover-border-color: #0b6e8a; --bs-btn-active-bg: #08546a; --bs-btn-active-border-color: #08546a; }
html.imr-v2 .btn-success { --bs-btn-bg: #2f8f55; --bs-btn-border-color: #2f8f55; --bs-btn-hover-bg: #24733f; --bs-btn-hover-border-color: #24733f; }
html.imr-v2 .btn-outline-success { --bs-btn-color: #17703a; --bs-btn-border-color: #2f8f55; --bs-btn-hover-bg: #2f8f55; --bs-btn-hover-border-color: #2f8f55; }
html.imr-v2 .btn-outline-secondary, html.imr-v2 .btn-outline-dark, html.imr-v2 .btn-light {
    --bs-btn-color: #3c4a57; --bs-btn-bg: #fff; --bs-btn-border-color: var(--imr-field);
    --bs-btn-hover-color: #17212b; --bs-btn-hover-bg: #f1f4f7; --bs-btn-hover-border-color: #b9c5d0;
    --bs-btn-active-color: #17212b; --bs-btn-active-bg: #e9eef2; --bs-btn-active-border-color: #b9c5d0;
}

/* ---------- Form: campi compatti ---------- */
html.imr-v2 .form-control,
html.imr-v2 .form-select,
html.imr-v2 .card-body form .form-control,
html.imr-v2 .card-body form .form-select {
    min-height: 38px; padding: .45rem .75rem; font-size: .9rem;
    border: 1px solid var(--imr-field); border-radius: 8px; background-color: #fff; color: var(--imr-text);
}
html.imr-v2 textarea.form-control { min-height: 76px; }
html.imr-v2 .form-select { padding-right: 2rem; }
html.imr-v2 .form-control-sm, html.imr-v2 .form-select-sm { min-height: 32px; font-size: .82rem; }
html.imr-v2 .form-control:focus, html.imr-v2 .form-select:focus,
html.imr-v2 .card-body form .form-control:focus, html.imr-v2 .card-body form .form-select:focus {
    border-color: var(--imr-blue); box-shadow: 0 0 0 3px rgba(11,110,138,.15);
}
html.imr-v2 .form-control[readonly], html.imr-v2 .form-control:disabled { background: var(--imr-bg); }
html.imr-v2 .input-group-text { background: var(--imr-bg); border-color: var(--imr-field); color: #3c4a57; font-size: .85rem; border-radius: 8px; }
html.imr-v2 label, html.imr-v2 .form-label,
html.imr-v2 .card-body form label, html.imr-v2 .card-body form .form-label { font-size: .78rem; font-weight: 600; color: #3c4a57; margin-bottom: .3rem; }
html.imr-v2 .form-check-label, html.imr-v2 .card-body form .form-check-label { font-size: .875rem; font-weight: 500; color: var(--imr-text); }
html.imr-v2 .card-body form .form-group { margin-bottom: .85rem; }
html.imr-v2 .card-body form h5 { font-size: .95rem; color: var(--imr-text); border-bottom: 1px solid #eef1f4; padding-bottom: .5rem; margin: 1rem 0 .85rem; }
html.imr-v2 .form-check-input:checked { background-color: var(--imr-blue); border-color: var(--imr-blue); }
html.imr-v2 .imr-form-actions { background: rgba(255,255,255,.97); border-top: 1px solid var(--imr-line); padding: .75rem 0; }

/* ---------- Tabelle ---------- */
html.imr-v2 .card .table { --bs-table-hover-bg: #f5f9fb; font-size: .875rem; }
html.imr-v2 .card .table > thead > tr > th { background: #fff; color: var(--imr-muted); font-size: .7rem; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--imr-line); padding: .75rem 1rem; }
html.imr-v2 .card .table > tbody > tr > td { padding: .8rem 1rem; border-color: #eef1f4; }
html.imr-v2 .card .table-hover > tbody > tr:hover > * { background: #f5f9fb; }

/* ---------- Badge, tab, paginazione ---------- */
html.imr-v2 .badge { border-radius: 12px; font-weight: 600; padding: .35em .7em; }
html.imr-v2 .nav-tabs { border-bottom: 1px solid var(--imr-line); gap: .25rem; }
html.imr-v2 .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--imr-muted); font-weight: 600; padding: .7rem .8rem; background: transparent; }
html.imr-v2 .nav-tabs .nav-link:hover { color: var(--imr-text); border-bottom-color: #cfd8e0; }
html.imr-v2 .nav-tabs .nav-link.active { color: var(--imr-blue); border-bottom-color: var(--imr-blue); background: transparent; }
html.imr-v2 .pagination .page-link { border-radius: 8px; }

/* ---------- Riepiloghi (KPI) e scorciatoie: card bianche con icona colorata ---------- */
html.imr-v2 .imr-kpi, html.imr-v2 a.imr-kpi, html.imr-v2 a.imr-kpi:visited, html.imr-v2 a.imr-kpi:focus {
    background: #fff; color: var(--imr-text); border: 1px solid var(--imr-line); border-radius: 12px;
    flex-direction: row; justify-content: flex-start;
}
html.imr-v2 a.imr-kpi:hover { filter: none; border-color: #b9c5d0; color: var(--imr-text); }
html.imr-v2 .imr-kpi .imr-kpi-txt { text-align: left; }
html.imr-v2 .imr-kpi .imr-kpi-label { color: var(--imr-muted); font-weight: 600; opacity: 1; }
html.imr-v2 .imr-kpi .imr-kpi-ico {
    width: 44px; height: 44px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; background: var(--imr-blue-soft); color: var(--imr-blue); opacity: 1;
}
html.imr-v2 .imr-kpi-sm .imr-kpi-ico { width: 38px; height: 38px; font-size: 1.15rem; }
html.imr-v2 .imr-kpi--dark .imr-kpi-ico { background: #eceff3; color: #3c4a57; }
html.imr-v2 .imr-kpi--green .imr-kpi-ico { background: #e7f5ec; color: #17703a; }
html.imr-v2 .imr-kpi--danger .imr-kpi-ico { background: #fde8e4; color: var(--imr-danger); }
html.imr-v2 .imr-kpi--danger .imr-kpi-val { color: var(--imr-danger); }

html.imr-v2 .imr-tile { background: #fff; color: var(--imr-text); border: 1px solid var(--imr-line); border-radius: 12px; flex-direction: row; justify-content: flex-start; }
html.imr-v2 .imr-tile:hover { filter: none; color: var(--imr-text); border-color: var(--imr-blue); }
html.imr-v2 .imr-tile .imr-tile-txt { text-align: left; }
html.imr-v2 .imr-tile .imr-tile-sub { color: var(--imr-muted); opacity: 1; }
html.imr-v2 .imr-tile .imr-tile-ico {
    width: 44px; height: 44px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; background: var(--imr-blue-soft); color: var(--imr-blue);
}
html.imr-v2 .imr-tile--green .imr-tile-ico { background: #e7f5ec; color: #17703a; }
html.imr-v2 .imr-tile--dark .imr-tile-ico { background: #eceff3; color: #3c4a57; }
html.imr-v2 .imr-section-title { color: #7f909f; font-size: .72rem; }

/* ---------- Alert e modali ---------- */
html.imr-v2 .alert { border-radius: 10px; border: 1px solid transparent; }
html.imr-v2 .swal2-popup { border-radius: 14px; font-family: var(--bs-body-font-family); }
html.imr-v2 .swal2-styled.swal2-confirm { background: var(--imr-blue); border-radius: 9px; }

/* ---------- Telefono: campi a 16px (iOS non fa zoom) ---------- */
@media (max-width: 767.98px) {
    html.imr-v2 .form-control, html.imr-v2 .form-select,
    html.imr-v2 .card-body form .form-control, html.imr-v2 .card-body form .form-select { font-size: 16px; }
    html.imr-v2 .card-body { padding: 1rem; }
}
