/* ============================================================
   Econ — Frontend Application Styles
   Bootstrap 5 + FontAwesome 6
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1c2a3a;
    --sidebar-text: #b0bec5;
    --sidebar-hover-bg: rgba(255,255,255,0.07);
    --sidebar-active-bg: rgba(66,165,245,0.14);
    --sidebar-active-border: #42a5f5;
    --header-height: 56px;
    --header-bg: #ffffff;
    --header-border: #e8ecf0;
    --content-bg: #f0f3f7;
    --primary: #1565c0;
    --primary-light: #42a5f5;
    --card-shadow: 0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.04);
    --radius: 8px;
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    font-size: 0.9rem;
    color: #37474f;
    background-color: var(--content-bg);
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ----- */
.app-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Logo area */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-brand-text span {
    display: block;
    white-space: nowrap;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    margin-top: 1px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0 20px;
}

/* Sezioni del menu a fisarmonica (stile Sonata): intestazione con icona e freccia, voci rientrate */
.sidebar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 20px;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    text-align: left;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.sidebar-group > i:first-child {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    opacity: 0.75;
}
.sidebar-group > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-group:hover { background-color: var(--sidebar-hover-bg); color: #fff; }
.sidebar-group:hover > i:first-child,
.sidebar-group-attiva > i:first-child { opacity: 1; }
.sidebar-group-attiva { color: #fff; }
.sidebar-group:focus-visible { outline: 1px solid var(--primary-light); outline-offset: -1px; }

.sidebar-group-freccia {
    font-size: 0.65rem;
    opacity: 0.6;
    transition: transform 0.2s;
    transform: rotate(90deg);
}
.sidebar-group.collapsed .sidebar-group-freccia { transform: rotate(0deg); }

.sidebar-group-voci { background-color: rgba(0,0,0,0.12); }
.sidebar-nav .sidebar-group-voci a { padding-left: 34px; font-size: 0.84rem; }

/* Voci fisse (Pannello Admin, Logout) separate dai moduli */
.sidebar-fisse {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.15s;
}

.sidebar-nav a:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
    border-left-color: rgba(66,165,245,0.4);
}
.sidebar-nav a:hover i { opacity: 1; }

.sidebar-nav a.active {
    background-color: var(--sidebar-active-bg);
    color: #fff;
    border-left-color: var(--sidebar-active-border);
    font-weight: 500;
}
.sidebar-nav a.active i { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-email {
    font-size: 0.72rem;
    color: #607d8b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-ditta {
    font-size: 0.68rem;
    color: #90a4ae;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.sidebar-nav-logout:hover {
    background-color: rgba(239,83,80,0.1);
    color: #ef5350;
    border-left-color: #ef5350;
}
.sidebar-nav-logout:hover i { opacity: 1; }

/* ----- Main Area ----- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ----- Top Header ----- */
.app-header {
    height: var(--header-height);
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.app-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1c2a3a;
    margin: 0;
    flex: 1;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    color: #607d8b;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}
.header-btn:hover {
    background-color: #f0f3f7;
    color: #37474f;
    text-decoration: none;
}
.header-btn.btn-primary-outline {
    color: var(--primary);
    border-color: #c5d8f5;
    background-color: #eef4fd;
}
.header-btn.btn-primary-outline:hover {
    background-color: #daeaf9;
}

/* ----- Page Content ----- */
.app-content {
    flex: 1;
    padding: 24px;
}

/* ----- Page Header ----- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1c2a3a;
    margin: 0 0 4px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.82rem;
    color: #90a4ae;
    margin: 0;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ----- Cards ----- */
.card {
    border: 1px solid #e8ecf0 !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--card-shadow) !important;
    background: #fff;
}

.card-header {
    background-color: #fff !important;
    border-bottom: 1px solid #eef0f3 !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 14px 18px !important;
    font-weight: 600;
    font-size: 0.88rem;
    color: #1c2a3a;
}

.card-body { padding: 18px !important; }
.card-footer {
    background-color: #fafbfc !important;
    border-top: 1px solid #eef0f3 !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
    padding: 12px 18px !important;
}

/* ----- Stat Cards (Dashboard) ----- */
.stat-card {
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #e3f2fd; color: #1565c0; }
.stat-icon.green  { background: #e8f5e9; color: #2e7d32; }
.stat-icon.orange { background: #fff3e0; color: #e65100; }
.stat-icon.teal   { background: #e0f7fa; color: #00695c; }
.stat-icon.purple { background: #f3e5f5; color: #6a1b9a; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1c2a3a;
    line-height: 1;
}
.stat-label {
    font-size: 0.78rem;
    color: #90a4ae;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ----- Tables ----- */
.table {
    margin-bottom: 0;
}
.table > thead > tr > th {
    background-color: #f7f9fc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #607d8b;
    padding: 11px 14px;
    white-space: nowrap;
    vertical-align: middle;
}
.table > tbody > tr > td {
    padding: 11px 14px;
    vertical-align: middle;
    border-color: #f0f3f7;
    color: #37474f;
}
.table > tbody > tr:hover > td {
    background-color: #f5f9ff;
}
.table-striped > tbody > tr:nth-child(odd) > td {
    background-color: #fafbfd;
}

/* ----- Buttons ----- */
.btn {
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 8px 16px;
    transition: all 0.15s;
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }

.btn-primary { background-color: #1565c0; border-color: #1565c0; }
.btn-primary:hover { background-color: #0d47a1; border-color: #0d47a1; box-shadow: 0 2px 8px rgba(21,101,192,.35); }
.btn-success { background-color: #2e7d32; border-color: #2e7d32; }
.btn-success:hover { background-color: #1b5e20; border-color: #1b5e20; }
.btn-danger { background-color: #b71c1c; border-color: #b71c1c; }
.btn-danger:hover { background-color: #7f0000; border-color: #7f0000; }

.btn-outline-primary { color: #1565c0; border-color: #1565c0; }
.btn-outline-primary:hover { background-color: #1565c0; color: #fff; }

/* ----- Badges ----- */
.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

/* ----- Form controls ----- */
.form-control, .form-select {
    border-color: #cfd8dc;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #37474f;
    padding: 9px 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
    border-color: #42a5f5;
    box-shadow: 0 0 0 3px rgba(66,165,245,.15);
}
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #546e7a;
    margin-bottom: 5px;
}
.form-text { font-size: 0.78rem; color: #90a4ae; }

/* ----- Alerts ----- */
.alert {
    border: none;
    border-radius: 7px;
    font-size: 0.88rem;
    padding: 12px 16px;
}
.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid #2e7d32; }
.alert-danger  { background: #ffebee; color: #7f0000; border-left: 4px solid #b71c1c; }
.alert-warning { background: #fff3e0; color: #bf360c; border-left: 4px solid #e65100; }
.alert-info    { background: #e3f2fd; color: #0d47a1; border-left: 4px solid #1565c0; }

/* ----- List group ----- */
.list-group-item {
    border-color: #eef0f3;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: #37474f;
}
.list-group-item-action:hover {
    background-color: #f5f9ff;
    color: var(--primary);
}
.list-group-item-action:hover i { color: var(--primary) !important; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b0bec5; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #78909c; }

/* ============================================================
   PIANIFICAZIONE (squadre, assegnazione cantieri)
   ============================================================ */
.pers-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background: #e3f2fd;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pers-avatar.coord { background: #fff3e0; color: #e65100; }
.pers-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.pers-remove { opacity: 0; transition: opacity .15s; }
.pers-row:hover .pers-remove, .pers-remove:focus { opacity: 1; }
.squadra-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #90a4ae;
    margin-bottom: 4px;
}
.squadra-inattiva { opacity: .65; }
.min-w-0 { min-width: 0; }

.asg-tabella th, .asg-tabella td { vertical-align: middle; }
.asg-tabella .asg-nome {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    min-width: 190px;
    max-width: 230px;
    border-right: 1px solid #e3e8ee;
}
.asg-tabella thead th { text-align: center; }
.asg-tabella thead .asg-giorno { border-left: 2px solid #e3e8ee; }
.asg-tabella thead .asg-oggi { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary-light); }
.asg-tabella .asg-fasce th {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #90a4ae;
    padding: 4px 6px;
}
.asg-sezione td {
    background: #f5f7fa !important;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #78909c;
    padding: 6px 14px !important;
    text-align: left;
}
.asg-sezione-testo { position: sticky; left: 14px; }
.asg-riga-squadra .asg-nome { background: #fafbfd; }

/* Mezza giornata: la mattina apre il giorno con un bordo più marcato, lo sfondo tratteggiato è il tempo libero. */
.asg-mezza {
    min-width: 128px;
    width: 128px;
    padding: 4px !important;
    vertical-align: top !important;
    background-image: repeating-linear-gradient(135deg, transparent 0 6px, #f4f6f9 6px 7px);
}
.asg-mattina { border-left: 2px solid #e3e8ee; }
.asg-pomeriggio { border-left: 1px dashed #e3e8ee; }
.asg-modificabile { cursor: pointer; }
.asg-modificabile:hover { background-color: #f5f9ff; }
.asg-blocchi { display: flex; flex-direction: column; gap: 2px; min-height: 34px; }
.asg-blocco {
    position: relative;
    display: flex;
    align-items: stretch;
    min-width: 0;
    border: 1px solid #e3e8ee;
    border-left: 3px solid;
    border-radius: 4px;
    padding: 2px 16px 2px 5px;
    box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.asg-blocco-testo { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.asg-blocco-nome { font-size: 0.72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #263238; }
.asg-blocco-dett { font-size: 0.64rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #607d8b; }
.asg-blocco-azione {
    position: absolute;
    top: 1px;
    right: 1px;
    border: 0;
    background: transparent;
    color: #78909c;
    font-size: 0.65rem;
    padding: 1px 3px;
    line-height: 1;
    opacity: 0;
}
.asg-blocco:hover .asg-blocco-azione, .asg-blocco-azione:focus { opacity: 1; }
.asg-blocco-azione:hover { color: #b71c1c; }
.asg-escluso { opacity: .45; }
.asg-escluso .asg-blocco-nome { text-decoration: line-through; }
.asg-escluso .asg-blocco-azione { opacity: 1; }
.asg-escluso .asg-blocco-azione:hover { color: var(--primary); }
.asg-carico { font-size: 0.64rem; color: #90a4ae; text-align: right; margin-top: 2px; min-height: 1em; }
.asg-sovraccarico { box-shadow: inset 0 0 0 2px #e57373; }
.asg-sovraccarico .asg-carico { color: #c62828; font-weight: 600; }

/* Vista cantieri: una colonna per giorno, mattina sopra e pomeriggio sotto. */
.vc-giorno { min-width: 150px; padding: 0 !important; vertical-align: top !important; border-left: 2px solid #e3e8ee; }
.vc-zona { padding: 4px 6px; min-height: 44px; }
.vc-zona + .vc-zona { border-top: 1px dashed #e3e8ee; }
.vc-vuota { background-image: repeating-linear-gradient(135deg, transparent 0 6px, #f4f6f9 6px 7px); }
.vc-etichetta {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #b0bec5;
    margin-bottom: 2px;
}
.asg-chip {
    font-size: 0.68rem;
    border-left: 3px solid;
    border-radius: 4px;
    padding: 2px 5px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.asg-totali th, .asg-totali td { background: #f5f7fa; }
.asg-legenda-colore { width: 12px; height: 12px; border-radius: 3px; border: 2px solid; display: inline-block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }

    .app-content { padding: 16px; }
    .page-header { flex-direction: column; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.3rem; }
}

/* Gestione Ore › Riepilogo ore: tabella compatta stile foglio di calcolo, tutta la settimana senza scorrere */
.ro-legenda {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 0.74rem;
    color: #607d8b;
    margin-bottom: 10px;
}
.ro-contenitore { width: 100%; overflow-x: auto; } /* riserva: la pagina non scorre mai di lato */
.ro-tabella {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    color: #37474f;
}
.ro-tabella th, .ro-tabella td {
    padding: 3px 3px;
    border-bottom: 1px solid #edf0f3;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}
.ro-tabella thead th {
    background: #eef2f6;
    color: #455a64;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid #d5dde5;
}
.ro-tabella thead tr:first-child th { padding-top: 6px; padding-bottom: 4px; }
.ro-tabella thead .ro-sotto th {
    font-size: 0.6rem;
    font-weight: 600;
    color: #78909c;
    padding: 2px 2px;
    border-bottom: 2px solid #cfd8e0;
}
.ro-tabella thead th[rowspan] { border-bottom: 2px solid #cfd8e0; vertical-align: bottom; }
.ro-tabella .ro-data { font-weight: 400; color: #78909c; }

/* separatore tra i gruppi (giorni, settimana) */
.ro-tabella .ro-sep { border-left: 2px solid #d5dde5; }

/* righe alternate, anche le righe di dettaglio seguono la loro persona */
.ro-tabella tbody .ro-pari > td { background: #fff; }
.ro-tabella tbody .ro-dispari > td { background: #f5f7fa; }
.ro-tabella tbody tr:hover > td { background: #e8f1fc; }
.ro-tabella tbody .ro-dettaglio > td { color: #607d8b; font-size: 0.72rem; border-bottom-style: dashed; }

/* colonne speciali */
.ro-tabella .ro-nome {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    border-right: 1px solid #d5dde5;
}
.ro-tabella thead .ro-nome { z-index: 4; text-align: left; }
.ro-espandi { color: inherit; text-decoration: none; display: inline; }
.ro-espandi:hover { color: var(--primary); }
.ro-espandi .fa-chevron-right { font-size: 0.6rem; width: 12px; margin-right: 3px; color: #90a4ae; transition: transform .15s; }
.ro-espandi:not(.collapsed) .fa-chevron-right { transform: rotate(90deg); }
.ro-cantiere { padding-left: 15px; font-weight: 400; }
.ro-cantiere .fa { font-size: 0.66rem; margin-right: 4px; }
.ro-tabella .ro-azioni { text-align: center; padding: 0 3px; }
.ro-btn {
    display: inline-block;
    border: 0;
    background: none;
    padding: 1px 2px;
    color: #90a4ae;
    font-size: 0.72rem;
    line-height: 1;
}
.ro-btn:hover { color: var(--primary); }
.ro-tabella .ro-giust { text-align: right; }
/* totale del giorno (lavoro + viaggio + giustificativi approvati) */
.ro-tabella .ro-tot { font-weight: 600; color: #1c2a3a; border-left: 1px dotted #b0bec5; }
.ro-tabella tbody .ro-dettaglio > td.ro-tot { font-weight: 400; color: #607d8b; }
.ro-icona { font-size: 0.7rem; margin-right: 2px; }

/* giorni non lavorativi e oggi: velatura sopra il colore della riga */
.ro-tabella .ro-festivo { box-shadow: inset 0 0 0 999px rgba(96,125,139,.06); color: #78909c; }
.ro-tabella .ro-oggi { box-shadow: inset 0 0 0 999px rgba(66,165,245,.08); }
.ro-tabella thead .ro-oggi { color: var(--primary); }

.ro-tabella tfoot td {
    background: #eef2f6;
    font-weight: 600;
    border-top: 2px solid #cfd8e0;
    border-bottom: 0;
}

/* ----- Gestione giustificativi ----- */
.gg-icona { width: 1.4em; text-align: center; }
.gg-ore { max-width: 90px; }
/* ----- Gestione › Operatori ----- */
.op-licenze { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.op-licenza-num { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.op-licenza-barra { height: 5px; margin-top: 6px; }
.op-licenza-scad { font-size: 0.7rem; margin-top: 3px; }
.op-licenza-no { opacity: .7; }
.op-tabella .op-disattivato > td { color: #90a4ae; }
.op-tabella .op-disattivato .fw-semibold { text-decoration: line-through; }

.gg-modificata > td { background-color: #fff8e1 !important; }
.gg-salva:disabled { opacity: .45; }

/* =====================================================================================================================
   Standard grafico (STANDARD_GRAFICO.md): sezioni, azioni a icona, schede. Da usare con le macro di
   templates/_comuni/ui.html.twig, mai ricopiando il markup.
   ===================================================================================================================== */

/* Testata di sezione: icona + titolo a sinistra, azioni a icona a destra (dentro .card-header o da sola) */
.sezione-testata {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sezione-testata .sezione-titolo { flex: 1; min-width: 0; }
.sezione-testata .sezione-titolo > i { color: #90a4ae; width: 1.2em; margin-right: 4px; }
.sezione-testata .sezione-azioni { display: flex; align-items: center; gap: 2px; }
.sezione-sotto {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1c2a3a;
    border-bottom: 1px solid #eef0f3;
    padding-bottom: 6px;
    margin: 20px 0 8px;
}
.sezione-sotto:first-child { margin-top: 0; }

/* Azione a icona: niente cerchio né bordo, grigia, al passaggio blu (rossa per l'eliminazione) */
.azione {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #78909c;
    font-size: 0.9rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}
.azione:hover, .azione:focus-visible { color: var(--primary); background: #eef4fb; }
.azione.azione-pericolo:hover, .azione.azione-pericolo:focus-visible { color: #b71c1c; background: #fdecea; }
.azione.azione-successo:hover { color: #2e7d32; background: #e8f5e9; }
.azione.azione-attiva { color: #f9a825; }
.azione:disabled, .azione.disabled { opacity: .35; pointer-events: none; }
.azioni-riga { white-space: nowrap; text-align: right; }
.azioni-riga form { display: inline; }

/* Dati in sola lettura: etichetta piccola sopra, valore sotto */
.dato-etichetta { font-size: 0.74rem; color: #90a4ae; text-transform: uppercase; letter-spacing: .02em; }
.dato-valore { font-weight: 600; color: #1c2a3a; word-break: break-word; }

/* ==========================================================================
   Statistiche (STATISTICHE_BASE.md): grafici in SVG/CSS senza librerie.
   Colori validati (blu/arancio e blu/viola, anche per daltonici); "a costo" ha anche il tratteggio e l'icona del cartellino.
   ========================================================================== */
:root {
    --st-lavoro: #2a78d6;
    --st-viaggio: #eb6834;
    --st-materiale: #2a78d6;
    --st-costo: #4a3aa7;
    --st-costo-tenue: #ecebf7;
    --st-griglia: #e6e9ee;
    --st-testo: #52514e;
    --st-h1: #d3e4f8;
    --st-h2: #93bdee;
    --st-h3: #4a8fe0;
    --st-h4: #1d5aa6;
}
.st-c-lavoro { fill: var(--st-lavoro); background: var(--st-lavoro); }
.st-c-viaggio { fill: var(--st-viaggio); background: var(--st-viaggio); }
.st-c-materiale { background: var(--st-materiale); }
.st-c-costo {
    background: var(--st-costo)
        repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 3px, transparent 3px 7px);
}
.st-legenda { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .78rem; color: var(--st-testo); margin-bottom: 8px; align-items: center; }
.st-campione { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.st-campione.st-h1 { background: var(--st-h1); } .st-campione.st-h2 { background: var(--st-h2); }
.st-campione.st-h3 { background: var(--st-h3); } .st-campione.st-h4 { background: var(--st-h4); }
.st-nota { font-size: .74rem; color: #78909c; }
.st-delta { display: block; font-size: .72rem; color: #78909c; margin-top: 2px; }
.st-tessera:hover { box-shadow: 0 0 0 2px var(--primary-light) !important; }
.st-tessera-costo { border-left: 4px solid var(--st-costo) !important; }

/* colonne delle ore per giorno */
.st-grafico { width: 100%; height: auto; display: block; overflow: visible; }
.st-griglia { stroke: var(--st-griglia); stroke-width: 1; }
.st-base { stroke: #b0bec5; stroke-width: 1; }
.st-asse { font-size: 11px; fill: #78909c; }
.st-asse.st-festivo { fill: #b0bec5; }
.st-valore { font-size: 11px; fill: var(--st-testo); font-weight: 600; }
.st-hit { fill: transparent; }
.st-colonna:hover .st-hit { fill: rgba(42,120,214,.06); }

/* cantieri nel tempo: una cella per giorno */
.st-contenitore { width: 100%; overflow-x: auto; }
.st-tabella th, .st-tabella td { white-space: nowrap; }
.st-tabella .st-nome { white-space: normal; min-width: 140px; }
.st-col-tempo { width: 1%; }
.st-tempo { display: grid; gap: 2px; }
.st-tempo-settimana { grid-template-columns: repeat(7, 30px); }
.st-tempo-mese { grid-template-columns: repeat(var(--st-giorni, 31), 9px); gap: 1px; }
.st-tempo-mese .st-giorno { font-size: .56rem; letter-spacing: -.5px; }
.st-tempo-mese .st-giorno:nth-child(even) { visibility: hidden; }
.st-giorno { font-size: .66rem; color: #78909c; text-align: center; font-weight: 400; }
.st-giorno.st-festivo { color: #b0bec5; }
.st-cella { height: 18px; border-radius: 3px; background: #f2f4f7; }
.st-cella.st-festivo { background: #f8f9fb; }
.st-cella.st-h0, .st-campione.st-h0 { background: #fff; box-shadow: inset 0 0 0 1.5px var(--st-h3); }
.st-cella.st-h1 { background: var(--st-h1); } .st-cella.st-h2 { background: var(--st-h2); }
.st-cella.st-h3 { background: var(--st-h3); } .st-cella.st-h4 { background: var(--st-h4); }
.st-cella[data-tip] { cursor: default; }
.st-cella[data-tip]:hover { outline: 2px solid #263238; outline-offset: 1px; }
.st-num { min-width: 90px; }

/* barre orizzontali impilate (lavoro + viaggio), 2px di stacco fra i segmenti */
.st-barra, .st-barretta { display: flex; gap: 2px; background: transparent; }
.st-barra { height: 12px; min-width: 80px; }
.st-barretta { height: 4px; margin-bottom: 3px; justify-content: flex-end; }
.st-barra > span, .st-barretta > span { display: block; border-radius: 2px; }
.st-barra > span[style="width: 0%"], .st-barretta > span[style="width: 0%"] { display: none; }

/* materiali: divisione righe normali / a costo */
.st-divisione { display: flex; gap: 2px; height: 14px; }
.st-divisione > span { border-radius: 3px; min-width: 6px; }
.st-articolo { min-width: 220px; }
.st-tag-costo { display: inline-block; padding: 0 6px; border-radius: 10px; background: var(--st-costo-tenue); color: #3a2d8a; font-size: .78rem; white-space: nowrap; }
.st-riga-costo > td:first-child { box-shadow: inset 3px 0 0 var(--st-costo); }

/* squadre */
.st-squadra { border-top: 1px solid #eef1f4; padding: 6px 0; }
.st-squadra summary { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
.st-squadra summary::-webkit-details-marker { display: none; }
.st-squadra-nome { font-weight: 600; font-size: .9rem; }
.st-squadra-ore { font-weight: 600; font-size: .9rem; min-width: 52px; text-align: right; }
.st-membri { list-style: none; margin: 6px 0 2px; padding: 0 0 0 12px; font-size: .84rem; }
.st-membri li { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed #eef1f4; }

.st-tooltip {
    position: fixed; z-index: 1080; pointer-events: none; background: #263238; color: #fff; font-size: .78rem;
    padding: 6px 9px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.18); max-width: 260px;
}
.st-squadra-nome .st-nota { font-weight: 400; }
#st-persone td:first-child { min-width: 150px; }

/* ==========================================================================
   Importa (IMPORTA_DATI.md): passi numerati, zona di caricamento, conteggi ed esiti per riga.
   ========================================================================== */
.imp-passo { font-weight: 600; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.imp-numero { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem;
    border-radius: 50%; background: var(--bs-primary); color: #fff; font-size: .85rem; }
.imp-zona { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1rem; border: 2px dashed var(--bs-border-color);
    border-radius: .5rem; cursor: pointer; color: var(--bs-secondary-color); transition: border-color .15s, background .15s; margin: 0; }
.imp-zona > i { font-size: 1.6rem; }
.imp-zona:hover, .imp-zona-sopra { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .05); }
.imp-zona-piena { border-style: solid; color: var(--bs-body-color); }
.imp-avanzamento { margin-top: .75rem; }
.imp-avanzamento .progress { height: .75rem; }
.imp-conteggi { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .5rem; }
.imp-conteggio-foglio { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.imp-foglio { min-width: 5.5rem; font-size: .85rem; font-weight: 600; }
.imp-badge { display: inline-block; padding: .15rem .5rem; border-radius: 1rem; font-size: .78rem; white-space: nowrap; border: 1px solid transparent; }
.imp-b-nuovo { background: #e3f4e8; color: #17603a; border-color: #b9e2c7; }
.imp-b-aggiornato { background: #e3eefb; color: #1d4f91; border-color: #bcd3f2; }
.imp-b-invariato { background: #f1f2f4; color: #555; border-color: #dcdfe3; }
.imp-b-saltato { background: #fdf3dc; color: #7a5300; border-color: #f1dca6; }
.imp-b-errore { background: #fbe5e5; color: #9b1c1c; border-color: #f2bcbc; }
.imp-tabella { max-height: 60vh; overflow-y: auto; }
.imp-tabella thead th { position: sticky; top: 0; background: var(--bs-body-bg); z-index: 1; }
.imp-riga-errore td:first-child { box-shadow: inset 3px 0 0 #c0392b; }
.imp-tabella td, .imp-tabella th { padding: .4rem .6rem; vertical-align: top; }
.imp-tabella td:nth-child(1), .imp-tabella td:nth-child(3) { white-space: nowrap; }
.imp-tabella td:nth-child(2) { min-width: 150px; }
.imp-tabella td:nth-child(4) { min-width: 180px; }
.imp-chiave { display: flex; gap: .75rem; align-items: flex-start; margin-top: .9rem; padding: .7rem .9rem; border-radius: .5rem;
    background: rgba(var(--bs-primary-rgb), .06); border-left: 3px solid var(--bs-primary); font-size: .9rem; }
.imp-chiave > i { color: var(--bs-primary); margin-top: .2rem; }

/* ----- Elenchi standard (ELENCHI_STANDARD.md, templates/_comuni/elenco.html.twig) ----- */
.elenco { overflow: hidden; }
.elenco-filtri {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid #e3e8ee; background: #fff;
}
/* campi compatti (le regole generali dei form hanno padding 9px 12px) */
.elenco-filtri .form-select, .elenco-filtri .form-control { font-size: .8125rem; padding-top: 4px; padding-bottom: 4px; }
.elenco-filtri .form-control { padding-left: 8px; }
.elenco-filtri .form-select { width: auto; min-width: 130px; padding-left: 8px; padding-right: 28px; }
.elenco-filtri .input-group-text { padding: 4px 8px; }
.elenco-filtri .btn { padding-top: 4px; padding-bottom: 4px; }
.elenco-filtri .form-check { margin-bottom: 0 !important; }
.elenco-filtro { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: #607d8b; margin: 0; }
.elenco-cerca { width: 320px; max-width: 100%; }
.elenco-cerca .input-group-text { background: #fff; color: #90a4ae; font-size: .75rem; }
.elenco-cerca .form-control { border-left: 0; padding-left: 0; }

.elenco-scorri { overflow: auto; background: #fff; }
.tabella-elenco { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8125rem; color: #263238; }
.tabella-elenco th, .tabella-elenco td {
    padding: 3px 8px; line-height: 1.35; white-space: nowrap; vertical-align: middle;
    border-right: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4;
}
.tabella-elenco th:last-child, .tabella-elenco td:last-child { border-right: 0; }
.tabella-elenco thead th {
    position: sticky; top: 0; z-index: 2;
    background: #f3f6f9; color: #455a64; font-weight: 600; font-size: .78rem;
    border-bottom: 1px solid #d5dde5; padding-top: 6px; padding-bottom: 6px;
}
.tabella-elenco .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabella-elenco .cella-limitata { overflow: hidden; text-overflow: ellipsis; }
.tabella-elenco tbody tr:nth-child(even) > td { background: #fafbfc; }
.tabella-elenco tbody tr:hover > td { background: #eaf2fd; }
.tabella-elenco tbody tr[data-href] { cursor: pointer; }
.tabella-elenco tbody tr.text-muted > td { color: #90a4ae; }
.tabella-elenco a { color: inherit; text-decoration: none; }
.tabella-elenco td a:hover { color: var(--primary); text-decoration: underline; }
.tabella-elenco .elenco-vuoto > td { text-align: center; color: #90a4ae; padding: 32px 8px; background: #fff !important; white-space: normal; }
/* azioni sempre visibili a destra anche scorrendo in orizzontale */
.tabella-elenco .col-azioni { position: sticky; right: 0; width: 1%; padding-top: 0; padding-bottom: 0; background: #fff; box-shadow: -1px 0 0 #edf0f4; }
.tabella-elenco thead .col-azioni { background: #f3f6f9; z-index: 3; }
.tabella-elenco .col-azioni .azione { width: 26px; height: 24px; font-size: .8rem; }
.tabella-elenco .elenco-miniatura { width: 22px; height: 22px; object-fit: cover; border-radius: 3px; display: block; }
.tabella-elenco .elenco-miniatura.vuota { display: inline-flex; align-items: center; justify-content: center; background: #eef1f4; color: #b0bec5; font-size: .65rem; }

.elenco-ordina { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.elenco-ordina i { font-size: .7rem; color: #b0bec5; }
.elenco-ordina:hover, .elenco-ordina.attiva { color: var(--primary); }
.elenco-ordina.attiva i { color: var(--primary); }

.elenco-piede {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
    padding: 6px 12px; border-top: 1px solid #d5dde5; background: #f7f9fb; font-size: .8125rem; color: #455a64;
}
.elenco-per { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.elenco-per .form-select { width: auto; min-width: 68px; padding: 1px 26px 1px 8px; font-size: .8125rem; }
.elenco-pagine { display: inline-flex; align-items: center; gap: 2px; }
.elenco-passo {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: 4px; color: #455a64; text-decoration: none;
}
.elenco-passo:hover { background: #e3ebf3; color: var(--primary); }
.elenco-passo.disabled { opacity: .3; }
.elenco-pagina { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px; }
.elenco-pagina .form-control { width: 58px; padding: 1px 4px !important; text-align: center; font-size: .8125rem; }
.elenco-esporta { margin-left: auto; display: inline-flex; gap: 6px; }
.elenco-esporta .btn { padding: 1px 8px; font-size: .78rem; }

/* testata dell'elenco: risultati e filtri usati, a destra imbuto (ricerca e filtri) e Nuovo */
.elenco-testata {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    padding: 8px 12px; border-bottom: 1px solid #e3e8ee; background: #fff;
}
.elenco-riepilogo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8125rem; color: #455a64; min-width: 0; }
.elenco-chip {
    display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 1px 8px; border-radius: 10px; background: #eef4fb; color: #1c2a3a; font-size: .75rem;
}
.elenco-togli { font-size: .75rem; color: #b71c1c; text-decoration: none; }
.elenco-togli:hover { text-decoration: underline; }
.elenco-comandi { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.elenco-comando {
    position: relative; display: inline-flex; align-items: center; gap: 4px; height: 31px; padding: 0 10px;
    border: 1px solid #cfd8dc; border-radius: 6px; background: #fff; color: #455a64; font-size: .85rem;
}
.elenco-comando:hover, .elenco-comando.aperto { border-color: var(--primary-light); color: var(--primary); background: #f5f9ff; }
.elenco-freccia { font-size: .65rem; transition: transform .15s; }
.elenco-comando.aperto .elenco-freccia { transform: rotate(180deg); }
.elenco-conta {
    position: absolute; top: -7px; right: -7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center;
}
.elenco-filtri[hidden] { display: none !important; }
.elenco-filtri { background: #f9fbfd; }
