/* =====================================================
   GIARDINO - Stylesheet
   Paletta: verde bosco + crema caldo + terracotta
   Fonts caricati da <link> nell'HTML (non @import - bloccano Safari print)
   ===================================================== */

/* ---- Reset & Variables ---- */
:root {
    --green-900: #1a2e25;
    --green-800: #233d31;
    --green-700: #2d4a3e;
    --green-600: #3d5e51;
    --green-500: #5a7567;
    --green-300: #8b9d83;
    --green-100: #d4ddd1;
    --green-50:  #ecf1ea;

    --cream-100: #faf7f2;
    --cream-200: #f3ede2;
    --cream-300: #e9dfcc;

    --clay-500:  #c87056;
    --clay-400:  #d68870;
    --clay-100:  #f5dccf;

    --gold-500:  #b89554;
    --red-500:   #b04545;

    --text:       #1a2e25;
    --text-muted: #6b7c73;

    --border: #d8d2c2;
    --shadow-sm: 0 1px 2px rgba(26, 46, 37, 0.06);
    --shadow-md: 0 4px 12px rgba(26, 46, 37, 0.08);
    --shadow-lg: 0 12px 32px rgba(26, 46, 37, 0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { font-size: 16px; }

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--cream-100);
    background-image:
        radial-gradient(at 20% 0%, rgba(139, 157, 131, 0.08) 0%, transparent 50%),
        radial-gradient(at 80% 100%, rgba(200, 112, 86, 0.06) 0%, transparent 50%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    color: var(--green-900);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 500; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h3 { font-size: 1.2rem; font-weight: 600; }

a { color: var(--green-700); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--clay-500); }

.muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* ---- Layout ---- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--green-800);
    color: var(--cream-100);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 🆕 Hamburger button - visibile solo su mobile/tablet */
.topbar-hamburger {
    display: none;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.topbar-hamburger:hover { background: rgba(255, 255, 255, 0.12); }
.topbar-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--cream-100);
    border-radius: 1px;
    transition: all 0.2s ease;
}
.topbar-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar-hamburger.open span:nth-child(2) { opacity: 0; }
.topbar-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 🆕 Nome utente compatto a destra del topbar (mobile only) */
.topbar-user-mobile {
    display: none;
    font-size: 0.85rem;
    color: var(--cream-200);
    margin-left: auto;
    padding-left: 0.5rem;
    flex-shrink: 0;
}

.topbar .brand {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--cream-100);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topbar .brand:hover { color: var(--clay-400); }
.topbar .brand .leaf { font-size: 1.2rem; }
.topbar .brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    /* Filtro per rendere il logo bianco/chiaro su sfondo verde scuro */
    filter: brightness(1.15);
}

.topbar .topbar-nav-desktop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
}

.topbar .topbar-nav-desktop a {
    color: var(--cream-200);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.topbar .topbar-nav-desktop a:hover { background: rgba(255,255,255,0.08); color: var(--cream-100); }
.topbar .topbar-nav-desktop a.active { background: var(--green-700); color: white; }

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.15);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* 🆕 Compatta voci nav su schermi medi (1000-1280px) per evitare wrap brutto */
@media (max-width: 1280px) {
    .topbar .topbar-nav-desktop a { padding: 0.45rem 0.65rem; font-size: 0.85rem; }
    .topbar .user-info { margin-left: 0.5rem; padding-left: 0.5rem; gap: 0.5rem; font-size: 0.8rem; }
}
@media (max-width: 1080px) {
    .topbar .topbar-nav-desktop a { padding: 0.4rem 0.55rem; font-size: 0.8rem; }
}

/* ============================================================ */
/* 🆕 MOBILE DRAWER (≤900px)                                    */
/* ============================================================ */

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: var(--green-800);
    color: var(--cream-100);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-drawer.open { transform: translateX(0); }

.mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0s 0.2s;
}
.mobile-drawer-backdrop.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s;
}

body.drawer-open { overflow: hidden; }

.mobile-drawer .md-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.mobile-drawer .md-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(1.15);
}
.mobile-drawer .md-name {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.15rem;
    color: var(--cream-100);
    line-height: 1.1;
    flex: 1;
    min-width: 0;
}
.mobile-drawer .md-name .md-sub {
    display: block;
    font-style: normal;
    font-family: var(--font-body);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(243, 237, 226, 0.65);
    margin-top: 4px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mobile-drawer .md-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--cream-100);
    border-radius: var(--radius-sm);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
}
.mobile-drawer .md-close:hover { background: rgba(255, 255, 255, 0.08); }

.mobile-drawer .md-section {
    padding: 0.65rem 0 0.4rem;
}
.mobile-drawer .md-label {
    padding: 0 1rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(243, 237, 226, 0.55);
}
.mobile-drawer .md-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    color: var(--cream-100);
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    text-decoration: none;
    min-height: 44px;
}
.mobile-drawer .md-link:hover {
    background: rgba(255, 255, 255, 0.04);
}
.mobile-drawer .md-link.active {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--clay-500);
    color: white;
    font-weight: 600;
}
.mobile-drawer .md-link .md-ico {
    display: inline-block;
    width: 22px;
    margin-right: 10px;
    text-align: center;
    opacity: 0.85;
    font-size: 0.95rem;
}

.mobile-drawer .md-foot {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.4rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.mobile-drawer .md-foot .md-link {
    border-left: none;
    padding-left: 1rem;
}
.mobile-drawer .md-logout {
    padding: 0.7rem 1rem;
    color: var(--clay-300);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    margin-top: 0.25rem;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.mobile-drawer .md-logout:hover { background: rgba(216, 90, 48, 0.15); color: white; }

/* Mostra hamburger + nascondi nav-desktop sotto 900px */
@media (max-width: 900px) {
    .topbar { padding: 0.7rem 1rem; gap: 0.7rem; }
    .topbar-hamburger { display: flex; }
    .topbar-nav-desktop { display: none !important; }
    .topbar-user-mobile { display: inline-block; }
    .topbar .brand {
        font-size: 1.2rem;
        flex: 1;
        justify-content: center;
        margin: 0;
    }
    .topbar .brand-logo { width: 28px; height: 28px; }
    /* L'editing-indicator sotto 900px: chip compatto sotto la barra (gestito da regola sua) */
    .topbar .editing-indicator { display: none; }
}
@media (min-width: 901px) {
    .mobile-drawer, .mobile-drawer-backdrop, .topbar-hamburger, .topbar-user-mobile { display: none !important; }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
    width: 100%;
    flex: 1;
}

.container.narrow { max-width: 720px; }

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ---- Cards ---- */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1.25rem; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 { margin: 0; }

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* 🆕 Su mobile: titolo sopra, bottoni in stack verticale full-width */
@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    .page-header h1 { font-size: 1.5rem; }
    .page-header > div:last-child {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem !important;
    }
    .page-header > div:last-child .btn { width: 100%; justify-content: center; }
}

/* ---- Forms ---- */
.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 640px) {
    .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    /* 🆕 Permette lo shrink corretto dentro grid layout (evita overflow su schermi piccoli) */
    min-width: 0;
}

.field label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--green-800);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="time"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.7rem 0.85rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: all 0.15s;
    width: 100%;
    /* 🆕 Touch-friendly: 44px = iOS standard, evita zoom automatico al focus */
    min-height: 44px;
    box-sizing: border-box;
}
/* 🆕 iOS evita zoom al focus se font-size >= 16px */
@media (max-width: 640px) {
    .field input[type="text"],
    .field input[type="password"],
    .field input[type="email"],
    .field input[type="time"],
    .field input[type="date"],
    .field input[type="number"],
    .field select,
    .field textarea {
        font-size: 16px;
        padding: 0.8rem 0.9rem;
    }
    /* 🆕 Time/date hanno un widget interno nativo che richiede meno padding orizzontale.
       Senza questo, su iPhone in portrait il valore "00:00" + icona orologio
       escono fuori dal bordo del campo quando i due input sono affiancati. */
    .field input[type="time"],
    .field input[type="date"] {
        padding-left: 0.55rem;
        padding-right: 0.4rem;
    }
}
/* 🆕 Schermi molto piccoli (iPhone SE 1ª gen 320px, vecchi Android) */
@media (max-width: 380px) {
    .field input[type="time"],
    .field input[type="date"] {
        padding-left: 0.4rem;
        padding-right: 0.3rem;
        font-size: 15px;
    }
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(45, 74, 62, 0.12);
}

.field textarea { resize: vertical; min-height: 80px; }

.field .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1;
    /* 🆕 Touch-friendly minimum */
    min-height: 44px;
    box-sizing: border-box;
}

.btn-primary {
    background: var(--green-700);
    color: white;
}
.btn-primary:hover { background: var(--green-800); color: white; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-accent {
    background: var(--clay-500);
    color: white;
}
.btn-accent:hover { background: #b85f47; color: white; transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--green-700);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--green-50); border-color: var(--green-300); }

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

.btn-block { width: 100%; }

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.92rem;
    border-left: 3px solid;
}
.alert-success { background: var(--green-50); color: var(--green-800); border-color: var(--green-700); }
.alert-error   { background: #fbeae6; color: #8a2d18; border-color: var(--clay-500); }
.alert-info    { background: var(--cream-200); color: var(--green-800); border-color: var(--gold-500); }

/* ---- Login ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(at 20% 30%, rgba(139, 157, 131, 0.18) 0%, transparent 55%),
        radial-gradient(at 80% 70%, rgba(200, 112, 86, 0.12) 0%, transparent 55%),
        var(--cream-100);
}

.login-card {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-brand .login-logo {
    width: 80px;
    height: auto;
    margin: 0 auto 0.85rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(45, 74, 62, 0.15));
}

.login-brand .logo {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--green-800);
    line-height: 1;
}

.login-brand .leaf-icon {
    display: inline-block;
    font-size: 1.6rem;
    color: var(--green-600);
    transform: rotate(-15deg);
}

.login-brand .tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Calendar / Month grid ---- */
.month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.month-nav h2 {
    font-style: italic;
    font-weight: 500;
    text-transform: capitalize;
}

.month-nav .nav-btns {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 1.5rem;
}

.month-grid .dow {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
}

.day-cell {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.day-cell:hover {
    border-color: var(--green-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.day-cell.empty {
    visibility: hidden;
    pointer-events: none;
}

.day-cell.weekend {
    background: var(--cream-200);
}

.day-cell.today {
    border: 2px solid var(--clay-500);
}

.day-cell.has-data {
    background: var(--green-50);
    border-color: var(--green-300);
}

.day-cell.assenza {
    background: var(--cream-300);
    border-color: var(--gold-500);
    border-left-width: 3px;
}

.day-cell .day-num {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--green-800);
}

.day-cell .day-hours {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--green-700);
    margin-top: auto;
}

.day-cell .day-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: auto;
    font-style: italic;
}

.day-cell .day-cantiere {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    /* 🆕 Calendario compatto: celle quadrate, solo numero + 1 indicatore */
    .month-grid { gap: 3px; }
    .month-grid .dow { font-size: 0.62rem; padding: 0.25rem 0; }

    .day-cell {
        padding: 2px;
        min-height: 0;
        aspect-ratio: 1 / 1.05;
        align-items: center;
        justify-content: center;
        text-align: center;
        border-radius: 5px;
        gap: 1px;
    }
    .day-cell .day-num { font-size: 0.85rem; line-height: 1; }
    .day-cell .lock-icon { font-size: 0.55rem; }

    /* Nasconde gli elementi pesanti, mostra solo 1 indicatore */
    .day-cell .day-cantiere,
    .day-cell .pausa-toggle-btn,
    .day-cell .pausa-marker,
    .day-cell .day-tag-text { display: none; }

    .day-cell .day-tag-abbr { display: inline; }

    .day-cell .day-hours {
        font-size: 0.65rem;
        font-weight: 700;
        line-height: 1;
        margin-top: 1px;
    }
    .day-cell .day-tag {
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1;
        margin-top: 1px;
        text-transform: uppercase;
        color: var(--gold-700, #8c6f1e);
    }
}

/* Default: mostra testo completo, nascondi abbreviazione */
.day-cell .day-tag-abbr { display: none; }

/* 🆕 Legenda calendario (visibile solo su mobile) */
.calendar-legend {
    display: none;
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.calendar-legend strong { color: var(--green-800); }
.calendar-legend .leg-item { white-space: nowrap; margin-right: 0.5rem; }
@media (max-width: 640px) {
    .calendar-legend { display: block; }
}

/* ---- Stats / Summary ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.stat-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-card .value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--green-800);
    margin-top: 0.25rem;
    line-height: 1.1;
}

.stat-card.accent .value { color: var(--clay-500); }

/* ---- Section divider in form ---- */
.form-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border);
}

.form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

.form-section h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    color: var(--green-700);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h3::before {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--clay-500);
    display: inline-block;
}

/* ---- Form actions ---- */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* 🆕 Su mobile, le form-actions del form principale diventano sticky in basso */
@media (max-width: 640px) {
    .card .form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        margin-left: -1.1rem;
        margin-right: -1.1rem;
        margin-bottom: -1.1rem;
        padding: 0.85rem 1.1rem;
        border-top: 1px solid var(--border);
        box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.05);
        z-index: 5;
    }
    .card .form-actions .btn { flex: 1; min-width: 0; }
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    margin: 0 -0.25rem;
    -webkit-overflow-scrolling: touch;
}

/* 🆕 Mobile: usa tutto lo spazio disponibile + indicatore scroll */
@media (max-width: 640px) {
    .table-wrap {
        margin: 0 -1rem;
        padding: 0 1rem;
        position: relative;
    }
    .table-wrap::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 24px;
        background: linear-gradient(90deg, transparent, rgba(250, 247, 242, 0.95));
        pointer-events: none;
        opacity: 0.7;
    }
    /* Forza la tabella a mostrare le colonne reali, non comprimerle */
    .table-wrap .data-table { min-width: 540px; }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--green-800);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table thead th.num { text-align: right; }
.data-table thead th.actions-col { text-align: right; width: 1%; white-space: nowrap; }

.data-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody td.actions-col { text-align: right; white-space: nowrap; }

.data-table tbody tr:hover { background: var(--cream-200); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr.row-inactive { opacity: 0.55; }

.data-table code {
    background: var(--cream-200);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---- Info table (chiave/valore) ---- */
.info-table {
    width: 100%;
    border-collapse: collapse;
}
.info-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child {
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 40%;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid var(--green-100);
}
.badge-success { background: var(--green-50); color: var(--green-800); border-color: var(--green-300); }
.badge-accent  { background: var(--clay-100); color: #8a2d18; border-color: var(--clay-400); }
.badge-info    { background: var(--cream-200); color: var(--gold-500); border-color: var(--cream-300); }
.badge-muted   { background: #f0f0eb; color: var(--text-muted); border-color: var(--border); }

/* ---- Rapporto entries (sezione separata) ---- */
.rapporto-section {
    border-top: 2px solid var(--clay-500) !important;
    padding-top: 1.25rem !important;
}

.rapporto-section h3.rapporto-h {
    color: var(--clay-500);
}
.rapporto-section h3.rapporto-h::before {
    background: var(--clay-500);
}

.rapporto-entry {
    background: var(--cream-100);
    border: 1px dashed var(--clay-500);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.75rem;
    position: relative;
}

/* Layout 3 colonne per cantiere | luogo | ore */
.rapp-fields {
    display: grid;
    grid-template-columns: 2fr 1.5fr 90px;
    gap: 0.75rem;
}
@media (max-width: 640px) {
    .rapp-fields { grid-template-columns: 1fr; }
}

.rapporto-num {
    position: absolute;
    top: -10px;
    left: 14px;
    background: var(--clay-500);
    color: white;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
}

.rapporto-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.rapporto-remove:hover { color: var(--clay-500); background: rgba(200, 112, 86, 0.1); }

.btn-add-rapporto {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 0.7rem;
    margin-top: 0.75rem;
    background: transparent;
    border: 1.5px dashed var(--green-300);
    border-radius: var(--radius-md);
    color: var(--green-700);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.btn-add-rapporto:hover {
    border-color: var(--clay-500);
    color: var(--clay-500);
    background: var(--cream-100);
}

/* ---- Balance card (confronto ore lavorate vs rapportate) ---- */
.balance-card {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.88rem;
    line-height: 1.5;
    border-left: 3px solid;
}
.balance-card.balance-warning {
    background: #fef3ec;
    border-color: var(--clay-500);
    color: #6b3520;
}
.balance-card.balance-warning strong { color: #993c1d; }
.balance-card.balance-ok {
    background: var(--green-50);
    border-color: var(--green-500);
    color: var(--green-800);
}
.balance-card.balance-ok strong { color: var(--green-900); }
.balance-card .bc-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.balance-card .bc-content {
    flex: 1;
    min-width: 0;
}
.balance-card .bc-title { margin-bottom: 0.4rem; }
.balance-card .bc-numbers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
}
.balance-card .bc-label {
    color: var(--text-muted);
    font-weight: 500;
}
.balance-card .bc-pill {
    background: white;
    padding: 2px 9px;
    border-radius: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text);
}
.balance-card .bc-pill.bc-diff-warning {
    background: var(--clay-500);
    color: white;
    border-color: var(--clay-500);
}
.balance-card .bc-pill.bc-diff-ok {
    background: var(--green-500);
    color: white;
    border-color: var(--green-500);
}

/* ---- Form bloccato (modifica non consentita) ---- */
.form-locked fieldset {
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
}
.form-locked fieldset input,
.form-locked fieldset select,
.form-locked fieldset textarea,
.form-locked fieldset button {
    background: var(--cream-100) !important;
    cursor: not-allowed !important;
}

/* ---- Internal note alert ---- */
.alert-internal {
    background: #fef9e7;
    border-left: 3px solid var(--gold-500);
    padding: 0.6rem 0.9rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.alert-internal strong { color: #8c6f1e; }

/* ---- Pause pranzo toggle (dashboard) ---- */
.pausa-toggle-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
    z-index: 2;
}
.pausa-toggle-btn .ico { font-size: 12px; opacity: 0.4; filter: grayscale(1); transition: all 0.15s; }
.pausa-toggle-btn:hover { border-color: var(--clay-500); transform: scale(1.1); }
.pausa-toggle-btn:hover .ico { opacity: 0.8; }
.pausa-toggle-btn.active { background: var(--clay-500); border-color: var(--clay-500); }
.pausa-toggle-btn.active .ico { opacity: 1; filter: none; }
.pausa-toggle-btn.loading { opacity: 0.5; pointer-events: none; }
.pausa-toggle-btn:disabled { cursor: wait; }

.pausa-marker {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--clay-500);
    color: white;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* ========================================================== */
/* MODIFICA ORE ADMIN - Quick Action Card + 4 Editing Indicators */
/* ========================================================== */

/* ---- Quick Action Card (admin/modifica_ore.php) ---- */
.quick-action-card {
    background: white;
    border: 2px solid var(--clay-500);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem 1rem;
    margin-bottom: 1.25rem;
    position: relative;
    box-shadow: 0 4px 16px rgba(200, 112, 86, 0.1);
}

.quick-action-card .qa-title {
    position: absolute;
    top: -11px;
    left: 20px;
    background: var(--clay-500);
    color: white;
    font-size: 0.72rem;
    padding: 4px 14px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.qa-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

@media (max-width: 768px) {
    .qa-grid { grid-template-columns: 1fr 1fr; }
    .qa-action-field { grid-column: span 2; }
}
@media (max-width: 480px) {
    .qa-grid { grid-template-columns: 1fr; }
    .qa-action-field { grid-column: 1; }
}

.qa-jumps {
    display: flex;
    gap: 0.3rem;
}
.qa-jumps .btn { padding: 0.55rem 0.7rem; font-size: 0.8rem; }

.btn-action-big {
    height: 42px;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Status indicator under quick action */
.qa-status {
    margin-top: 0.85rem;
    padding: 0.6rem 0.9rem;
    background: var(--green-50);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--green-800);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    line-height: 1.4;
}
.qa-status.qa-status-empty {
    background: #fef5f1;
    color: #993c1d;
}
.qa-status.qa-status-assenza {
    background: var(--cream-200);
    color: #8c6f1e;
}
.qa-status .dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.qa-status .dot.dot-lavoro { background: var(--green-500); }
.qa-status .dot.dot-empty { background: var(--clay-500); }
.qa-status .dot.dot-assenza { background: var(--gold-500); }

/* ========================================================== */
/* 4 INDICATORI per "modalità modifica admin" in inserisci_ore.php */
/* ========================================================== */

/* (1) Topbar in modalità editing - bordo terracota */
.topbar-editing {
    border-bottom: 3px solid var(--clay-500) !important;
    box-shadow: 0 2px 8px rgba(200, 112, 86, 0.2);
}

/* Chip animato nel topbar */
.editing-indicator {
    background: rgba(200, 112, 86, 0.25);
    border: 1px solid var(--clay-500);
    color: #ffd9c8;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 1rem;
    flex-shrink: 0;
}
.editing-indicator strong {
    color: white;
    font-weight: 700;
}
.editing-indicator .ei-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff8c66;
    animation: ei-pulse 1.5s infinite;
    flex-shrink: 0;
}
@keyframes ei-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(1.4); }
}

/* Su mobile mostra solo l'icona del chip */
@media (max-width: 640px) {
    .editing-indicator { padding: 4px 8px; }
    .editing-indicator .ei-text strong { display: none; }
    .editing-indicator .ei-text {
        font-size: 0.7rem;
    }
}

/* (2) Page header con avatar */
.page-header-editing {
    margin-bottom: 1rem;
    align-items: flex-start;
}
.page-header-editing .ph-left {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex: 1;
}

/* Avatar circolare con iniziali */
.employee-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clay-500) 0%, #b85f47 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(200, 112, 86, 0.3);
    border: 3px solid white;
    letter-spacing: 0.02em;
}

.page-header-editing h1 {
    margin: 0;
    line-height: 1.1;
}
.page-header-editing h1 .modificando-eyebrow {
    display: block;
    color: var(--clay-500);
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    line-height: 1;
}

/* (3) Banner di modifica admin - rinforzato */
.banner-admin-editing {
    background: linear-gradient(to right, #fef3ec, #fff8f3);
    border-left: 4px solid var(--clay-500);
    border-right: 1px solid #f0d4c4;
    border-top: 1px solid #f0d4c4;
    border-bottom: 1px solid #f0d4c4;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.25rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
}
.banner-admin-editing .ba-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.banner-admin-editing .ba-text {
    flex: 1;
    font-size: 0.88rem;
    color: #6b3520;
    line-height: 1.5;
}
.banner-admin-editing .ba-text strong {
    color: #993c1d;
    font-weight: 700;
}
.banner-admin-editing .ba-name-pill {
    background: var(--clay-500);
    color: white;
    padding: 2px 10px;
    border-radius: 5px;
    font-weight: 700;
    margin: 0 3px;
    display: inline-block;
}

/* (4) Form con bordo accent quando in modalità editing */
.card-editing {
    border-color: #f0d4c4;
    box-shadow: 0 0 0 1px #fef3ec, 0 4px 14px rgba(200, 112, 86, 0.08);
}

/* Mobile adjustments per page-header editing */
@media (max-width: 640px) {
    .page-header-editing { flex-direction: column; }
    .page-header-editing .ph-left { width: 100%; }
    .employee-avatar { width: 48px; height: 48px; font-size: 1.05rem; }
    .page-header-editing h1 { font-size: 1.4rem; }
    .banner-admin-editing { padding: 0.7rem 0.85rem; gap: 0.6rem; }
    .banner-admin-editing .ba-icon { font-size: 1.3rem; }
    .banner-admin-editing .ba-text { font-size: 0.8rem; }
}

/* ========================================================== */
/* Existing modifica-ore-table styles continue below          */
/* ========================================================== */

/* ---- Modifica ore (admin overview giornaliero) ---- */
.modifica-ore-table th.center, .modifica-ore-table td.center { text-align: center; }
.modifica-ore-table tbody tr.row-empty td { background: #fef5f1; }
.modifica-ore-table tbody tr.row-empty:hover td { background: #fbeae6; }
.modifica-ore-table tbody tr.row-assenza td { background: #faf7f2; }
.modifica-ore-table .num-time {
    font-variant-numeric: tabular-nums;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--green-800);
}
.modifica-ore-table .luogo-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}
.status-dot.status-green { background: var(--green-500); }
.status-dot.status-orange { background: var(--clay-500); }
.status-dot.status-gray { background: #ccc; }

/* Rapporto info chip */
.rapp-info {
    font-size: 0.85rem;
    color: var(--green-800);
}
.rapp-info strong { color: var(--clay-500); }
.rapp-info .rapp-ore {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Pausa badge YES/NO */
.pausa-badge-yes {
    display: inline-block;
    background: var(--clay-500);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Active day quick-jump button */
.btn.active-day {
    background: var(--green-50);
    border-color: var(--green-300);
    color: var(--green-800);
    font-weight: 700;
}

/* ---- Assenze table (admin) ---- */
.data-table-assenze .motiv-th {
    background: var(--gold-500);
    color: white;
    text-align: left;
}
.data-table-assenze .motiv-th .th-small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    opacity: 0.85;
    text-transform: none;
    margin-top: 1px;
    letter-spacing: 0;
}
.data-table-assenze tr.row-weekend td { background: var(--cream-200); color: var(--text-muted); }
.data-table-assenze tr.row-assenza td { background: #fef9e7; }
.data-table-assenze tr.row-lavoro td { background: var(--cream-100); }

.motiv-select {
    padding: 0.4rem 0.55rem;
    border: 1.5px solid var(--gold-500);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: white;
    color: var(--text);
    width: 100%;
    max-width: 200px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}
.motiv-select.has-value {
    background: #fef9e7;
    color: #8c6f1e;
    font-weight: 600;
}
.motiv-select.empty {
    color: #aaa;
    background: white;
    border-color: var(--border);
    border-style: dashed;
    font-weight: 500;
}
.motiv-select:focus {
    outline: none;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(184, 149, 84, 0.15);
}

.motiv-locked-msg {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

/* === Triple protezione "lavoro → assenza" === */

/* Riga in stato "pending" (admin sta sostituendo il lavoro con un'assenza) */
.data-table-assenze tr.lavoro-pending td {
    background: #fef3ec !important;
    border-left: 3px solid var(--clay-500) !important;
    transition: background 0.2s;
}

/* Dropdown precaricato su "Lavoro" (verde, neutro) */
.motiv-select.lavoro-default {
    background: var(--green-50);
    border-color: var(--green-700);
    color: var(--green-800);
    font-weight: 500;
}

/* Dropdown quando admin lo cambia (terracotta acceso) */
.motiv-select.lavoro-changing {
    background: #fef3ec !important;
    border-color: var(--clay-500) !important;
    color: #993c1d !important;
    font-weight: 700 !important;
}

/* Ore con linea barrata quando si sta sostituendo */
.lavoro-ore.lavoro-ore-strike {
    text-decoration: line-through !important;
    opacity: 0.55;
    color: var(--text-muted) !important;
}

/* Chip di avviso accanto al dropdown */
.lavoro-warn-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fef3ec;
    border: 1px solid var(--clay-500);
    color: #993c1d;
    padding: 3px 9px;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 0.5rem;
    animation: chip-pulse 1.6s infinite;
    vertical-align: middle;
}
@keyframes chip-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Card di conferma globale sopra il bottone salva */
.overwrite-warning-card {
    background: #fbeae6;
    border: 2px solid var(--clay-500);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
    font-size: 0.9rem;
    color: #6b3520;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(200, 112, 86, 0.15);
}
.overwrite-warning-card .ow-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.overwrite-warning-card .ow-content { flex: 1; }
.overwrite-warning-card strong { color: #993c1d; font-weight: 700; }

.badge-assenza {
    background: #fef9e7;
    color: #8c6f1e;
    border: 1px solid var(--gold-500);
}

/* ---- Cerca rapporti (admin) ---- */
.cerca-filtri-card {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
}

/* Tabs per tipo data (mese / rango / giorno) */
.tipo-data-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px dashed var(--border);
    flex-wrap: wrap;
}
.tipo-data-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    background: white;
    transition: all 0.15s;
}
.tipo-data-tab:hover {
    border-color: var(--green-300);
    color: var(--green-800);
}
.tipo-data-tab.active {
    background: var(--green-50);
    border-color: var(--green-700);
    color: var(--green-800);
}
.tipo-data-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Grid per i campi di filtro */
.cerca-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0.85rem;
    align-items: end;
}
@media (max-width: 900px) {
    .cerca-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .cerca-grid { grid-template-columns: 1fr; }
    .cerca-grid .field[style*="span 2"] { grid-column: auto !important; }
    .cerca-grid .cerca-actions .btn,
    .cerca-grid .cerca-actions a.btn { flex: 1; }
    .cerca-grid .cerca-actions > div { width: 100%; }
}

.cerca-actions {
    align-self: end;
}

/* Pillole filtri attivi */
.cerca-filtri-attivi {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border);
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.78rem;
}
.cerca-filtri-attivi strong {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.3rem;
}
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--green-50);
    color: var(--green-800);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--green-300);
}

/* Tabella risultati - righe cliccabili */
.cerca-results-header {
    padding: 1rem 1.25rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cerca-results-header h2 {
    margin: 0 0 0.2rem 0;
}

.btn-clay {
    background: var(--clay-500);
    color: white;
    border-color: var(--clay-500);
}
.btn-clay:hover {
    background: var(--clay-400);
    border-color: var(--clay-400);
    color: white;
}
.btn-stampa-cerca {
    flex-shrink: 0;
    font-weight: 700;
}

.cerca-results-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
.cerca-results-table tbody tr:hover td {
    background: var(--cream-100);
}
.cerca-results-table .data-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cerca-results-table .desc-cell {
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.45;
    max-width: 280px;
}

/* 🆕 Banda bilancio per giornata (inserita prima delle voci di un giorno) */
.cerca-results-table tr.day-balance-row {
    cursor: default;
}
.cerca-results-table tr.day-balance-row:hover td {
    background: inherit;
}
.cerca-results-table tr.day-balance-row td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
}
.cerca-results-table tr.day-balance-short td {
    background: #fef3ec;
    border-left: 3px solid var(--clay-500);
}
.cerca-results-table tr.day-balance-over td {
    background: #fef3ec;
    border-left: 3px solid var(--clay-500);
}
.cerca-results-table tr.day-balance-ok td {
    background: var(--green-50);
    border-left: 3px solid var(--green-500);
}

.bal-inline {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
}
.bal-label-day {
    font-weight: 700;
    color: var(--green-800);
}
.bal-label-day .bal-dipname {
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.bal-pill {
    padding: 2px 9px;
    border-radius: 11px;
    font-weight: 700;
    font-size: 0.74rem;
    color: white;
    white-space: nowrap;
}
.bal-pill-warn { background: var(--clay-500); }
.bal-pill-ok { background: var(--green-500); }

.bal-msg {
    color: #6b3520;
    font-size: 0.78rem;
    font-style: italic;
}
.day-balance-ok .bal-msg { color: var(--green-800); }
.bal-msg strong { font-style: normal; font-weight: 700; }

/* Voci con bordo sinistro sottile coerente con bilancio */
.cerca-results-table tr.voce-short td:first-child { border-left: 3px solid #f0d3c5; }
.cerca-results-table tr.voce-over td:first-child  { border-left: 3px solid #f0d3c5; }
.cerca-results-table tr.voce-ok td:first-child    { border-left: 3px solid #c0dd97; }

/* === I miei rapporti (dipendente) === */
.miei-rapporti-table tr.editable-row {
    cursor: pointer;
    transition: background 0.12s;
}
.miei-rapporti-table tr.editable-row:hover td {
    background: var(--green-50);
}
.miei-rapporti-table tr.editable-row td:first-child {
    border-left: 3px solid var(--green-500);
}
.miei-rapporti-table tr.locked-row td {
    background: #faf7f2;
    opacity: 0.85;
}
.miei-rapporti-table tr.locked-row td:first-child {
    border-left: 3px solid var(--cream-300);
}

.edit-badge {
    display: inline-block;
    margin-top: 4px;
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid var(--green-300);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lock-badge {
    display: inline-block;
    margin-top: 4px;
    background: #fef9e7;
    color: #8c6f1e;
    border: 1px solid #d8c87a;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* === Log accessi (admin) === */
.stat-card.stat-card-danger .value { color: var(--clay-700, #993c1d); }

.accessi-filters .cerca-grid {
    grid-template-columns: 1.2fr 1.2fr 1fr 1fr auto;
}
@media (max-width: 900px) {
    .accessi-filters .cerca-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .accessi-filters .cerca-grid { grid-template-columns: 1fr; }
}

/* Tabella accessi */
.accessi-table {
    font-size: 0.85rem;
}
.accessi-table .when-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 110px;
}
.accessi-table .ip-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    color: var(--text);
    white-space: nowrap;
}
.accessi-table .dev-cell {
    font-size: 0.8rem;
    white-space: nowrap;
}
.accessi-table .dev-cell .dev-icon { margin-right: 4px; }
.accessi-table .dev-cell .dev-browser {
    font-weight: 600;
    color: var(--green-800);
}
.accessi-table .dev-cell .dev-os {
    color: var(--text-muted);
    margin-left: 4px;
}
.accessi-table .pagina-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.accessi-table tr.row-fail td { background: #fbeae6; }
.accessi-table tr.row-fail:hover td { background: #f9dfd6; }
.accessi-table tr.row-logout td { background: #faf7f2; opacity: 0.85; }

/* User cell con avatar */
.user-cell-acc {
    display: flex;
    align-items: center;
    gap: 8px;
}
.acc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.acc-avatar-admin { background: var(--clay-500); }
.acc-avatar-dip { background: var(--green-700); }
.acc-avatar-unknown { background: var(--text-muted); color: white; opacity: 0.6; }

.user-info-acc .name {
    font-weight: 600;
    color: var(--green-800);
    font-size: 0.85rem;
    line-height: 1.2;
}
.user-info-acc .name-unknown { color: var(--clay-700, #993c1d); font-style: italic; }
.user-info-acc .name-unknown em { font-style: normal; color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }
.user-info-acc .role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-top: 2px;
}
.user-info-acc .role-fail { color: var(--clay-500); }

/* Pillole evento */
.evt-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border: 1px solid;
}
.evt-pill-login-ok {
    background: var(--green-50);
    color: var(--green-800);
    border-color: var(--green-300, #97c5a8);
}
.evt-pill-login-fail-user, .evt-pill-login-fail-pass {
    background: #fbeae6;
    color: #993c1d;
    border-color: #f0a48a;
}
.evt-pill-logout {
    background: var(--cream-100);
    color: var(--text-muted);
    border-color: var(--cream-300);
}

/* Cleanup bar */
.cleanup-bar {
    background: #fef9e7;
    border: 1px solid var(--gold-500);
    border-left: 3px solid var(--gold-500);
    border-radius: 6px;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    color: #6b5a14;
    font-size: 0.85rem;
    line-height: 1.5;
}
.cleanup-bar .cb-icon { font-size: 1.4rem; }
.cleanup-bar .cb-text { flex: 1; min-width: 200px; }
.cleanup-bar .cb-text strong { color: #6b5a14; }
.cleanup-bar .btn { flex-shrink: 0; }

/* === Pulisci orfani (admin) === */
.alert-warning {
    background: #fef9e7;
    color: #8c6f1e;
    border: 1px solid var(--gold-500);
    border-left: 3px solid var(--gold-500);
}
.alert-warning strong { color: #6b5a14; }

.orfani-explain {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 0.85rem 1.1rem;
    line-height: 1.55;
    font-size: 0.88rem;
}
.orfani-explain-icon {
    font-size: 1.7rem;
    flex-shrink: 0;
    line-height: 1;
}

.orfani-table {
    font-size: 0.85rem;
}
.orfani-table .data-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.orfani-table .desc-cell { color: var(--text); line-height: 1.4; max-width: 240px; }
.orfani-table .motivo-cell {
    color: #8c6f1e;
    font-size: 0.78rem;
    font-style: italic;
    background: #fef9e7;
    border-left: 2px solid var(--gold-500);
}
.orfani-table-done .motivo-cell {
    background: var(--green-50);
    color: var(--green-800);
    border-left-color: var(--green-500);
}

/* ---- Pause pranzo table (admin) ---- */
.data-table-pause .pausa-th { background: var(--clay-500); color: white; text-align: center; }
.data-table-pause .center { text-align: center; }
.data-table-pause tr.row-weekend td { background: var(--cream-200); color: var(--text-muted); }
.data-table-pause tr.row-assenza td { background: var(--cream-100); }

.pausa-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 28px;
    height: 28px;
}
.pausa-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.pausa-toggle .pausa-mark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--green-300);
    border-radius: 5px;
    background: white;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.pausa-toggle:hover .pausa-mark {
    border-color: var(--clay-500);
}
.pausa-toggle input:checked + .pausa-mark {
    background: var(--clay-500);
    border-color: var(--clay-500);
}
.pausa-toggle input:checked + .pausa-mark::after {
    content: '✓';
    color: white;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
}

/* ---- Btn danger (per future estensioni) ---- */
.btn-danger {
    background: var(--red-500);
    color: white;
}
.btn-danger:hover { background: #903838; color: white; }

/* ---- Bar chart (statistiche) ---- */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 200px 1fr 110px;
    gap: 1rem;
    align-items: center;
    font-size: 0.88rem;
}

.bar-label {
    font-weight: 600;
    color: var(--green-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    position: relative;
    background: var(--cream-200);
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--green-500);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.bar-fill-accent { background: var(--clay-500); }

.bar-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--green-900);
    font-size: 0.85rem;
    z-index: 1;
}

.bar-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .bar-row { grid-template-columns: 110px 1fr 70px; gap: 0.5rem; font-size: 0.8rem; }
    .bar-track { height: 24px; }
    .bar-value { font-size: 0.75rem; right: 6px; }
}

/* ---- Day cell sola lettura (admin che vede altri) ---- */
.day-cell.no-click {
    cursor: default;
}
.day-cell.no-click:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

/* ---- Day cell bloccata per il dipendente (giorni non modificabili) ---- */
.day-cell.locked {
    cursor: not-allowed;
    opacity: 0.7;
    background: #fafaf6;
}
.day-cell.locked:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}
.day-cell.locked .lock-icon {
    font-size: 0.65rem;
    opacity: 0.5;
    margin-left: 2px;
    vertical-align: text-top;
}
.day-cell.locked.has-data {
    background: #f0f4ee;
}
.day-cell.locked.assenza {
    background: var(--cream-200);
}

/* ---- Mobile globali (sotto 640px) ---- */
@media (max-width: 640px) {
    .container { padding: 1rem 0.85rem; }
    .card { padding: 1.1rem; }
    .form-actions .btn { flex: 1; }
    .data-table { font-size: 0.82rem; }
    .data-table thead th, .data-table tbody td { padding: 0.5rem 0.5rem; }
    .data-table tbody td.actions-col .btn { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
}

/* === Ricevute spese === */
.stat-card.stat-card-warning .value { color: var(--gold-500, #b89554); }

/* Upload zone */
.upload-zone {
    position: relative;
    border: 2px dashed var(--clay-500);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    background: #fef6f3;
    transition: background 0.15s;
    cursor: pointer;
}
.upload-zone:hover { background: #fceee8; }
.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}
.upload-zone .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.upload-zone .upload-title {
    font-weight: 600;
    color: var(--clay-700, #993c1d);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.upload-zone .upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Lista ricevute (dipendente) */
.ricevute-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ricevuta-card {
    display: flex;
    gap: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-500);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.85rem;
    align-items: stretch;
    transition: border-color 0.15s;
}
.ricevuta-card:hover { border-color: var(--text-muted); }
.ricevuta-card.ricevuta-pagata { border-left-color: var(--green-500); opacity: 0.95; }

.ricevuta-thumb {
    width: 56px;
    height: 70px;
    flex-shrink: 0;
    background: var(--cream-200);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
}
.ricevuta-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ricevuta-thumb .thumb-pdf {
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}
.ricevuta-thumb .thumb-pdf small { font-size: 0.6rem; display: block; }

.ricevuta-body { flex: 1; min-width: 0; }
.ricevuta-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 2px;
}
.ricevuta-title {
    font-weight: 500;
    color: var(--green-800);
    font-size: 0.95rem;
}
.ricevuta-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.ricevuta-paid-info {
    font-size: 0.78rem;
    color: var(--green-500);
    margin-top: 4px;
    font-weight: 600;
}

/* Stato pillole */
.stato-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border: 1px solid;
}
.stato-pill.stato-in_attesa {
    background: #fef9e7;
    color: #6b5a14;
    border-color: var(--gold-500, #b89554);
}
.stato-pill.stato-pagata {
    background: var(--green-50, #ecf1ea);
    color: var(--green-800, #233d31);
    border-color: var(--green-300, #97c5a8);
}

/* === Admin ricevute lista === */
.ricevute-admin-list {
    display: flex;
    flex-direction: column;
}
.ricevuta-admin-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.ricevuta-admin-row:last-child { border-bottom: none; }
.ricevuta-admin-row:hover { background: #faf7f2; }
.ricevuta-admin-row.ricevuta-pagata { background: #fafbfa; opacity: 0.92; }

.ricevuta-admin-row .ricevuta-thumb {
    width: 70px;
    height: 88px;
}
.ricevuta-info { min-width: 0; }
.ricevuta-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 4px;
}
.ricevuta-info .info-row:last-of-type { margin-bottom: 0; }
.dipendente-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--green-800);
    font-size: 0.9rem;
}
.user-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.user-dot-admin { background: var(--clay-500); }
.user-dot-dipendente { background: var(--green-700); }

.ricevuta-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--cream-100);
    border-radius: 3px;
    border-left: 2px solid var(--cream-300);
}

.ricevuta-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
.form-inline-paga {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--green-50, #ecf1ea);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--green-300, #97c5a8);
}
.paga-data-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.paga-data-label input[type="date"] {
    border: 1px solid var(--border);
    padding: 3px 5px;
    font-size: 0.8rem;
    border-radius: 3px;
    background: white;
    width: auto;
}

.btn-success {
    background: var(--green-500, #639922);
    color: white;
    border-color: var(--green-500, #639922);
}
.btn-success:hover {
    background: #4f7d1a;
}

/* Filtri ricevute */
.ricevute-filters .cerca-grid {
    grid-template-columns: 1fr 1.2fr 1fr 1fr auto;
}
@media (max-width: 900px) {
    .ricevute-filters .cerca-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .ricevute-filters .cerca-grid { grid-template-columns: 1fr; }

    .ricevuta-admin-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .ricevuta-admin-row .ricevuta-thumb {
        width: 100%;
        height: 200px;
    }
    .ricevuta-actions {
        align-items: stretch;
    }
    .form-inline-paga {
        flex-direction: column;
        align-items: stretch;
    }
    .form-inline-paga button { width: 100%; }
}

/* === Edit inline descrizione ricevuta (admin) === */
.ricevuta-desc {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.ricevuta-desc .desc-text { flex: 1; }
.ricevuta-desc.desc-empty .desc-text {
    color: var(--text-muted);
    font-style: italic;
}

.desc-edit-btn {
    background: transparent;
    border: 1px solid var(--cream-300);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1.4;
    transition: all 0.15s;
}
.desc-edit-btn:hover {
    background: var(--cream-100);
    color: var(--green-800);
    border-color: var(--green-700);
}
.desc-edit-btn.desc-edit-add {
    color: var(--clay-500);
    border-color: var(--cream-300);
}
.desc-edit-btn.desc-edit-add:hover {
    background: #fef6f3;
    color: var(--clay-700);
    border-color: var(--clay-500);
}

.desc-edit-form {
    margin-top: 4px;
}
.desc-edit-form textarea {
    width: 100%;
    border: 1.5px solid var(--green-700);
    border-radius: 5px;
    padding: 7px 9px;
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 50px;
    background: white;
    color: var(--text);
    box-sizing: border-box;
}
.desc-edit-form textarea:focus {
    outline: none;
    border-color: var(--green-500, #639922);
    box-shadow: 0 0 0 3px rgba(99, 153, 34, 0.15);
}
.desc-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
}

/* === Bollettini di consegna === */

/* Cantiere tag (dentro la lista admin) */
.cantiere-tag {
    display: inline-block;
    background: #f3ede2;
    border: 1px solid #d8d2c2;
    color: var(--green-800);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Pillole stato bollettino */
.stato-pill.stato-bollettino-ricevuto {
    background: #fef9e7;
    color: #6b5a14;
    border-color: var(--gold-500, #b89554);
}
.stato-pill.stato-bollettino-verificato {
    background: #e8f0f5;
    color: #1c3d4d;
    border-color: #5a8aa0;
}
.stato-pill.stato-bollettino-fatturato {
    background: var(--green-50, #ecf1ea);
    color: var(--green-800, #233d31);
    border-color: var(--green-300, #97c5a8);
}

/* Bordo sinistro card dipendente per stato */
.ricevuta-card.bollettino-ricevuto { border-left-color: var(--gold-500); }
.ricevuta-card.bollettino-verificato { border-left-color: #5a8aa0; }
.ricevuta-card.bollettino-fatturato { border-left-color: var(--green-500); }

/* Riga admin per stato */
.ricevuta-admin-row.bollettino-fatturato { background: #fafbfa; opacity: 0.92; }

/* Bottone info (per "Verifica") */
.btn-info {
    background: #5a8aa0;
    color: white;
    border-color: #5a8aa0;
}
.btn-info:hover {
    background: #4a7990;
}


/* === Edit inline importo bollettino === */
.importo-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.imp-edit-btn {
    margin-left: 4px;
}

.imp-edit-form {
    margin-top: 6px;
    background: var(--green-50, #ecf1ea);
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid var(--green-300, #97c5a8);
    max-width: 320px;
}
.imp-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.imp-edit-row input[type="number"] {
    flex: 1;
    min-width: 100px;
    border: 1.5px solid var(--green-700);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    box-sizing: border-box;
}
.imp-edit-row input[type="number"]:focus {
    outline: none;
    border-color: var(--green-500, #639922);
    box-shadow: 0 0 0 3px rgba(99, 153, 34, 0.15);
}

/* ==================== Bilancio ore (commissione paritetica) ==================== */

/* KPI grid */
.bilancio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.bilancio-kpi {
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--green-700);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    /* 🆕 altezze uniformi anche con suffix di lunghezze diverse */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
}
.bilancio-kpi .label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}
.bilancio-kpi .value {
    font-family: var(--font-display, Georgia, serif);
    font-size: 1.85rem;
    font-weight: 500;
    color: var(--green-800);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    /* 🆕 evita overflow di numeri lunghi (es. 17'358) */
    overflow-wrap: anywhere;
}
.bilancio-kpi .suffix {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    line-height: 1.3;
}
.bilancio-kpi-richieste { border-left-color: var(--clay-500); }
.bilancio-kpi-richieste .value { color: var(--clay-700); }
.bilancio-kpi-lavorate { border-left-color: var(--green-500, #639922); }
.bilancio-kpi-lavorate .value { color: var(--green-500, #639922); }
.bilancio-kpi-residue .value { color: var(--gold-500, #b89554); }
.bilancio-kpi-residue { border-left-color: var(--gold-500, #b89554); }
.bilancio-kpi-eccedenza .value { color: var(--green-500, #639922); }
.bilancio-kpi-eccedenza { border-left-color: var(--green-500, #639922); }
.bilancio-kpi-completata { border-left-color: #5a8aa0; }
.bilancio-kpi-completata .value { color: #1c3d4d; }

@media (max-width: 900px) {
    .bilancio-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
    .bilancio-kpi { padding: 0.85rem 0.95rem; min-height: 100px; }
    .bilancio-kpi .value { font-size: 1.6rem; }
}
/* 🆕 Su mobile: layout orizzontale con label/suffix a sinistra e valore grande a destra
   (più compatto e leggibile rispetto al layout verticale) */
@media (max-width: 540px) {
    .bilancio-grid { grid-template-columns: 1fr; gap: 8px; }
    .bilancio-kpi {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: auto;
        padding: 0.7rem 0.9rem;
    }
    .bilancio-kpi-text {
        flex: 1;
        min-width: 0;
    }
    .bilancio-kpi .label {
        margin-bottom: 0;
        font-size: 0.72rem;
    }
    .bilancio-kpi .value {
        font-size: 1.5rem;
        flex-shrink: 0;
        text-align: right;
    }
    .bilancio-kpi .suffix {
        font-size: 0.7rem;
        margin-top: 1px;
    }
}

/* Barra progresso */
.bilancio-bar {
    height: 22px;
    background: var(--green-50, #ecf1ea);
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}
.bilancio-bar-fill {
    height: 100%;
    background: var(--green-500, #639922);
    transition: width 0.3s;
}
.bilancio-bar-fill.bar-start { background: var(--gold-500, #b89554); }
.bilancio-bar-fill.bar-progress { background: linear-gradient(90deg, var(--gold-500, #b89554), var(--green-500, #639922)); }
.bilancio-bar-fill.bar-success { background: var(--green-500, #639922); }

.bilancio-mese-table tr.mese-vuoto td {
    color: var(--text-muted);
    background: #fafafa;
}

/* === Contratti annuali === */
.contratti-list {
    display: flex;
    flex-direction: column;
}
.contratto-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.contratto-row:last-child { border-bottom: none; }
.contratto-row.no-contract { background: #fef9e7; }

.contratto-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.contratto-user-name {
    font-weight: 500;
    color: var(--green-800);
}

.contratto-form { width: 100%; }
.contratto-fields {
    display: grid;
    grid-template-columns: 110px 130px 1fr auto;
    gap: 0.5rem;
    align-items: end;
}
.contratto-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
}
.contratto-field > span:first-child {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.contratto-field input {
    border: 1.5px solid var(--border);
    border-radius: 5px;
    padding: 7px 9px;
    font-size: 0.9rem;
    background: white;
    width: 100%;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
}
.contratto-field input:focus {
    outline: none;
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(45, 74, 62, 0.12);
}
.contratto-field .suffix {
    position: absolute;
    right: 8px;
    bottom: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    background: white;
    padding: 0 2px;
}
.contratto-pct, .contratto-ore { padding-right: 22px !important; }

@media (max-width: 900px) {
    .contratto-row { grid-template-columns: 1fr; }
    .contratto-fields { grid-template-columns: 1fr 1fr; }
    .contratto-note { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
    .contratto-fields { grid-template-columns: 1fr; }
}

/* === Bilancio team admin === */
.bilancio-team-list { display: flex; flex-direction: column; }
.bilancio-team-row {
    display: grid;
    grid-template-columns: 220px 1fr 100px auto;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.bilancio-team-row:last-child { border-bottom: none; }
.bilancio-team-row:hover { background: var(--cream-100, #faf7f2); }

.bt-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bt-name { font-weight: 600; color: var(--green-800); }
.bt-progress { min-width: 0; }
.bt-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}
.bt-pct { font-weight: 700; color: var(--green-800); }
.bt-pct.pct-complete { color: var(--green-500, #639922); }
.bt-pct.pct-risk { color: var(--clay-700, #993c1d); }

.bt-residue { text-align: right; }
.bt-residue strong {
    font-size: 1.1rem;
    color: var(--green-800);
    font-variant-numeric: tabular-nums;
}

.bt-actions { text-align: right; }

@media (max-width: 900px) {
    .bilancio-team-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .bt-residue { text-align: left; }
    .bt-actions { text-align: left; }
}


/* === Bilancio responsive avanzato === */

/* Tabella dettaglio mensile su mobile: nascondi colonne e usa layout compatto */
@media (max-width: 640px) {
    .bilancio-mese-table {
        font-size: 0.85rem;
    }
    .bilancio-mese-table th,
    .bilancio-mese-table td {
        padding: 6px 8px;
    }
    /* Nascondi "Ore lavoro" e "Ore assenze pagate", lascia solo Totale + Dettaglio */
    .bilancio-mese-table th:nth-child(2),
    .bilancio-mese-table th:nth-child(3),
    .bilancio-mese-table td:nth-child(2),
    .bilancio-mese-table td:nth-child(3),
    .bilancio-mese-table tfoot td:nth-child(2),
    .bilancio-mese-table tfoot td:nth-child(3) {
        display: none;
    }
    .bilancio-mese-table th:nth-child(5),
    .bilancio-mese-table td:nth-child(5) {
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

/* Avanzamento card responsive */
@media (max-width: 540px) {
    /* Page actions: stack verticale, full-width */
    .page-header .page-actions {
        width: 100%;
        margin-top: 8px;
    }
    .page-header .page-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Selettori (anno + dipendente) in colonna stretta, full-width */
    form.card[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    form.card[style*="display: flex"] select {
        width: 100% !important;
    }

    /* Avanzamento label e valore con tabular nums */
    .card > div[style*="justify-content: space-between"] {
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* === Bilancio team admin: row responsive === */
@media (max-width: 540px) {
    .bilancio-team-row {
        gap: 0.65rem !important;
        padding: 0.85rem 1rem !important;
    }
    .bilancio-team-row .bt-progress-info {
        font-size: 0.8rem;
    }
}


/* === Tabs di sezione admin (Bilancio / Contratti) === */
.admin-section-tabs {
    display: flex;
    gap: 4px;
    margin: -0.5rem 0 1.25rem 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-section-tabs .tab {
    text-decoration: none;
    padding: 9px 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-bottom: -1px;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.admin-section-tabs .tab:hover {
    color: var(--green-800);
    background: var(--cream-100, #faf7f2);
}
.admin-section-tabs .tab.active {
    color: var(--green-800);
    background: white;
    border-color: var(--border);
    border-bottom: 1px solid white;
    font-weight: 600;
}
@media (max-width: 540px) {
    .admin-section-tabs {
        gap: 2px;
    }
    .admin-section-tabs .tab {
        padding: 7px 12px;
        font-size: 0.82rem;
    }
}

/* === Breadcrumb (admin guarda dettaglio dipendente) === */
.admin-breadcrumb {
    background: var(--cream-100, #faf7f2);
    border: 1px solid var(--cream-300, #e9dfcc);
    border-left: 3px solid var(--clay-500, #c87056);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.admin-breadcrumb .bc-link {
    color: var(--clay-700, #993c1d);
    font-weight: 600;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.15s;
}
.admin-breadcrumb .bc-link:hover {
    background: rgba(200, 112, 86, 0.1);
    text-decoration: underline;
}
.admin-breadcrumb .bc-sep {
    color: var(--text-muted);
    font-weight: 400;
}
.admin-breadcrumb .bc-current {
    color: var(--green-800);
    font-weight: 500;
}
@media (max-width: 540px) {
    .admin-breadcrumb {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
}

/* === Gestione rapporti — card design === */
.gr-list-header {
    margin: 0 0 1rem 0;
}
.gr-list-header h2 {
    font-family: var(--font-display, Georgia, serif);
    font-weight: 500;
    color: var(--green-800);
    font-size: 1.5rem;
    margin: 0;
}

.gr-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.9rem;
}

.gr-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.gr-card:hover {
    box-shadow: 0 6px 20px rgba(35, 61, 49, 0.1);
    border-color: var(--green-300, #97c5a8);
}
.gr-card.is-eliminato {
    background: #fdf3f0;
    border-color: #e8c4b8;
}
.gr-card.is-eliminato:hover {
    box-shadow: 0 6px 20px rgba(153, 60, 29, 0.12);
    border-color: var(--clay-500, #c87056);
}

/* Header */
.gr-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0.7rem 0.9rem;
    background: var(--cream-100, #faf7f2);
    border-bottom: 1px solid var(--border);
}
.gr-card.is-eliminato .gr-card-head {
    background: #fae8e2;
    border-bottom-color: #e8c4b8;
}
.gr-card-head-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.gr-data-badge {
    font-weight: 600;
    color: var(--green-800);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.gr-user {
    font-size: 0.86rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gr-ore-badge {
    background: var(--green-700);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Body */
.gr-card-body {
    padding: 0.8rem 0.9rem;
    flex: 1;
}
.gr-cantiere-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.gr-cantiere-icon { flex-shrink: 0; }
.gr-cantiere-name {
    font-weight: 600;
    color: var(--green-800);
    font-size: 0.96rem;
}
.gr-cantiere-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.gr-luogo { white-space: nowrap; }
.gr-descr {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

.gr-elim-info {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(200, 112, 86, 0.12);
    border-left: 3px solid var(--clay-500);
    border-radius: 5px;
    font-size: 0.8rem;
    color: var(--clay-700);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.gr-elim-info-head { font-weight: 600; }
.gr-motivo {
    font-style: italic;
    color: var(--text-muted);
}

/* Footer */
.gr-card-foot {
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--border);
    background: #fff;
}
.gr-card.is-eliminato .gr-card-foot {
    background: transparent;
    border-top-color: #e8c4b8;
}

.gr-elim-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gr-elim-form input[type="text"] {
    border: 1.5px solid var(--clay-500);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.85rem;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.gr-elim-form input[type="text"]:focus {
    outline: none;
    border-color: var(--clay-700);
    box-shadow: 0 0 0 3px rgba(200, 112, 86, 0.15);
}
.gr-elim-form-actions {
    display: flex;
    gap: 6px;
}

@media (max-width: 520px) {
    .gr-card-grid { grid-template-columns: 1fr; }
}

/* === Indennità festivi (admin/festivi.php) === */
.festivi-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
}
.festivo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--cream-100, #faf7f2);
}
.festivo-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 42px;
    flex-shrink: 0;
}
.festivo-giorno {
    font-weight: 700;
    color: var(--clay-700, #993c1d);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}
.festivo-dow {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: lowercase;
}
.festivo-nome {
    flex: 1;
    font-size: 0.9rem;
    color: var(--green-800);
    font-weight: 500;
    min-width: 0;
}
.festivo-item form { margin: 0; }

/* === Stato fatturazione (gestione rapporti) === */

/* Chips contatori sotto le tab */
.fatt-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: -0.5rem 0 1rem 0;
}
.fatt-chips-lbl {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}
.fatt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    transition: all 0.15s;
}
.fatt-chip strong { font-variant-numeric: tabular-nums; }
.fatt-chip.chip-non { background: #fdeceb; color: #b3261e; }
.fatt-chip.chip-parz { background: #fff4e5; color: #9a6700; }
.fatt-chip.chip-fatt { background: var(--green-50, #ecf1ea); color: var(--green-800, #233d31); }
.fatt-chip:hover { filter: brightness(0.96); }
.fatt-chip.chip-non.active { border-color: #b3261e; }
.fatt-chip.chip-parz.active { border-color: #9a6700; }
.fatt-chip.chip-fatt.active { border-color: var(--green-700); }
.fatt-chip-reset {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 8px;
}
.fatt-chip-reset:hover { color: var(--clay-700); text-decoration: underline; }

/* Card cliccabile */
.gr-card[data-edit-url] { cursor: pointer; }

/* Bordo sinistro colore in base allo stato fatturazione */
.gr-card.fatt-non_fatturato { border-left: 4px solid #d99b94; }
.gr-card.fatt-parziale { border-left: 4px solid #e0a93e; }
.gr-card.fatt-fatturato { border-left: 4px solid var(--green-500, #639922); }

/* Barra fatturazione nella card */
.gr-fatt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    border-top: 1px solid var(--border);
    background: #fcfbf8;
}
.gr-fatt-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.gr-fatt-btns {
    display: inline-flex;
    gap: 3px;
    background: var(--cream-200, #f3ede2);
    padding: 3px;
    border-radius: 8px;
}
.gr-fatt-btn {
    border: none;
    background: transparent;
    width: 30px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--text-muted);
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gr-fatt-btn:hover { background: rgba(0,0,0,0.05); }
.gr-fatt-btn.fb-non.active { background: #b3261e; color: white; }
.gr-fatt-btn.fb-parz.active { background: #e0a93e; color: white; }
.gr-fatt-btn.fb-fatt.active { background: var(--green-500, #639922); color: white; }

/* === Dropdown menu navigazione (Rapporti) === */
.nav-dropdown {
    position: relative;
    display: inline-block;
}
.nav-dropdown-toggle {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* Eredita lo stile dei link del nav */
    font-size: inherit;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.82);
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.nav-dropdown-toggle:hover { color: #fff; }
.nav-dropdown-toggle.active {
    color: #fff;
    font-weight: 600;
}
.nav-caret {
    font-size: 0.7em;
    transition: transform 0.18s;
}
.nav-dropdown.open .nav-caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border, #d8d2c2);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(35, 61, 49, 0.20);
    padding: 6px;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-dropdown-menu a,
.nav-dropdown .nav-dropdown-menu a {
    display: block;
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--green-800, #233d31) !important;
    background: transparent !important;
    font-size: 0.9rem;
    font-weight: 500 !important;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.nav-dropdown-menu a:hover,
.nav-dropdown .nav-dropdown-menu a:hover {
    background: var(--cream-200, #f3ede2) !important;
    color: var(--green-900, #1a2e25) !important;
}
.nav-dropdown-menu a.active,
.nav-dropdown .nav-dropdown-menu a.active {
    background: var(--green-50, #ecf1ea) !important;
    color: var(--green-800, #233d31) !important;
    font-weight: 700 !important;
}
.nav-dropdown-menu a.active:hover,
.nav-dropdown .nav-dropdown-menu a.active:hover {
    background: var(--green-100, #d7e4d0) !important;
}

/* ============================================
   LISTA LAVORI (Da fare) — admin + giardiniere
   ============================================ */

/* --- Selettore giorno (admin) --- */
.ll-day-selector { display: flex; flex-direction: column; gap: 10px; }
.ll-day-form {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ll-day-icon { font-size: 1.1rem; }
.ll-day-form label { font-weight: 600; color: var(--green-800); margin: 0; }
.ll-day-form input[type="date"] {
    border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
    font-size: 0.9rem; background: white;
}
.ll-day-shortcuts { display: flex; gap: 4px; flex-wrap: wrap; }
.ll-day-info {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 10px; border-top: 1px solid var(--border);
    font-size: 0.92rem; color: var(--green-800);
}
.ll-day-stats { color: var(--text-muted); font-size: 0.85rem; }
.ll-stat-dafare { color: var(--clay-700); font-weight: 600; }
.ll-stat-fatti { color: var(--green-700); font-weight: 600; }

/* --- Form aggiungi --- */
.ll-add-grid {
    display: grid;
    grid-template-columns: 2fr 1.3fr 0.9fr auto;
    gap: 10px;
    align-items: end;
}
.ll-add-grid .field { margin: 0; }
@media (max-width: 800px) {
    .ll-add-grid { grid-template-columns: 1fr; }
}

/* --- Lista lavori admin --- */
.ll-list { display: flex; flex-direction: column; gap: 8px; }
.ll-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px; border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 10px; background: white;
    transition: box-shadow 0.15s;
}
.ll-item:hover { box-shadow: 0 3px 12px rgba(35,61,49,0.08); }
.ll-item.ll-pri-alta { border-left-color: #b3261e; }
.ll-item.ll-pri-media { border-left-color: #e0a93e; }
.ll-item.ll-pri-bassa { border-left-color: var(--green-500, #639922); }
.ll-item.ll-done { background: var(--cream-100, #faf7f2); opacity: 0.7; }
.ll-item.ll-done .ll-descr { text-decoration: line-through; color: var(--text-muted); }

.ll-check-form { margin: 0; flex-shrink: 0; }
.ll-check {
    width: 24px; height: 24px; border: 2px solid var(--border);
    border-radius: 6px; background: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.9rem; font-weight: 700;
    transition: all 0.15s; padding: 0;
}
.ll-check:hover { border-color: var(--green-500); }
.ll-check.checked { background: var(--green-500, #639922); border-color: var(--green-500, #639922); }

.ll-content { flex: 1; min-width: 0; }
.ll-descr { font-size: 0.95rem; color: var(--green-900); font-weight: 500; line-height: 1.4; }
.ll-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ll-cantiere { font-size: 0.82rem; color: var(--text-muted); }
.ll-pri-badge {
    padding: 1px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.03em;
}
.ll-pri-badge-alta { background: #fdeceb; color: #b3261e; }
.ll-pri-badge-media { background: #fff4e5; color: #9a6700; }
.ll-pri-badge-bassa { background: var(--green-50, #ecf1ea); color: var(--green-700, #2d4a3e); }

.ll-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.ll-act-btn {
    background: var(--cream-200, #f3ede2);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 7px 12px;
    border-radius: 8px;
    transition: all 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--green-800);
    font-weight: 600;
    white-space: nowrap;
}
.ll-act-btn:hover { background: var(--green-100, #d7e4d0); border-color: var(--green-500); }
.ll-act-btn .ll-act-txt { font-size: 0.8rem; }
.ll-act-del {
    background: #fdeceb;
    border-color: #f5c6c0;
    color: #b3261e;
}
.ll-act-del:hover { background: #f9d2cc; border-color: #b3261e; }
.ll-del-form { margin: 0; display: inline-flex; }

/* Su mobile: la tarea passa a layout verticale e i bottoni diventano larghi */
@media (max-width: 640px) {
    .ll-item { flex-wrap: wrap; }
    .ll-content { flex: 1 1 60%; }
    .ll-actions { width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
    .ll-act-btn { flex: 1; justify-content: center; padding: 10px; }
    .ll-act-btn .ll-act-txt { font-size: 0.85rem; }
}

/* --- Modal modifica --- */
.ll-modal-overlay {
    position: fixed; inset: 0; background: rgba(26,46,37,0.5);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.ll-modal {
    background: white; border-radius: 14px; padding: 1.5rem;
    width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.ll-modal h2 { margin-bottom: 1rem; }
.ll-modal .field { margin-bottom: 0.9rem; }
.ll-modal-actions { display: flex; gap: 8px; margin-top: 1rem; }

/* --- Vista giardiniere (sola lettura) --- */
.lg-list { display: flex; flex-direction: column; gap: 10px; }
.lg-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px; border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 12px; background: white;
}
.lg-item.lg-pri-alta { border-left-color: #b3261e; }
.lg-item.lg-pri-media { border-left-color: #e0a93e; }
.lg-item.lg-pri-bassa { border-left-color: var(--green-500, #639922); }
.lg-icon { font-size: 1.15rem; flex-shrink: 0; line-height: 1.3; }
.lg-content { flex: 1; min-width: 0; }
.lg-descr { font-size: 1.02rem; color: var(--green-900); font-weight: 500; line-height: 1.4; }
.lg-cantiere { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.lg-pri-badge {
    padding: 3px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: 700;
    white-space: nowrap; flex-shrink: 0; letter-spacing: 0.03em;
}
.lg-pri-badge-alta { background: #fdeceb; color: #b3261e; }
.lg-pri-badge-media { background: #fff4e5; color: #9a6700; }
.lg-pri-badge-bassa { background: var(--green-50, #ecf1ea); color: var(--green-700, #2d4a3e); }

/* ============================================
   NOTIFICHE (avvisi al team)
   ============================================ */

/* --- Campanella nel nav --- */
.nav-bell {
    position: relative;
    font-size: 1.1rem;
    padding: 6px 8px !important;
}
.nav-bell-badge {
    position: absolute;
    top: -2px; right: -2px;
    background: #b3261e;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    line-height: 1;
}
.md-notif-badge {
    background: #b3261e; color: white;
    font-size: 0.65rem; font-weight: 700;
    padding: 1px 7px; border-radius: 10px; margin-left: auto;
}

/* --- Popup notifica --- */
.notif-popup-overlay {
    position: fixed; inset: 0;
    background: rgba(26,46,37,0.55);
    z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.notif-popup {
    background: white;
    border-radius: 16px;
    width: 100%; max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    animation: notifPopIn 0.2s ease-out;
}
@keyframes notifPopIn {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.notif-popup-head {
    background: var(--green-700, #2d4a3e);
    color: white;
    padding: 14px 18px;
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; font-size: 1rem;
}
.notif-popup-bell { font-size: 1.25rem; }
.notif-popup-body { padding: 18px; }
.notif-popup-titolo {
    font-size: 1.1rem; font-weight: 700; color: var(--green-900, #1a2e25);
    margin-bottom: 6px;
}
.notif-popup-msg {
    font-size: 0.95rem; color: var(--text); line-height: 1.5;
    margin-bottom: 14px;
}
.notif-popup-meta {
    font-size: 0.78rem; color: var(--text-muted);
    margin-bottom: 16px;
}
.notif-popup-conferma {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.notif-popup-resp-label {
    font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px;
}
.notif-popup-conferma input {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 9px 11px; font-size: 0.9rem; margin-bottom: 12px;
}
.notif-popup-conferma input:focus {
    outline: none; border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(99,153,34,0.15);
}
.notif-popup-conferma .btn { width: 100%; }

/* --- Lista notifiche (campanella/storico dipendente) --- */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item {
    display: flex; gap: 12px;
    padding: 14px; border: 1px solid var(--border);
    border-radius: 12px; background: white;
}
.notif-item.notif-nuova { border-left: 4px solid #b3261e; background: #fffdfc; }
.notif-item.notif-letta { opacity: 0.75; }
.notif-dot {
    width: 9px; height: 9px; border-radius: 50%;
    margin-top: 6px; flex-shrink: 0;
}
.notif-nuova .notif-dot { background: #b3261e; }
.notif-letta .notif-dot { background: var(--border); }
.notif-body { flex: 1; min-width: 0; }
.notif-titolo { font-size: 1rem; font-weight: 700; color: var(--green-900); }
.notif-msg { font-size: 0.92rem; color: var(--text); line-height: 1.5; margin-top: 4px; }
.notif-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.notif-stato-letta { color: var(--green-700); font-weight: 600; }
.notif-stato-nuova { color: #b3261e; font-weight: 600; }
.notif-risposta {
    font-size: 0.82rem; color: var(--text-muted); font-style: italic;
    margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--border);
}
.notif-conferma-box {
    display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.notif-risposta-input {
    flex: 1; min-width: 160px;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; font-size: 0.88rem;
}
.notif-risposta-input:focus {
    outline: none; border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(99,153,34,0.15);
}

/* --- Vista admin notifiche --- */
.notif-dest-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px; margin-top: 6px;
}
.notif-dest-check {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; font-size: 0.88rem; background: white;
}
.notif-dest-check:hover { background: var(--cream-100, #faf7f2); }
.notif-dest-check input { margin: 0; }

.notif-admin-list { display: flex; flex-direction: column; gap: 10px; }
.notif-admin-item {
    border: 1px solid var(--border); border-left: 4px solid var(--green-500, #639922);
    border-radius: 12px; padding: 14px; background: white;
}
.notif-admin-item.tutti-letti { border-left-color: var(--green-700); background: var(--cream-50, #fcfbf8); }
.notif-admin-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px; flex-wrap: wrap;
}
.notif-admin-titolo { font-size: 1.05rem; font-weight: 700; color: var(--green-900); }
.notif-admin-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.notif-admin-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.notif-letti-badge {
    background: var(--cream-200, #f3ede2); color: var(--green-800);
    padding: 4px 11px; border-radius: 12px; font-size: 0.8rem; font-weight: 600;
    white-space: nowrap;
}
.notif-letti-badge.badge-tutti { background: var(--green-100, #d7e4d0); color: var(--green-800); }
.notif-admin-del {
    background: none; border: 1px solid var(--border); cursor: pointer;
    color: var(--text-muted); border-radius: 6px; padding: 4px 9px; font-size: 0.85rem;
}
.notif-admin-del:hover { background: #fdeceb; color: #b3261e; border-color: #f5c6c0; }
.notif-admin-msg {
    font-size: 0.92rem; color: var(--text); line-height: 1.5; margin-top: 8px;
}
.notif-admin-dest {
    display: flex; flex-wrap: wrap; gap: 5px;
    margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.notif-dest-chip {
    padding: 3px 10px; border-radius: 11px; font-size: 0.76rem;
}
.notif-dest-chip.chip-letto { background: var(--green-50, #ecf1ea); color: var(--green-800); }
.notif-dest-chip.chip-nonletto { background: var(--cream-200, #f3ede2); color: var(--text-muted); }
.chip-risposta { opacity: 0.75; font-size: 0.72rem; }

/* ============================================
   MATERIALI E ATTREZZATURE
   ============================================ */

/* --- Box materiali nel rapporto (dipendente) --- */
.materiali-box {
    margin-top: 0.75rem;
    background: var(--cream-100, #faf7f2);
    border-radius: 10px;
    padding: 12px;
}
.materiali-titolo {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green-800);
    margin-bottom: 10px;
}
.materiali-hint { font-weight: 400; color: var(--text-muted); }
.materiali-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.materiale-chip {
    background: white;
    border: 1px dashed var(--clay-300, #c5b896);
    color: var(--green-800);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.materiale-chip:hover {
    background: var(--green-700, #2d4a3e);
    color: white;
    border-color: var(--green-700, #2d4a3e);
    border-style: solid;
}
.materiale-chip.chip-usato {
    background: var(--green-500, #639922);
    color: white;
    border-color: var(--green-500, #639922);
    border-style: solid;
    transform: scale(1.05);
}

/* --- Pagina admin materiali --- */
.mat-add-grid {
    display: grid;
    grid-template-columns: 90px 2fr 1.2fr auto;
    gap: 10px;
    align-items: end;
}
.mat-add-grid .field { margin: 0; }
@media (max-width: 700px) {
    .mat-add-grid { grid-template-columns: 1fr; }
}
.mat-list { display: flex; flex-direction: column; gap: 6px; }
.mat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
}
.mat-icona { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.mat-nome { flex: 1; font-size: 0.95rem; font-weight: 500; color: var(--green-900); }
.mat-unita {
    background: var(--green-50, #ecf1ea);
    color: var(--green-700, #2d4a3e);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}
.mat-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mat-act-btn {
    background: var(--cream-200, #f3ede2);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 7px;
    transition: all 0.12s;
}
.mat-act-btn:hover { background: var(--green-100, #d7e4d0); }
.mat-act-del:hover { background: #fdeceb; }

/* 🆕 Badge "da X giorni" — lavori riportati dai giorni precedenti */
.ll-giorni-badge {
    background: var(--cream-200, #f3ede2);
    color: var(--text-muted);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================
   BUSTE PAGA
   ============================================ */

/* --- Selettore mese (admin) --- */
.bp-mese-selector { display: flex; flex-direction: column; gap: 10px; }
.bp-mese-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bp-mese-icon { font-size: 1.1rem; }
.bp-mese-form label { font-weight: 600; color: var(--green-800); margin: 0; }
.bp-mese-form input[type="month"] {
    border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
    font-size: 0.9rem; background: white;
}
.bp-mese-shortcuts { display: flex; gap: 4px; flex-wrap: wrap; }
.bp-mese-info {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 10px; border-top: 1px solid var(--border);
    font-size: 0.92rem; color: var(--green-800);
}
.bp-mese-stats { font-size: 0.85rem; color: var(--text-muted); }
.bp-stat-ok { color: var(--green-700); font-weight: 600; }
.bp-stat-manca { color: var(--clay-700, #993c1d); font-weight: 600; }

/* --- Lista dipendenti (admin) --- */
.bp-list { display: flex; flex-direction: column; gap: 8px; }
.bp-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 10px;
    background: white;
}
.bp-item.bp-ok { border-left-color: var(--green-500, #639922); }
.bp-item.bp-manca { border-left-color: #d99b94; background: #fffdfc; }
.bp-dip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bp-dip-txt { min-width: 0; }
.bp-dip-nome { font-size: 0.95rem; font-weight: 600; color: var(--green-900); }
.bp-dip-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.bp-meta-manca { color: var(--clay-700, #993c1d); }
.bp-azioni { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* --- Form upload inline --- */
.bp-upload-form {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.bp-upload-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
}
.bp-upload-grid .field { margin: 0; }
.bp-upload-actions { display: flex; gap: 6px; margin-top: 10px; }

/* --- Vista dipendente (le mie buste) --- */
.bp-mie-list { display: flex; flex-direction: column; gap: 8px; }
.bp-mia-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; border: 1px solid var(--border);
    border-left: 4px solid var(--green-500, #639922);
    border-radius: 10px; background: white;
}
.bp-mia-icon { font-size: 1.4rem; flex-shrink: 0; }
.bp-mia-txt { flex: 1; min-width: 0; }
.bp-mia-mese { font-size: 1.02rem; font-weight: 600; color: var(--green-900); }
.bp-mia-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.bp-mia-azioni { display: flex; gap: 5px; flex-shrink: 0; }

@media (max-width: 700px) {
    .bp-item { grid-template-columns: 1fr; }
    .bp-azioni { justify-content: flex-start; }
    .bp-upload-grid { grid-template-columns: 1fr; }
    .bp-mia-item { flex-wrap: wrap; }
    .bp-mia-azioni { width: 100%; margin-top: 8px; }
    .bp-mia-azioni .btn { flex: 1; justify-content: center; }
}

/* ============================================
   DOCUMENTI DIPENDENTI
   ============================================ */
.doc-add-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1.2fr;
    gap: 10px;
}
.doc-add-grid .field { margin: 0; }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 10px;
    background: white;
    transition: box-shadow 0.15s;
}
.doc-item:hover { box-shadow: 0 3px 12px rgba(35,61,49,0.08); }
/* Colore per tipo */
.doc-item.doc-tipo-certificato_medico { border-left-color: #b3261e; }
.doc-item.doc-tipo-documento_identita { border-left-color: #5a8aa0; }
.doc-item.doc-tipo-patente { border-left-color: #e0a93e; }
.doc-item.doc-tipo-formazione { border-left-color: var(--green-500, #639922); }
.doc-item.doc-tipo-altro { border-left-color: var(--border); }

.doc-icon { font-size: 1.4rem; flex-shrink: 0; }
.doc-txt { flex: 1; min-width: 0; }
.doc-titolo {
    font-size: 0.98rem; font-weight: 600; color: var(--green-900);
    line-height: 1.35;
}
.doc-meta {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.78rem; color: var(--text-muted); margin-top: 4px;
}
.doc-dip { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--green-800); }
.doc-tipo-badge {
    background: var(--cream-200, #f3ede2);
    color: var(--green-800);
    padding: 1px 9px; border-radius: 10px;
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.doc-azioni { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }

@media (max-width: 760px) {
    .doc-add-grid { grid-template-columns: 1fr; }
    .doc-item { flex-wrap: wrap; }
    .doc-txt { flex: 1 1 60%; }
    .doc-azioni {
        width: 100%; margin-top: 8px; padding-top: 8px;
        border-top: 1px solid var(--border);
    }
    .doc-azioni .btn { flex: 1; justify-content: center; }
}

/* ============================================
   RICHIESTE ASSENZE (vacanze, permessi)
   ============================================ */

/* --- Form nuova richiesta --- */
.ra-form-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 10px;
}
.ra-form-grid .field { margin: 0; }
.ra-form-actions {
    display: flex; align-items: center; gap: 12px;
    margin-top: 12px; flex-wrap: wrap;
}
.ra-conteggio { font-size: 0.82rem; color: var(--text-muted); }

/* --- Lista richieste --- */
.ra-list { display: flex; flex-direction: column; gap: 8px; }
.ra-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 10px;
    background: white;
}
.ra-item.ra-stato-in_attesa { border-left-color: #e0a93e; }
.ra-item.ra-stato-approvata { border-left-color: var(--green-500, #639922); background: var(--cream-50, #fcfbf8); }
.ra-item.ra-stato-rifiutata { border-left-color: #b3261e; }
.ra-item.ra-stato-annullata { border-left-color: var(--border); opacity: 0.6; }

.ra-icon { font-size: 1.25rem; flex-shrink: 0; }
.ra-txt { flex: 1; min-width: 0; }
.ra-titolo { font-size: 0.98rem; font-weight: 600; color: var(--green-900); line-height: 1.35; }
.ra-meta { font-size: 0.79rem; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.ra-nota-admin {
    font-size: 0.82rem; color: var(--clay-700, #993c1d);
    margin-top: 5px; padding-left: 8px;
    border-left: 2px solid var(--clay-300, #c5b896);
}
.ra-azioni { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.ra-badge {
    padding: 3px 11px; border-radius: 12px;
    font-size: 0.7rem; font-weight: 700; white-space: nowrap;
    letter-spacing: 0.02em;
}
.ra-badge-in_attesa { background: #fff4e5; color: #9a6700; }
.ra-badge-approvata { background: var(--green-50, #ecf1ea); color: var(--green-700, #2d4a3e); }
.ra-badge-rifiutata { background: #fdeceb; color: #b3261e; }
.ra-badge-annullata { background: var(--cream-200, #f3ede2); color: var(--text-muted); }

/* --- Vista admin: blocco decisione --- */
.ra-item.ra-admin-attesa { flex-direction: column; align-items: stretch; }
.ra-admin-head { display: flex; align-items: flex-start; gap: 10px; }
.ra-decisione {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.ra-decisione-row {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.ra-decisione-row input[type="text"] {
    flex: 1; min-width: 160px;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; font-size: 0.86rem;
}
.ra-decisione-row input[type="text"]:focus {
    outline: none; border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(99,153,34,0.15);
}
.ra-pagato-box {
    background: var(--cream-100, #faf7f2);
    border-radius: 8px; padding: 10px; margin-bottom: 10px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ra-pagato-label { font-size: 0.78rem; color: var(--text-muted); }
.ra-radio {
    display: inline-flex; align-items: center; gap: 6px;
    background: white; border: 1px solid var(--border);
    padding: 5px 12px; border-radius: 14px;
    font-size: 0.82rem; cursor: pointer; margin: 0;
}
.ra-radio input { margin: 0; }
.ra-radio:hover { border-color: var(--green-500); }

/* --- Pannello "Assenti oggi" --- */
.assenti-panel {
    border-left: 4px solid var(--clay-500, #c87056);
    margin-bottom: 1rem;
}
.assenti-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.assenti-head h2 { margin: 0; font-size: 1.05rem; }
.assenti-ico { font-size: 1.05rem; }
.assenti-count {
    background: var(--clay-500, #c87056); color: white;
    padding: 1px 9px; border-radius: 10px;
    font-size: 0.68rem; font-weight: 700;
}
.assenti-list { display: flex; flex-direction: column; gap: 6px; }
.assente-riga {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--cream-100, #faf7f2);
    border-radius: 8px;
    flex-wrap: wrap;
}
.assente-nome { flex: 1; font-size: 0.88rem; font-weight: 600; color: var(--green-900); min-width: 100px; }
.assente-tipo {
    background: var(--green-50, #ecf1ea); color: var(--green-700, #2d4a3e);
    padding: 2px 9px; border-radius: 10px;
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.assente-rientro { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 700px) {
    .ra-form-grid { grid-template-columns: 1fr; }
    .ra-item { flex-wrap: wrap; }
    .ra-azioni { width: 100%; margin-top: 8px; justify-content: space-between; }
    .ra-decisione-row { flex-direction: column; align-items: stretch; }
    .ra-decisione-row .btn { width: 100%; justify-content: center; }
    .assente-riga { font-size: 0.85rem; }
    .assente-nome { flex: 1 1 100%; }
}

/* Badge contatore dentro le voci del dropdown (es. richieste da approvare) */
.nav-menu-badge {
    background: #b3261e;
    color: white !important;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 9px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ============================================
   STORICO CLIENTE (ricerca lavori per cliente)
   ============================================ */

/* --- Barra di ricerca --- */
.sc-search-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.sc-search-row .field { margin: 0; }
.sc-field-q { flex: 1; min-width: 200px; }
.sc-field-q input {
    font-size: 1rem;
}
.sc-date-details {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.sc-date-details summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--green-800);
    font-weight: 600;
    list-style: none;
    user-select: none;
}
.sc-date-details summary::-webkit-details-marker { display: none; }
.sc-date-details summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s;
}
.sc-date-details[open] summary::before { content: '▾ '; }
.sc-date-details summary:hover { color: var(--green-500); }
.sc-date-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}
.sc-date-row .field { margin: 0; }

/* --- Riepilogo KPI --- */
.sc-riepilogo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 1rem;
}
.sc-kpi {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.sc-kpi-ultimo {
    background: var(--green-50, #ecf1ea);
    border-color: var(--green-100, #d7e4d0);
}
.sc-kpi-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.sc-kpi-ultimo .sc-kpi-label { color: var(--green-700, #2d4a3e); }
.sc-kpi-value {
    font-family: Fraunces, Georgia, serif;
    font-size: 1.8rem;
    line-height: 1.1;
    color: var(--green-800);
}
.sc-kpi-value-data {
    font-family: Fraunces, Georgia, serif;
    font-size: 1.35rem;
    line-height: 1.2;
    color: var(--green-700, #2d4a3e);
}
.sc-kpi-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Riga cantieri trovati --- */
.sc-trovati {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.9;
}
.sc-cantiere-chip {
    background: var(--cream-200, #f3ede2);
    color: var(--green-800);
    padding: 2px 10px;
    border-radius: 11px;
    font-size: 0.76rem;
    font-weight: 600;
    margin-right: 3px;
    white-space: nowrap;
}

/* --- Lista interventi --- */
.sc-list { display: flex; flex-direction: column; gap: 8px; }
.sc-item {
    border: 1px solid var(--border);
    border-left: 4px solid var(--green-500, #639922);
    border-radius: 10px;
    padding: 12px 14px;
    background: white;
    transition: box-shadow 0.15s;
}
.sc-item:hover { box-shadow: 0 3px 12px rgba(35,61,49,0.08); }
.sc-item-head {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.sc-data {
    font-family: Fraunces, Georgia, serif;
    font-size: 1.02rem;
    color: var(--green-800);
}
.sc-giorno { font-size: 0.74rem; color: var(--text-muted); }
.sc-cantiere {
    background: var(--cream-200, #f3ede2);
    color: var(--green-800);
    padding: 1px 9px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}
.sc-luogo { font-size: 0.76rem; color: var(--text-muted); }
.sc-autore {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.sc-ore {
    background: var(--green-50, #ecf1ea);
    color: var(--green-700, #2d4a3e);
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}
.sc-descr {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

@media (max-width: 700px) {
    .sc-search-row { flex-direction: column; align-items: stretch; }
    .sc-search-row .btn { width: 100%; justify-content: center; }
    .sc-autore { margin-left: 0; }
    .sc-riepilogo { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
    .sc-kpi { padding: 11px 12px; }
    .sc-kpi-value { font-size: 1.5rem; }
    .sc-kpi-value-data { font-size: 1.15rem; }
}

/* Nota nella banda bilancio quando i filtri mostrano solo parte della giornata */
.bal-filtro-nota {
    font-size: 0.76rem;
    color: var(--text-muted);
    background: var(--cream-200, #f3ede2);
    padding: 1px 9px;
    border-radius: 10px;
    white-space: nowrap;
}

/* --- Storico cliente: tendina cantieri e pulsanti rapidi --- */
.sc-oppure {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-bottom: 11px;
    white-space: nowrap;
}
.sc-field-select { flex: 1; min-width: 190px; }
.sc-field-select select { width: 100%; }
.sc-quick {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding-bottom: 1px;
}
.sc-hint-data {
    margin-top: 10px;
    background: var(--green-50, #ecf1ea);
    border-radius: 6px;
    padding: 8px 11px;
    font-size: 0.78rem;
    color: var(--green-700, #2d4a3e);
}

@media (max-width: 760px) {
    .sc-oppure {
        padding-bottom: 0;
        text-align: center;
        width: 100%;
    }
    .sc-field-select { min-width: 100%; }
    .sc-quick { width: 100%; }
    .sc-quick .btn { flex: 1; justify-content: center; }
}
