/* ══════════════════════════════════════════════════════════════════════════════
   app.css — Sistema di design RIT Gestionale (tema Tabler)
   Elmetel Srl · versione 2.0
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ───────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
    /* Colori brand */
    --elm-primary:          #2563eb;
    --elm-primary-dark:     #1d4ed8;
    --elm-primary-light:    #eff6ff;
    --elm-primary-rgb:      37, 99, 235;

    /* Sidebar */
    --elm-sidebar-bg:             #0c1425;
    --elm-sidebar-surface:        #111d35;
    --elm-sidebar-border:         rgba(255,255,255,0.05);
    --elm-sidebar-hover:          rgba(255,255,255,0.05);
    --elm-sidebar-active-bg:      rgba(37,99,235,0.18);
    --elm-sidebar-active-border:  #2563eb;
    --elm-sidebar-text:           rgba(255,255,255,0.58);
    --elm-sidebar-text-hover:     rgba(255,255,255,0.88);
    --elm-sidebar-text-active:    #ffffff;

    /* Superficie */
    --elm-bg:           #f1f5f9;
    --elm-bg-card:      #ffffff;
    --elm-border:       #e2e8f0;
    --elm-border-faint: rgba(0,0,0,0.05);

    /* Testo */
    --elm-text:         #0f172a;
    --elm-text-muted:   #64748b;
    --elm-text-light:   #94a3b8;

    /* Semantici */
    --elm-success:      #059669;
    --elm-success-bg:   #ecfdf5;
    --elm-warning:      #d97706;
    --elm-warning-bg:   #fffbeb;
    --elm-danger:       #dc2626;
    --elm-danger-bg:    #fef2f2;
    --elm-info:         #0891b2;
    --elm-info-bg:      #ecfeff;

    /* Ombre */
    --elm-shadow-sm:  0 1px 2px rgba(0,0,0,0.06);
    --elm-shadow:     0 1px 4px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --elm-shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --elm-shadow-lg:  0 8px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);

    /* Bordi */
    --elm-radius:     10px;
    --elm-radius-sm:  6px;
    --elm-radius-lg:  14px;

    /* Override variabili Tabler / Bootstrap 5 */
    --tblr-primary:                  var(--elm-primary);
    --tblr-primary-rgb:              var(--elm-primary-rgb);
    --tblr-body-bg:                  var(--elm-bg);
    --tblr-card-bg:                  var(--elm-bg-card);
    --tblr-border-color:             var(--elm-border);
    --tblr-font-family-sans-serif:   'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tblr-font-size-base:           0.875rem;
    --tblr-body-color:               var(--elm-text);
    --tblr-muted-color:              var(--elm-text-muted);
}

/* ── Base ───────────────────────────────────────────────────────────────────── */

body {
    font-family: var(--tblr-font-family-sans-serif);
    background: var(--elm-bg);
    color: var(--elm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Monospaced per numeri e codici */
.font-mono,
.stat-value {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.page-title, .card-title {
    letter-spacing: -0.025em;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */

.navbar-vertical {
    /* Fondo con profondità: leggera sfumatura verticale invece del piatto */
    background: linear-gradient(180deg, #0f1b33 0%, #0b1322 55%, #090f1c 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.28);
    /* Tabler forza overflow-y:scroll (scrollbar sempre riservata anche a contenuto
       più corto del viewport). La mostriamo solo quando serve davvero. */
    overflow-y: auto !important;
}

/* Scrollbar discreta, in tono con la sidebar */
.navbar-vertical::-webkit-scrollbar { width: 6px; }
.navbar-vertical::-webkit-scrollbar-track { background: transparent; }
.navbar-vertical::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
.navbar-vertical::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }
.navbar-vertical { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }

/* Brand / Logo */
.navbar-vertical .navbar-brand {
    padding: 1.2rem 1.25rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.5rem;
}

.navbar-vertical .navbar-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

/* Icona brand */
.brand-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    letter-spacing: -0.04em;
}

.brand-text-main {
    font-size: 0.97rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.brand-text-sub {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.34);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    line-height: 1;
    display: block;
    margin-top: 2px;
}

/* Label sezione sidebar */
.sidebar-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    padding: 1rem 1.4rem 0.4rem;
    display: block;
}

/* Voci di navigazione */
.navbar-vertical .navbar-nav {
    padding: 0.15rem 0;
}

.navbar-vertical .navbar-nav .nav-item {
    margin: 2px 0.65rem;
}

.navbar-vertical .navbar-nav .nav-item > .nav-link {
    border-radius: 9px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--elm-sidebar-text) !important;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.navbar-vertical .navbar-nav .nav-item > .nav-link:hover {
    background: rgba(255, 255, 255, 0.055);
    color: var(--elm-sidebar-text-hover) !important;
}

.navbar-vertical .navbar-nav .nav-item.active > .nav-link {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.30) 0%, rgba(37, 99, 235, 0.10) 100%);
    color: #fff !important;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22),
                0 4px 14px rgba(37, 99, 235, 0.18);
}

/* Indicatore arrotondato a sinistra della voce attiva */
.navbar-vertical .navbar-nav .nav-item.active > .nav-link::before {
    content: '';
    position: absolute;
    left: -0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #93c5fd 0%, #2563eb 100%);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.6);
}

.navbar-vertical .nav-link-icon {
    width: 1.2rem;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.42);
    transition: color 0.18s ease, transform 0.18s ease;
    flex-shrink: 0;
}

.navbar-vertical .nav-item > .nav-link:hover .nav-link-icon {
    color: #93c5fd;
}

.navbar-vertical .nav-item.active .nav-link-icon {
    color: #60a5fa;
}

.navbar-vertical .nav-link-title {
    margin-left: 0.5rem;
}

/* Avatar utente */
.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Sezione utente in fondo — pulsante che apre il dropdown */
.sidebar-user-block {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.6rem;
}

.sidebar-user-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.5rem 0.55rem;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.sidebar-user-trigger:hover,
.sidebar-user-trigger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-user-trigger::after {
    display: none; /* nascondiamo il caret di default di Bootstrap, usiamo la nostra icona */
}

/* Bootstrap/Tabler non garantisce sempre min-width:0 sull'utility .min-w-0:
   lo impostiamo esplicitamente perché senza di esso il blocco nome non può
   restringersi sotto la larghezza del proprio testo e spinge gli elementi
   accanto fuori dalla sidebar. */
.sidebar-user-trigger .flex-fill {
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-caret {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.sidebar-user-trigger[aria-expanded="true"] .sidebar-user-caret {
    transform: rotate(180deg);
}

/* Popover utente: forziamo l'apertura SOPRA il trigger e allineata ai suoi
   bordi, annullando il transform di Popper (che altrimenti lo posiziona sotto
   o lo fa "saltare"). left/right a 0.6rem compensano il padding del contenitore. */
.sidebar-user-menu {
    position: absolute !important;
    top: auto !important;
    bottom: 100% !important;
    left: 0.6rem !important;
    right: 0.6rem !important;
    width: auto !important;
    transform: none !important;
    margin: 0 0 0.5rem !important;
    background: #1b2c4d;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.5);
    padding: 0.35rem;
}

.sidebar-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    font-size: 0.83rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-user-menu .dropdown-item i {
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.15s ease;
}

.sidebar-user-menu .dropdown-item:hover i,
.sidebar-user-menu .dropdown-item:focus i {
    color: #93c5fd;
}

.sidebar-user-menu .dropdown-item.sidebar-user-menu-danger:hover i {
    color: #fc8181;
}

.sidebar-user-menu .dropdown-item:hover,
.sidebar-user-menu .dropdown-item:focus {
    background: var(--elm-sidebar-hover);
    color: var(--elm-sidebar-text-hover);
}

.sidebar-user-menu .dropdown-item.sidebar-user-menu-danger:hover {
    background: rgba(220, 38, 38, 0.12);
    color: #fc8181;
}

.sidebar-user-menu .dropdown-divider {
    border-color: var(--elm-sidebar-border);
    margin: 0.3rem 0;
}

.sidebar-logout-btn {
    color: rgba(255, 255, 255, 0.35) !important;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--elm-radius-sm) !important;
    padding: 0.3rem 0.5rem !important;
    transition: all 0.15s ease !important;
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    color: #fc8181 !important;
    border-color: rgba(220, 38, 38, 0.4) !important;
    background: rgba(220, 38, 38, 0.08) !important;
}

/* Toggler mobile */
.navbar-vertical .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.navbar-vertical .navbar-toggler-icon {
    opacity: 0.85;
}

/* ── Page layout ────────────────────────────────────────────────────────────── */

.page-wrapper {
    background: var(--elm-bg);
    min-height: 100vh;
}

.page-header {
    background: var(--elm-bg-card);
    border-bottom: 1px solid var(--elm-border);
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--elm-text);
}

.page-body {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */

.card {
    border: 1px solid var(--elm-border) !important;
    border-radius: var(--elm-radius) !important;
    box-shadow: var(--elm-shadow) !important;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--elm-border);
    padding: 0.9rem 1.2rem;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--elm-text);
}

.card-body {
    padding: 1.2rem;
}

.subheader {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--elm-text-muted);
    margin-bottom: 0.4rem;
}

/* Stat cards — accent colorato in cima */
.stat-card {
    border-top: 3px solid var(--elm-primary) !important;
}
.stat-card.stat-success { border-top-color: var(--elm-success) !important; }
.stat-card.stat-warning { border-top-color: var(--elm-warning) !important; }
.stat-card.stat-danger  { border-top-color: var(--elm-danger)  !important; }
.stat-card.stat-info    { border-top-color: var(--elm-info)    !important; }

/* Icona colorata nelle stat card */
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.stat-icon.icon-primary { background: var(--elm-primary-light); color: var(--elm-primary); }
.stat-icon.icon-success { background: var(--elm-success-bg);    color: var(--elm-success); }
.stat-icon.icon-warning { background: var(--elm-warning-bg);    color: var(--elm-warning); }
.stat-icon.icon-danger  { background: var(--elm-danger-bg);     color: var(--elm-danger);  }
.stat-icon.icon-info    { background: var(--elm-info-bg);       color: var(--elm-info);    }

.stat-number {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--elm-text);
    letter-spacing: -0.03em;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    border-radius: var(--elm-radius-sm);
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--elm-primary) !important;
    border-color: var(--elm-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--elm-primary-dark) !important;
    border-color: var(--elm-primary-dark) !important;
    box-shadow: 0 4px 14px rgba(var(--elm-primary-rgb), 0.35) !important;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-sm {
    font-size: 0.73rem;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */

.form-control,
.form-select {
    border-radius: var(--elm-radius-sm) !important;
    border-color: var(--elm-border) !important;
    font-size: 0.875rem;
    color: var(--elm-text);
    background-color: var(--elm-bg-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--elm-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--elm-primary-rgb), 0.12) !important;
    background-color: var(--elm-bg-card);
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--elm-text);
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}

.form-text {
    font-size: 0.73rem;
    color: var(--elm-text-muted);
}

.form-check-label {
    font-size: 0.85rem;
}

/* Asterisco campi obbligatori */
.required::after {
    content: " *";
    color: var(--elm-danger);
}

/* Sezione form */
.form-section {
    background: var(--elm-bg-card);
    padding: 1.25rem;
    border-radius: var(--elm-radius);
    border: 1px solid var(--elm-border);
    box-shadow: var(--elm-shadow-sm);
    margin-bottom: 1rem;
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */

.table {
    font-size: 0.84rem;
}

.table thead th {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--elm-text-muted);
    border-bottom: 2px solid var(--elm-border) !important;
    padding: 0.6rem 0.8rem;
    white-space: nowrap;
    background: #f8fafc;
}

.table tbody td {
    padding: 0.65rem 0.8rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--elm-border-faint);
}

.table-hover tbody tr:hover td {
    background: #f8fafc;
}

.table-container {
    margin-top: 0;
    overflow-x: auto;
}

/* Righe espandibili */
.details-row    { display: none; }
.details-container { padding: 0.75rem; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */

.badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.28em 0.6em;
    border-radius: 5px;
}

.badge-not-signed {
    background: var(--elm-danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25em 0.55em;
    border-radius: 5px;
    vertical-align: middle;
}

/* ── Azioni nelle tabelle ───────────────────────────────────────────────────── */

.actions-buttons {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

/* Tutti i bottoni nella colonna azioni: altezza uniforme, icona centrata */
.actions-buttons .btn {
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
}

/* Bottoni icona puri (solo <i>, nessun testo): quadrati */
.actions-buttons .btn:has(> i:only-child) {
    width: 2rem;
    padding: 0;
}

.actions-buttons .btn i {
    font-size: 0.78rem;
    line-height: 1;
    display: block;
}

/* ── Sezione form heading ───────────────────────────────────────────────────── */

.form-section h3,
.form-section h4 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--elm-text);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--elm-border);
}

/* ── Intervento box (form RIT) ──────────────────────────────────────────────── */

/* alias usato in edit_report.php */
.intervention-box,
.intervento-box {
    background: #f8fafc;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--elm-radius-sm);
    border: 1px solid var(--elm-border);
    transition: border-color 0.15s ease;
}

.intervention-box:focus-within,
.intervento-box:focus-within {
    border-color: var(--elm-primary);
    background: #fff;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */

.alert {
    border-radius: var(--elm-radius-sm);
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-danger  { background: var(--elm-danger-bg);  border-color: rgba(220,38,38,0.2);  color: #991b1b; }
.alert-success { background: var(--elm-success-bg); border-color: rgba(5,150,105,0.2);   color: #065f46; }
.alert-warning { background: var(--elm-warning-bg); border-color: rgba(217,119,6,0.2);   color: #92400e; }

/* ── Tom Select (compatibilità con Tabler) ──────────────────────────────────── */

/* Rimuovi il padding del wrapper quando avvolge un form-select/form-control */
.ts-wrapper.form-select,
.ts-wrapper.form-control {
    padding: 0;
    background-image: none; /* togli la freccia nativa BS5 */
}

/* Controllo visibile */
.ts-control {
    border-color: var(--elm-border) !important;
    border-radius: var(--elm-radius-sm) !important;
    font-size: 0.875rem;
    min-height: 36px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Focus */
.ts-wrapper.focus .ts-control {
    border-color: var(--elm-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--elm-primary-rgb), 0.12) !important;
    outline: none;
}

/* Dropdown — sfondo esplicito per evitare la trasparenza con Tabler */
.ts-dropdown {
    background-color: var(--elm-bg-card, #fff) !important;
    color: var(--elm-text, #0f172a) !important;
    border-color: var(--elm-border) !important;
    border-radius: var(--elm-radius-sm) !important;
    box-shadow: var(--elm-shadow-md) !important;
    font-size: 0.875rem;
    z-index: 1060; /* sopra i modal Bootstrap */
}

.ts-dropdown .option {
    color: var(--elm-text, #0f172a);
    padding: 0.4rem 0.75rem;
}

/* Opzione evidenziata */
.ts-dropdown .option.active {
    background-color: var(--elm-primary) !important;
    color: #fff !important;
}

/* Opzione già selezionata (highlight leggero) */
.ts-dropdown .option.selected {
    background-color: var(--elm-primary-light) !important;
    color: var(--elm-primary) !important;
}

/* Item selezionato nella multi-select */
.ts-control .item {
    background-color: var(--elm-primary-light) !important;
    color: var(--elm-primary) !important;
    border-color: rgba(var(--elm-primary-rgb), 0.25) !important;
    font-size: 0.8rem;
    border-radius: calc(var(--elm-radius-sm) - 1px);
}

/* ── DataTables ─────────────────────────────────────────────────────────────── */

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: none;
    border: none;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    font-size: 0.8rem;
    color: var(--elm-text-muted);
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.78rem;
    color: var(--elm-text-muted);
}

/* ── Login page — split panel ───────────────────────────────────────────────── */

.login-page-wrapper {
    min-height: 100vh;
    display: flex;
}

/* Pannello brand (sinistro) */
.login-brand-panel {
    flex: 0 0 400px;
    background: var(--elm-sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Pattern griglia sottile */
.login-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Alone colorato in alto a sinistra */
.login-brand-panel::after {
    content: '';
    position: absolute;
    top: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.login-brand-content {
    position: relative;
    z-index: 1;
}

.login-brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--elm-primary) 0%, #60a5fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
    letter-spacing: -0.04em;
}

.login-brand-title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin: 0 0 0.5rem;
}

.login-brand-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
}

.login-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.login-feature-list li:last-child {
    border-bottom: none;
}

.login-feature-list li i {
    color: #60a5fa;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

/* Pannello form (destro) */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--elm-bg);
}

.login-form-inner {
    width: 100%;
    max-width: 380px;
}

.login-form-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--elm-text);
    letter-spacing: -0.03em;
    margin: 0 0 0.4rem;
}

.login-form-hint {
    font-size: 0.8rem;
    color: var(--elm-text-muted);
    margin-bottom: 1.75rem;
}

/* Card del form */
.login-form-card {
    background: var(--elm-bg-card);
    border: 1px solid var(--elm-border);
    border-radius: var(--elm-radius-lg);
    padding: 1.75rem;
    box-shadow: var(--elm-shadow-lg);
    margin-bottom: 1rem;
}

@media (max-width: 767px) {
    .login-brand-panel {
        display: none;
    }
    .login-form-panel {
        padding: 1.25rem;
        align-items: flex-start;
        padding-top: 3rem;
    }
    .login-form-inner {
        max-width: 100%;
    }
}

/* ── Responsive utilities ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only  { display: inline-flex !important; align-items: center; justify-content: center; }
    .createReportButton { display: none; }
}

@media (min-width: 769px) {
    .mobile-only  { display: none !important; }
    .desktop-only { display: inline-flex !important; align-items: center; justify-content: center; }
}

/* Elemento non cliccabile */
.disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* ── RIT Form — Pannello info cliente ───────────────────────────────────────── */

.rit-client-panel {
    background: var(--elm-bg);
    border-radius: var(--elm-radius-sm);
    padding: 0.875rem 1rem;
    border: 1px solid var(--elm-border);
}

.rit-cd-grid {
    display: grid;
    gap: 0.35rem;
}

.rit-cd-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.rit-cd-label {
    color: var(--elm-text-muted);
    font-size: 0.695rem;
    font-weight: 600;
    min-width: 9rem;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    padding-top: 1px;
}

.rit-cd-value {
    color: var(--elm-text);
    font-weight: 500;
    word-break: break-word;
}

.rit-cd-divider {
    border: none;
    border-top: 1px solid var(--elm-border);
    margin: 0.6rem 0;
}

/* ── RIT Form — Lista responsabili ─────────────────────────────────────────── */

.responsabile-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--elm-border-faint);
    cursor: pointer;
    transition: background-color 0.1s ease;
    margin: 0;
}

.responsabile-item:last-child   { border-bottom: none; }
.responsabile-item:hover        { background: var(--elm-bg); }
.responsabile-item .form-check-input { margin-top: 0.2rem; flex-shrink: 0; }

/* ── Versioning RIT ─────────────────────────────────────────────────────────── */

/* Pulsante Richiama */
.btn-recall {
    background: transparent;
    color: #b45309;
    border: 1.5px dashed #f59e0b;
    border-radius: var(--elm-radius-sm);
    font-size: .85rem;
    font-weight: 600;
    padding: .45rem .9rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-recall:hover {
    background: rgba(245, 158, 11, 0.10);
    color: #92400e;
    border-color: #d97706;
}

/* ── Segmented control (tab selector sidebar) ────────────────────────────────── */

.seg-ctrl {
    display: flex;
    background: #e2e8f0;
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.seg-btn {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    border-radius: 8px;
    padding: .4rem .5rem;
    font-size: .8rem;
    font-weight: 600;
    color: #64748b !important;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none !important;
}

.seg-btn.active {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04) !important;
}

.seg-btn:not(.active):hover {
    color: #334155 !important;
    background: rgba(255,255,255,.5) !important;
}

/* Badge dentro la timeline versioni e nel tab nav: non uppercase */
#versioni-timeline .badge,
.seg-ctrl .badge {
    text-transform: none;
    letter-spacing: 0;
}
#versioni-timeline .card[onclick] {
    transition: box-shadow .12s ease, background .12s ease;
}
#versioni-timeline .card[onclick]:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    background: #f8fafc;
}
#versioni-timeline .card.vt-active {
    background: #dbeafe;
    outline: 2px solid #3b82f6;
    outline-offset: -1px;
}

.btn-xs {
    font-size: .75rem;
    padding: .25rem .6rem;
    border-radius: var(--elm-radius-sm);
}
