/* Gestione Assenze Web - Stile */

:root {
    --navy: #1e3a5f;
    --blue: #2563eb;
    --blue-light: #e0edff;
    --bg: #f4f6fa;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1f2937;
    --muted: #6b7280;
    --green: #10b981;
    --red: #ef4444;
    --orange: #f59e0b;
    --yellow-bg: #fef3c7;
    --yellow-border: #fde68a;
    --yellow-text: #92400e;

    /* palette 5 macro-cause (allineata al tool desktop) */
    --c-assenza-contrattuale: #3B82F6;   /* blu */
    --c-malattia: #EF4444;                /* rosso */
    --c-legge104: #14B8A6;                /* verde acqua */
    --c-aspettativa: #8B5CF6;             /* viola */
    --c-altro: #6B7280;                   /* grigio */
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.schermata {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- LOGIN ---- */
#schermata-login {
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #1e3a5f 0%, #2c4a72 100%);
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-brand { text-align: center; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--navy); }
.login-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

#input-password {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    font-family: inherit;
}
#input-password:focus { border-color: var(--blue); }

#btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}
#btn-login:hover, #btn-login:active { background: #1d4ed8; }
#btn-login:disabled { opacity: 0.6; }

.login-errore { color: var(--red); font-size: 14px; text-align: center; min-height: 20px; }

/* ---- TOPBAR ---- */
.topbar {
    background: var(--navy);
    color: white;
    padding: 14px 18px;
    padding-top: calc(14px + env(safe-area-inset-top));
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.brand-title { font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }
.brand-subtitle { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.brand-drill { flex: 1; text-align: center; overflow: hidden; }
.brand-drill .brand-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 16px;
}

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

.btn-icon {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btn-icon:hover, .btn-icon:active { background: rgba(255, 255, 255, 0.25); }

.btn-logout, .btn-indietro {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.btn-indietro { padding: 6px 12px; font-size: 18px; line-height: 1; }
.btn-logout:hover, .btn-logout:active,
.btn-indietro:hover, .btn-indietro:active { background: rgba(255, 255, 255, 0.25); }

.spacer { width: 40px; }

/* ---- CONTENT ---- */
.content {
    padding: 16px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 40px;
}

.periodo-info {
    background: var(--card);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
    border: 1px solid var(--border);
}
.periodo-info strong { color: var(--navy); font-size: 15px; }

/* ---- SELETTORE PERIODO ---- */
.periodo-selector {
    background: var(--card);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.periodo-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-bottom: 4px;
}
.periodo-chips::-webkit-scrollbar { display: none; }
.periodo-chip {
    background: #f1f5f9;
    color: var(--muted);
    border: 1.5px solid transparent;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
}
.periodo-chip:hover, .periodo-chip:active {
    background: #e2e8f0;
    color: var(--text);
}
.periodo-chip.attivo {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}
.periodo-chip.attivo:hover, .periodo-chip.attivo:active {
    background: #1d4ed8;
}
.periodo-label {
    font-size: 12px;
    color: var(--muted);
    padding: 0 4px;
    font-weight: 500;
}

/* ---- FILTRI MACRO ---- */
.filtri-macro {
    background: var(--card);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.filtri-macro-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
    padding: 0 4px;
}
.filtri-macro-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}
.filtri-macro-chips::-webkit-scrollbar { display: none; }
.filtro-chip {
    --macro-color: var(--muted);
    background: #f1f5f9;
    color: var(--muted);
    border: 1.5px solid transparent;
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.filtro-chip::before {
    content: '';
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--macro-color);
}
.filtro-chip[data-macro="Malattia"]::before,
.filtro-chip[data-macro="Legge 104"]::before,
.filtro-chip[data-macro="Aspettativa"]::before,
.filtro-chip[data-macro="Assenza contrattuale"]::before,
.filtro-chip[data-macro="Altro"]::before {
    display: inline-block;
}
.filtro-chip:hover, .filtro-chip:active {
    background: #e2e8f0;
    color: var(--text);
}
.filtro-chip.attivo {
    background: var(--macro-color);
    color: white;
    border-color: var(--macro-color);
}
.filtro-chip.attivo[data-macro="tutti"] {
    background: var(--blue);
    border-color: var(--blue);
}
.filtro-chip.attivo::before {
    background: white;
}

/* ---- POPUP RANGE ---- */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.popup-box {
    background: white;
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.popup-box h3 {
    margin: 0;
    font-size: 18px;
    color: var(--navy);
}
.popup-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}
.popup-box input[type="date"] {
    padding: 10px 12px;
    font-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    color: var(--text);
}
.popup-box input[type="date"]:focus {
    outline: none;
    border-color: var(--blue);
}
.popup-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}
.btn-primario, .btn-secondario {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    border: 1.5px solid transparent;
}
.btn-primario {
    background: var(--blue);
    color: white;
}
.btn-secondario {
    background: white;
    color: var(--muted);
    border-color: var(--border);
}
.btn-primario:hover, .btn-primario:active { background: #1d4ed8; }
.range-errore {
    color: var(--red);
    font-size: 13px;
    min-height: 18px;
    text-align: center;
}
/* ---- SELETTORE ORGANIGRAMMA ---- */
.org-selector {
    margin-bottom: 10px;
}
.org-chip {
    background: white;
    color: var(--navy);
    border: 1.5px solid var(--border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.org-chip:hover, .org-chip:active {
    background: var(--blue-light);
}
.org-icon { font-size: 14px; }
.org-caret { font-size: 10px; color: var(--muted); }

.org-lista {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}
.org-item {
    background: white;
    border: 1.5px solid var(--border);
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}
.org-item:hover, .org-item:active {
    background: var(--blue-light);
}
.org-item.attivo {
    background: var(--blue-light);
    border-color: var(--blue);
}
.org-item-nome {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}
.org-item-dettaglio {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}
.org-item-check {
    color: var(--blue);
    font-size: 18px;
    font-weight: 700;
}

/* ---- BANNER CAVALLO ---- */
.banner-cavallo {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.banner-cavallo:hover, .banner-cavallo:active {
    background: #fde68a;
}
.banner-cavallo-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.banner-cavallo-testo {
    flex: 1;
    min-width: 0;
}
.banner-cavallo-titolo {
    font-size: 14px;
    font-weight: 700;
    color: var(--yellow-text);
    margin-bottom: 3px;
}
.banner-cavallo-riepilogo {
    font-size: 12px;
    color: #78350f;
    line-height: 1.4;
}
.banner-cavallo-freccia {
    color: var(--yellow-text);
    font-size: 18px;
    font-weight: 700;
}

/* ---- BANNER "NESSUN REPORT" ---- */
.banner-noreport {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.banner-noreport-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.banner-noreport-testo { flex: 1; min-width: 0; }
.banner-noreport-titolo {
    font-size: 14px;
    font-weight: 700;
    color: #075985;
    margin-bottom: 3px;
}
.banner-noreport-riepilogo {
    font-size: 12px;
    color: #0c4a6e;
    line-height: 1.4;
}

/* ---- VARIAZIONI (schermata) ---- */
.var-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: var(--card);
    padding: 6px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.var-tab {
    flex: 1;
    background: transparent;
    color: var(--muted);
    border: none;
    padding: 10px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: background 0.15s;
}
.var-tab:hover, .var-tab:active {
    background: #f1f5f9;
}
.var-tab.attivo {
    background: var(--navy);
    color: white;
}
.var-tab-num {
    font-size: 18px;
    font-weight: 700;
}
.var-tab.attivo .var-tab-num {
    color: white;
}

.var-item {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 6px;
}
.var-item-nome {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}
.var-item-nome .var-mat {
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 8px;
}
.var-item-dett {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}
.var-item-freccia {
    color: var(--muted);
    margin: 0 6px;
}
.var-item-old { color: var(--muted); }
.var-item-new { color: var(--navy); font-weight: 600; }
.var-vuoto {
    text-align: center;
    padding: 30px;
    color: var(--muted);
    font-style: italic;
    font-size: 14px;
}

/* ---- RICERCA ---- */
.cerca-input-wrap {
    position: relative;
    margin-bottom: 14px;
}
#input-cerca {
    width: 100%;
    padding: 14px 40px 14px 16px;
    font-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    background: white;
}
#input-cerca:focus { border-color: var(--blue); }
.btn-cerca-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #f1f5f9;
    color: var(--muted);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-cerca-clear:hover { background: #e2e8f0; }

.cerca-hint {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 30px 20px;
    font-style: italic;
}

.cerca-sezione {
    margin-bottom: 14px;
}
.cerca-sezione-titolo {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px 4px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.cerca-sezione-conteggio {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    opacity: 0.75;
}
.cerca-vuoto {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 15px;
    font-style: italic;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.dip-card {
    background: var(--card);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.1s;
}
.dip-card:active { transform: scale(0.98); }
.dip-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.dip-info-cerca {
    flex: 1;
    min-width: 0;
}
.dip-nome-cerca {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}
.dip-dett-cerca {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.35;
}
.dip-badge-ass {
    background: #fee2e2;
    color: #991b1b;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.dip-badge-noass {
    background: #d1fae5;
    color: #065f46;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- DETTAGLIO DIPENDENTE ---- */
.dip-blocco {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.dip-blocco-titolo {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dip-blocco-periodo {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}
.dip-episodio {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    padding: 8px 4px;
    border-top: 1px solid var(--border);
    align-items: center;
    font-size: 13px;
}
.dip-episodio:first-of-type { border-top: none; }
.dip-episodio-badge {
    grid-row: 1;
}
.dip-episodio-dett {
    grid-row: 1;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dip-episodio-desc {
    color: var(--text);
    font-weight: 500;
}
.dip-episodio-periodo {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.dip-nessuno {
    text-align: center;
    color: var(--muted);
    font-style: italic;
    font-size: 13px;
    padding: 12px;
}

.card-blocco {
    background: var(--card);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.section-title {
    margin: 20px 0 10px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.section-hint {
    font-size: 11px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--muted);
    opacity: 0.75;
}

/* ---- KPI ---- */
.kpi-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.kpi-card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px 12px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.kpi-dip::before { background: var(--navy); }
.kpi-ass::before { background: var(--red); }
.kpi-pct::before { background: var(--orange); }

.kpi-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1; }
.kpi-dip .kpi-value { color: var(--navy); }
.kpi-ass .kpi-value { color: var(--red); }
.kpi-pct .kpi-value { color: var(--orange); }

/* ---- DISTRIBUZIONE TIPI ASSENZA ---- */
.distribuzione {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.distr-item {
    display: flex;
    flex-direction: column;
}

.distr-riga {
    display: grid;
    grid-template-columns: 130px 1fr 55px;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.distr-item.espandibile > .distr-riga {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    margin: 0 -6px;
    transition: background 0.15s;
}
.distr-item.espandibile > .distr-riga:active {
    background: rgba(0, 0, 0, 0.03);
}

.distr-nome {
    color: var(--text);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.distr-freccia {
    display: inline-block;
    color: var(--muted);
    font-size: 10px;
    transition: transform 0.2s;
    width: 12px;
    text-align: center;
}
.distr-item.aperto .distr-freccia {
    transform: rotate(90deg);
}
.distr-freccia-placeholder {
    display: inline-block;
    width: 12px;
}

.distr-bar-bg {
    background: #f1f5f9;
    height: 10px;
    border-radius: 10px;
    overflow: hidden;
}
.distr-bar-fg {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}
.distr-count {
    text-align: right;
    color: var(--muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

/* Dettaglio sotto-cause: nascosto di default, apre al tap */
.distr-sottocause {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 16px;
    border-left: 2px solid var(--border);
    margin-left: 6px;
    margin-top: 0;
}
.distr-item.aperto .distr-sottocause {
    max-height: 500px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.distr-riga-sotto {
    padding: 2px 0;
    grid-template-columns: 115px 1fr 40px;
    font-size: 12px;
}
.distr-nome-sotto {
    color: var(--muted);
    font-weight: 400;
    padding-left: 4px;
}
.distr-bar-sotto {
    height: 6px;
}
.distr-count-sotto {
    font-size: 11px;
}

/* ---- LISTA UFFICI ---- */
.ufficio-card {
    background: var(--card);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
}
.ufficio-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.ufficio-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ufficio-icon.sede { background: #eef2ff; color: #4338ca; }
.ufficio-icon.filiale { background: #ecfdf5; color: #059669; }
.ufficio-icon.agenzia { background: #fef3c7; color: #92400e; }
.ufficio-icon.altro { background: #f3f4f6; color: #4b5563; }

.ufficio-info {
    flex: 1;
    min-width: 0;
}
.ufficio-nome {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.3;
}
.ufficio-codice {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
    margin-top: 2px;
}

.ufficio-badge {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.ufficio-frazione { font-size: 12px; font-weight: 600; color: var(--text); }
.ufficio-pct {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 8px;
    background: var(--blue-light);
    color: var(--navy);
}
.ufficio-pct.alto { background: #fee2e2; color: #991b1b; }
.ufficio-pct.medio { background: #fef3c7; color: #92400e; }
.ufficio-pct.basso { background: #d1fae5; color: #065f46; }

/* ---- DRILL-DOWN ---- */
.drill-summary {
    background: var(--card);
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.assente-card {
    background: var(--card);
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.assente-info { flex: 1; padding-right: 10px; }
.assente-nome { font-size: 14px; font-weight: 600; color: var(--text); }
.assente-mat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.assente-tipo {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.assente-vuoto {
    text-align: center;
    padding: 30px;
    color: var(--muted);
    font-style: italic;
    font-size: 14px;
}

/* ---- TABELLA ASSENTI (drill-down) ---- */
/* ---- DRILL-DOWN ASSENTI ----
 * Struttura: un blocco per dipendente, con header (avatar + nome + n.
 * assenze) e sotto le sue assenze indentate. Sfondo alternato tra
 * blocchi (non tra righe) per non confondere nome con assenze. */
.tabella-assenti {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.dipendente-gruppo {
    padding: 0;
    border-top: 1px solid var(--border);
}
.dipendente-gruppo:first-child { border-top: none; }
.dipendente-gruppo.gruppo-pari { background: white; }
.dipendente-gruppo.gruppo-dispari { background: #f8fafc; }

.dipendente-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 12px 14px 8px 14px;
    align-items: center;
}
.dipendente-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--navy);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.dipendente-info {
    min-width: 0;
}
.dipendente-nome {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dipendente-mat {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}
.dipendente-conta {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: rgba(0,0,0,0.04);
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

.dipendente-assenze {
    padding: 0 14px 12px 62px;    /* 62 = 14+36+12 (allineato al testo, non all'avatar) */
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.assenza-riga {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    font-size: 12px;
}
.dipendente-gruppo.gruppo-dispari .assenza-riga {
    background: rgba(0,0,0,0.03);
}
.assenza-desc {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.assenza-periodo {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.badge-tipo {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ---- IMPOSTAZIONI ---- */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radio-option {
    display: flex;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    gap: 10px;
    transition: border-color 0.15s, background 0.15s;
}
.radio-option:has(input:checked) {
    border-color: var(--blue);
    background: #f0f7ff;
}
.radio-option input[type="radio"] { margin-top: 3px; accent-color: var(--blue); }
.radio-title { font-size: 15px; font-weight: 600; color: var(--navy); }
.radio-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- STATO DATI ---- */
.stato-dati {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.4;
}
.stato-dati.info { background: var(--blue-light); color: var(--navy); border: 1px solid #b6d0f5; }
.stato-dati.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; font-size: 12px; }
.stato-dati.attesa { background: var(--yellow-bg); color: var(--yellow-text); border: 1px solid var(--yellow-border); }
.stato-dati.errore { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.stato-dati strong { display: block; margin-bottom: 2px; }
.stato-dati.attesa strong { font-size: 15px; }
