/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:      #1d4ed8;
    --primary-dark: #1e40af;
    --primary-light:#dbeafe;
    --accent:       #0891b2;
    --success:      #059669;
    --danger:       #dc2626;
    --danger-light: #fee2e2;
    --warning:      #d97706;
    --bg:           #f1f5f9;
    --card:         #ffffff;
    --border:       #e2e8f0;
    --text:         #1e293b;
    --text-muted:   #64748b;
    --radius:       10px;
    --shadow:       0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-md);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: .9rem 0;
    display: flex;
    align-items: center;
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-icon { font-size: 2rem; }
.brand h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: .8rem; opacity: .85; margin-top: 2px; }

/* ===== TABS ===== */
.tabs {
    background: var(--card);
    border-bottom: 2px solid var(--border);
    display: flex;
    gap: 0;
    padding: 0 1.5rem;
    max-width: 100%;
    box-shadow: var(--shadow);
}
.tab-btn {
    background: none;
    border: none;
    padding: .85rem 1.4rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color .2s, border-color .2s;
    margin-bottom: -2px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== MAIN ===== */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--border);
}
.table-card { padding: 1rem; }

/* ===== FORM ===== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.req { color: var(--danger); }
.form-group input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .5rem .75rem;
    font-size: .95rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}

/* ===== BUTTONS ===== */
.btn-group { display: flex; gap: .6rem; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    font-size: .9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #b91c1c; }
.btn-edit  { background: #e0f2fe; color: var(--accent); border: 1px solid #bae6fd; }
.btn-edit:hover  { background: #bae6fd; }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

/* ===== EMPLOYEE TABLE ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table thead tr { background: var(--bg); }
.table th, .table td {
    padding: .65rem .9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}
.table tbody tr:hover { background: #f8fafc; }
.table .actions { display: flex; gap: .4rem; }

/* ===== ORARI TABLE ===== */
.controls-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: .9rem 1.2rem;
}
.week-nav {
    display: flex;
    align-items: center;
    gap: .9rem;
}
.week-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    min-width: 200px;
    text-align: center;
}
.table-wrapper { overflow-x: auto; }

.orari-table {
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0;
}
.orari-table th, .orari-table td {
    border: 1px solid var(--border);
    padding: 0;
}
.orari-table thead tr { background: var(--primary); }
.orari-table th {
    color: #fff;
    text-align: center;
    padding: .55rem .5rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}
.orari-table th .date-sub {
    display: block;
    font-size: .75rem;
    font-weight: 400;
    opacity: .85;
    margin-top: 1px;
}
.orari-table th.col-emp  { text-align: left; padding-left: .8rem; min-width: 150px; }
.orari-table th.col-day  { min-width: 170px; }
.orari-table th.col-tot  { min-width: 75px; }

/* Saturday/Sunday slight tint */
.orari-table th.weekend, .orari-table td.weekend { background-color: #fefce8; }
.orari-table thead th.weekend { background-color: #ca8a04; }

/* Employee name cell */
.orari-table .emp-name-cell {
    padding: .5rem .8rem;
    font-size: .88rem;
    background: #f8fafc;
    vertical-align: middle;
}
.emp-fullname { font-weight: 700; color: var(--text); }
.emp-role { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }

/* Orario cell */
.orario-cell {
    padding: .35rem .4rem;
    vertical-align: top;
}
.time-slot {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 4px;
}
.time-slot:last-of-type { margin-bottom: 0; }
.slot-label {
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 3px;
    padding: 1px 4px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.slot-label.sera { background: var(--accent); }
.slot-sep {
    font-size: .7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
input.time-input {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 4px;
    font-size: .8rem;
    width: 72px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input.time-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.day-total {
    font-size: .7rem;
    font-weight: 700;
    color: var(--success);
    text-align: right;
    margin-top: 4px;
    min-height: 1em;
}

/* Week total cell */
.orari-table .week-total-cell {
    text-align: center;
    font-weight: 700;
    font-size: .88rem;
    color: var(--primary);
    vertical-align: middle;
    padding: .5rem .4rem;
    background: var(--primary-light);
}

/* ===== EMPTY MESSAGE ===== */
.empty-msg {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-size: .95rem;
}

/* ===== TAB CONTENT ===== */
.tab-content { display: none; }
.tab-content.active { display: flex; flex-direction: column; gap: 1.25rem; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.8rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal h3 { margin-bottom: .6rem; font-size: 1.1rem; }
.modal p  { color: var(--text-muted); margin-bottom: 1.2rem; font-size: .95rem; line-height: 1.5; }

/* ===== PRINT ===== */
@media print {
    header, .tabs, .controls-card, .btn, .actions { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
    main { padding: 0; }
    .tab-content { display: flex !important; }
    #tab-dipendenti { display: none !important; }
    .orari-table { font-size: .75rem; }
    input.time-input {
        border: none;
        width: auto;
        font-size: .75rem;
        -webkit-appearance: none;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr 1fr; }
    .week-label { min-width: 0; font-size: .88rem; }
    .brand h1 { font-size: 1.3rem; }
}

/* ===== VENUS 2.0 — EDITORIAL ORBIT ===== */
:root {
    --primary: #ef5b3f;
    --primary-dark: #c93d28;
    --primary-light: #ffe4dc;
    --accent: #26786c;
    --success: #26786c;
    --danger: #c63c30;
    --danger-light: #ffe1dc;
    --bg: #f3efe6;
    --card: #fffdf8;
    --border: #d9d1c2;
    --text: #20201d;
    --text-muted: #746f66;
    --radius: 3px;
    --shadow: 0 1px 0 rgba(32,32,29,.08);
    --shadow-md: 0 12px 40px rgba(42,38,30,.08);
}

body {
    font-family: "Aptos", "Segoe UI", sans-serif;
    background:
        linear-gradient(rgba(52,49,43,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(52,49,43,.035) 1px, transparent 1px),
        var(--bg);
    background-size: 32px 32px;
}

header {
    position: relative;
    overflow: hidden;
    padding: 0 2rem;
    color: #f8f1e5;
    background: #20201d;
    box-shadow: none;
}

header::after {
    content: "";
    position: absolute;
    width: 350px;
    height: 350px;
    right: 4%;
    top: -270px;
    border: 1px solid rgba(248,241,229,.25);
    border-radius: 50%;
}

.header-inner {
    min-height: 190px;
    padding: 2.5rem 0;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.brand { gap: 1.4rem; }
.brand-copy { display: flex; flex-direction: column; align-items: flex-start; }
.brand h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.5rem, 8vw, 6.6rem);
    line-height: .82;
    font-weight: 400;
    letter-spacing: -.07em;
}
.brand-dot { color: var(--primary); }
.brand-sub { margin-top: 1rem; font-size: .9rem; opacity: .7; letter-spacing: .02em; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border: 1px solid rgba(248,241,229,.5);
    border-radius: 50%;
    transform: rotate(-18deg);
}
.brand-mark::before {
    content: "";
    width: 29px;
    height: 29px;
    border-radius: 50%;
    background: var(--primary);
}
.brand-mark i {
    position: absolute;
    width: 88px;
    height: 23px;
    border: 1px solid rgba(248,241,229,.75);
    border-radius: 50%;
}

.eyebrow {
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: var(--primary);
}
.brand .eyebrow { margin-bottom: .65rem; }
.header-note {
    display: flex;
    align-items: center;
    gap: .55rem;
    align-self: flex-start;
    padding: .55rem .8rem;
    border: 1px solid rgba(248,241,229,.18);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #a9d070; }

.tabs {
    padding: 0 2rem;
    background: #20201d;
    border: 0;
    box-shadow: none;
}
.tabs-inner { width: 100%; max-width: 1400px; margin: 0 auto; display: flex; }
.tab-btn {
    padding: 1rem 1.4rem 1.1rem 0;
    margin: 0 2.3rem 0 0;
    color: rgba(248,241,229,.5);
    border: 0;
    border-top: 2px solid transparent;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}
.tab-btn span { margin-right: .55rem; font-size: .62rem; opacity: .6; }
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #fff; border-top-color: var(--primary); border-bottom: 0; }

main { padding: 2.5rem 2rem 4rem; gap: 1.5rem; }
.section-intro {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 2rem;
    padding: 1rem 0 .5rem;
}
.section-intro h2 {
    margin-top: .25rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 400;
    letter-spacing: -.045em;
}
.section-intro > p { max-width: 360px; color: var(--text-muted); line-height: 1.5; }

.card {
    padding: 1.6rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    font-weight: 400;
    border: 0;
    margin-bottom: 1.25rem;
}

.form-group label { color: var(--text); letter-spacing: .12em; }
.form-group input {
    padding: .72rem .1rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}
.form-group input:focus { background: transparent; box-shadow: none; border-color: var(--primary); }

.btn { border-radius: 999px; padding: .58rem 1.15rem; letter-spacing: .01em; }
.btn-primary { padding-left: 1.35rem; }
.btn-primary span { font-size: 1rem; }
.btn-secondary { background: transparent; border: 1px solid var(--border); }
.btn-secondary:hover { background: #ebe4d8; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #e1aaa2; }
.btn-danger:hover { color: #fff; }
.btn-edit { background: transparent; color: var(--accent); border-color: #9bbcb5; }

.table thead tr { background: transparent; }
.table th { color: var(--text); letter-spacing: .12em; border-bottom-color: var(--text); }
.table td { padding-top: .85rem; padding-bottom: .85rem; }

.controls-card { background: transparent; border-width: 1px 0; box-shadow: none; padding-inline: 0; }
.week-nav .btn { width: 38px; height: 38px; justify-content: center; padding: 0; }
.week-label { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; font-weight: 400; }
.table-card { padding: .6rem; background: #fffdf8; }
.orari-table thead tr { background: #20201d; }
.orari-table thead th.weekend { background: #48442f; }
.orari-table th { letter-spacing: .08em; }
.orari-table .week-total-cell { background: #dce9e5; color: #18594f; }
.slot-label { background: #20201d; }
.slot-label.sera { background: var(--primary); }

.modal-overlay { backdrop-filter: blur(5px); background: rgba(32,32,29,.55); }
.modal { border-radius: 2px; border-top: 4px solid var(--primary); }
.modal .eyebrow { margin-bottom: .5rem; }

@media (max-width: 700px) {
    header, .tabs { padding-inline: 1.1rem; }
    .header-inner { min-height: 160px; }
    .brand-mark { width: 52px; height: 52px; }
    .brand-mark i { width: 65px; }
    .brand h1 { font-size: 3.8rem; }
    .brand-sub, .header-note { display: none; }
    main { padding: 1.4rem 1rem 3rem; }
    .section-intro { align-items: flex-start; flex-direction: column; gap: .5rem; }
    .section-intro > p { font-size: .86rem; }
    .form-row { grid-template-columns: 1fr; }
    .card { padding: 1.15rem; }
    .table .actions { flex-direction: column; align-items: flex-start; }
}

/* ===== AGENDA — TABELLA OPERATIVA ===== */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-wrapper {
    max-height: 68vh;
    overflow: auto;
    scrollbar-color: var(--primary) #e9e2d6;
    scrollbar-width: thin;
}

.schedule-help {
    position: sticky;
    left: 0;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: .75rem 1rem;
    min-width: max-content;
    color: var(--text-muted);
    background: #f8f3e9;
    border-bottom: 1px solid var(--border);
    font-size: .72rem;
    z-index: 5;
}
.schedule-help span { display: inline-flex; align-items: center; gap: .35rem; }
.schedule-help small { margin-left: auto; padding-left: 2rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: #20201d; }
.legend-dot.evening { background: var(--primary); }

.orari-table {
    min-width: 1210px;
    table-layout: fixed;
    border: 0;
}
.orari-table th,
.orari-table td { border-width: 0 1px 1px 0; }
.orari-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 54px;
    background: #20201d;
}
.orari-table th.col-emp {
    position: sticky;
    left: 0;
    z-index: 6;
    width: 180px;
    min-width: 180px;
    padding-left: 1rem;
    box-shadow: 7px 0 18px rgba(32,32,29,.08);
}
.orari-table th.col-day {
    width: 140px;
    min-width: 140px;
}
.orari-table th.col-tot {
    width: 88px;
    min-width: 88px;
}

.orari-table .emp-name-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 180px;
    min-width: 180px;
    padding: .8rem;
    background: #fffdf8;
    box-shadow: 7px 0 18px rgba(32,32,29,.06);
}
.orari-table tbody tr:nth-child(even) .emp-name-cell,
.orari-table tbody tr:nth-child(even) td { background-color: #faf7f0; }
.emp-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    background: var(--accent);
    font-family: Georgia, serif;
    font-size: .73rem;
    text-transform: uppercase;
}
.emp-fullname { line-height: 1.2; }

.orario-cell {
    padding: .55rem !important;
    background: #fffdf8;
}
.time-slot {
    display: grid;
    grid-template-columns: 1fr 12px 1fr;
    gap: .25rem;
    position: relative;
    padding-top: 1.25rem;
    margin: 0 0 .65rem;
}
.time-slot:last-of-type { margin-bottom: 0; }
.slot-label {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    padding: 0;
    color: #4f4b44;
    background: none !important;
    font-size: .62rem;
    line-height: 1;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.slot-label::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 4px;
    border-radius: 50%;
    background: #20201d;
}
.slot-label.sera::before { background: var(--primary); }
.slot-sep { align-self: end; padding-bottom: .42rem; text-align: center; color: #aaa397; }
.time-field { min-width: 0; }
.time-field > span {
    display: block;
    margin-bottom: 2px;
    color: #999186;
    font-size: .55rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
input.time-input {
    width: 100%;
    min-width: 0;
    padding: .38rem .25rem;
    border-color: #d9d1c2;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.day-total {
    margin-top: .6rem;
    padding-top: .4rem;
    border-top: 1px dashed #ddd5c8;
    color: var(--accent);
    text-align: left;
}
.day-total::before {
    content: "Totale giorno";
    margin-right: .35rem;
    color: #999186;
    font-size: .55rem;
    font-weight: 500;
    text-transform: uppercase;
}
.orari-table td.weekend {
    background-color: #f4f0df;
}
.orari-table tbody tr:hover td { background-color: #fff8ea; }
.orari-table .week-total-cell {
    padding: .65rem !important;
    font-family: Georgia, serif;
    font-size: 1rem;
}

@media (max-width: 700px) {
    .table-card { background: transparent; border: 0; overflow: visible; }
    .table-wrapper { max-height: none; overflow: visible; }
    .schedule-help { position: static; min-width: 0; flex-wrap: wrap; border: 1px solid var(--border); }
    .schedule-help small { display: none; }
    .orari-table { display: block; min-width: 0; }
    .orari-table thead { display: none; }
    .orari-table tbody,
    .orari-table tr { display: block; }
    .orari-table tbody tr {
        margin: 0 0 1rem;
        overflow: hidden;
        border: 1px solid var(--border);
        background: var(--card);
    }
    .orari-table .emp-name-cell {
        position: static;
        display: flex;
        width: 100%;
        min-width: 0;
        padding: .9rem;
        color: #fff;
        background: #20201d !important;
        box-shadow: none;
    }
    .orari-table .emp-name-cell .emp-fullname { color: #fff; }
    .orari-table .emp-name-cell .emp-role { color: rgba(255,255,255,.6); }
    .orari-table td.orario-cell {
        display: grid;
        grid-template-columns: 82px 1fr 1fr;
        gap: .35rem .65rem;
        width: 100%;
        padding: .8rem !important;
        border-right: 0;
    }
    .orari-table td.orario-cell::before {
        content: attr(data-day) "\A" attr(data-date);
        grid-row: 1 / 3;
        white-space: pre;
        color: var(--text);
        font-family: Georgia, serif;
        font-size: .9rem;
        line-height: 1.35;
    }
    .orari-table td.orario-cell .time-slot { margin: 0; }
    .orari-table td.orario-cell .day-total {
        grid-column: 2 / 4;
        margin-top: 0;
    }
    .orari-table .week-total-cell {
        display: flex;
        justify-content: space-between;
        width: 100%;
        border-right: 0;
        text-align: right;
    }
    .orari-table .week-total-cell::before {
        content: "Totale settimana";
        font-family: "Aptos", "Segoe UI", sans-serif;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .08em;
    }
}

/* ===== COLONNE GIORNO ESPANDIBILI ===== */
.orari-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.orari-table th.col-day.day-collapsed,
.orari-table td.orario-cell.day-collapsed {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
}

.orari-table th.col-day.day-expanded,
.orari-table td.orario-cell.day-expanded {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
}

.day-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    width: 100%;
    min-height: 53px;
    padding: .45rem .55rem;
    color: #ffffff;
    background: transparent;
    border: 0;
    font: inherit;
    cursor: pointer;
}
.day-toggle:hover,
.day-toggle:focus-visible {
    background: rgba(255,255,255,.1);
    outline: none;
}
.day-initial {
    grid-row: 1 / 3;
    align-self: center;
    font-family: Georgia, serif;
    font-size: 1.15rem;
}
.day-full {
    display: none;
    text-align: left;
    font-size: .76rem;
}
.day-toggle .date-sub {
    display: none;
    text-align: left;
}
.toggle-symbol {
    grid-column: 2;
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 50%;
    font-size: .85rem;
}
.day-collapsed .day-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .1rem;
    padding: .35rem .2rem;
}
.day-collapsed .toggle-symbol {
    width: auto;
    height: auto;
    border: 0;
    font-size: .65rem;
    opacity: .55;
}
.day-expanded .day-initial { display: none; }
.day-expanded .day-full,
.day-expanded .day-toggle .date-sub { display: block; }

.orari-table thead th.col-day {
    color: #ffffff !important;
    background: #252521 !important;
    border-right: 1px solid #55544d;
}
.orari-table thead th.col-day.weekend {
    background: #3d3a2d !important;
}
.orari-table thead th.col-day.day-expanded {
    color: #ffffff !important;
    background: #b83e29 !important;
}
.orari-table thead th.col-day .day-toggle,
.orari-table thead th.col-day .day-initial,
.orari-table thead th.col-day .day-full {
    color: #ffffff !important;
    opacity: 1;
}
.orari-table thead th.col-day .date-sub {
    color: #ffffff !important;
    opacity: .82;
}
.orari-table thead th.col-day .toggle-symbol {
    color: #ffffff;
    border-color: rgba(255,255,255,.7);
}
.orari-table thead th.col-emp,
.orari-table thead th.col-tot {
    color: #ffffff !important;
    background: #252521 !important;
    border-right: 1px solid #55544d;
    border-bottom: 1px solid #55544d;
    opacity: 1;
}
.orari-table thead th.col-emp span,
.orari-table thead th.col-tot {
    color: #ffffff !important;
    opacity: 1;
}

.orario-cell.day-collapsed {
    padding: .45rem .2rem !important;
    vertical-align: middle;
}
.orario-cell.day-collapsed .time-slot { display: none; }
.orario-cell.day-collapsed .day-total {
    margin: 0;
    padding: 0;
    border: 0;
    text-align: center;
    white-space: nowrap;
}
.orario-cell.day-collapsed .day-total::before { display: none; }

.orario-cell.day-expanded {
    padding: .75rem !important;
}
.orario-cell.day-expanded .time-slot {
    grid-template-columns: minmax(105px, 1fr) 16px minmax(105px, 1fr);
    gap: .45rem;
}
.orario-cell.day-expanded .time-field > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.orario-cell.day-expanded input.time-input {
    padding: .5rem .4rem;
    font-size: .86rem;
}

@media (max-width: 700px) {
    .orari-table {
        width: 100%;
        min-width: 0;
    }
    .orari-table td.orario-cell.day-collapsed,
    .orari-table td.orario-cell.day-expanded {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .orari-table td.orario-cell.day-collapsed .time-slot,
    .orari-table td.orario-cell.day-expanded .time-slot {
        display: grid;
    }
    .orari-table td.orario-cell.day-collapsed .day-total {
        margin-top: 0;
        padding-top: .4rem;
        border-top: 1px dashed #ddd5c8;
        text-align: left;
    }
    .orari-table td.orario-cell.day-collapsed .day-total::before { display: inline; }
}

/* ===== RIEPILOGO MENSILE ===== */
.summary-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: .8rem;
    background: transparent;
    border-width: 1px 0;
    box-shadow: none;
}
.summary-controls .btn {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
}
#month-label {
    min-width: 190px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.18rem;
    font-weight: 400;
    text-align: center;
}
#riepilogo-content { display: grid; gap: 1.25rem; }
.summary-grid {
    display: grid;
    grid-template-columns: minmax(240px, .7fr) minmax(420px, 1.3fr);
    gap: 1.25rem;
}
.total-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 260px;
    background: #20201d;
    color: #fff;
}
.total-card > strong {
    margin: .6rem 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 7vw, 5.3rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -.06em;
}
.total-card > span { color: rgba(255,255,255,.55); font-size: .78rem; }

.celebration-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 250px;
    min-height: 260px;
    overflow: hidden;
    padding: 2rem;
    border: 1px solid #dc8b78;
    background: #f6c9bb;
}
.celebration-card.is-empty { display: flex; align-items: center; background: #e9e2d6; border-color: var(--border); }
.celebration-copy { position: relative; z-index: 2; align-self: center; }
.celebration-copy h3 {
    margin: .5rem 0 .7rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 400;
    line-height: .95;
    letter-spacing: -.045em;
}
.celebration-copy h3 span { color: #a53220; }
.celebration-copy > p:last-child { color: #6e4339; font-size: .86rem; }

.bunting {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 0 1rem;
    border-top: 2px solid #20201d;
}
.bunting i {
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-top: 24px solid var(--primary);
    transform-origin: top center;
    animation: flag-sway 2.2s ease-in-out infinite alternate;
}
.bunting i:nth-child(even) { border-top-color: var(--accent); animation-delay: -.8s; }
.bunting i:nth-child(3n) { border-top-color: #e7a52e; animation-delay: -1.3s; }

.party-community {
    position: relative;
    align-self: end;
    height: 185px;
}
.party-person {
    position: absolute;
    bottom: 0;
    width: 72px;
    height: 155px;
    transform-origin: center bottom;
    animation: happy-dance 1.15s ease-in-out infinite alternate;
}
.party-person.person-one { left: 25px; }
.party-person.person-two { right: 22px; animation-delay: -.55s; }
.party-person .head {
    position: absolute;
    top: 0;
    left: 22px;
    width: 31px;
    height: 36px;
    border: 3px solid #20201d;
    border-radius: 48% 48% 45% 45%;
    background: #f3a77f;
    z-index: 2;
}
.party-person .head::before {
    content: "";
    position: absolute;
    inset: -6px -4px auto;
    height: 15px;
    border-radius: 50% 50% 20% 20%;
    background: #20201d;
}
.party-person .body {
    position: absolute;
    top: 32px;
    left: 15px;
    width: 45px;
    height: 78px;
    border: 3px solid #20201d;
    border-radius: 40% 40% 8% 8%;
    background: var(--accent);
}
.person-two .body { background: var(--primary); }
.party-person .body::before,
.party-person .body::after {
    content: "";
    position: absolute;
    top: 70px;
    width: 12px;
    height: 48px;
    border: 3px solid #20201d;
    border-top: 0;
    background: #403d38;
}
.party-person .body::before { left: 2px; transform: rotate(5deg); }
.party-person .body::after { right: 2px; transform: rotate(-5deg); }
.party-person .arm {
    position: absolute;
    top: 43px;
    width: 10px;
    height: 61px;
    border: 3px solid #20201d;
    border-radius: 10px;
    background: #f3a77f;
    transform-origin: top center;
}
.party-person .arm.left { left: 7px; transform: rotate(38deg); }
.party-person .arm.right { right: 5px; transform: rotate(-125deg); }
.person-two .arm.left { transform: rotate(125deg); }
.person-two .arm.right { transform: rotate(-38deg); }
.confetti {
    position: absolute;
    width: 8px;
    height: 14px;
    background: var(--primary);
    animation: confetti-fall 2s linear infinite;
}
.confetti.c1 { left: 25%; top: 0; }
.confetti.c2 { left: 58%; top: -15px; background: var(--accent); animation-delay: -.8s; }
.confetti.c3 { right: 8%; top: 15px; background: #d89b25; animation-delay: -1.3s; }

.ranking-card { padding: 0; overflow: hidden; }
.ranking-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.4rem;
    border-bottom: 1px solid var(--border);
}
.ranking-heading h3 { font-family: Georgia, serif; font-size: 1.3rem; font-weight: 400; }
.ranking-heading span { color: var(--text-muted); font-size: .75rem; text-transform: capitalize; }
.ranking-heading small {
    display: block;
    margin-top: .2rem;
    color: var(--text-muted);
    font-size: .67rem;
}
.summary-list { display: grid; }
.summary-row {
    display: grid;
    grid-template-columns: 38px minmax(190px, 1fr) minmax(140px, 2fr) 165px;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.4rem;
    border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: 0; }
.summary-row:first-child { background: #fff6de; }
.rank-number { color: #aaa298; font-family: Georgia, serif; font-size: .82rem; }
.summary-person { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.summary-person > div { min-width: 0; }
.summary-person strong,
.summary-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-person strong { font-size: .86rem; }
.summary-person small { margin-top: 2px; color: var(--text-muted); font-size: .68rem; }
.summary-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    background: var(--accent);
    font-family: Georgia, serif;
    font-size: .7rem;
}
.hours-progress { height: 7px; overflow: hidden; border-radius: 8px; background: #e9e2d6; }
.hours-progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform-origin: left; animation: grow-bar .7s ease-out both; }
.summary-hours { font-family: Georgia, serif; font-size: 1rem; text-align: right; }
.summary-metrics {
    display: grid;
    justify-items: end;
    gap: .15rem;
    line-height: 1.15;
}
.summary-metrics > span { color: var(--text-muted); font-size: .7rem; }
.summary-metrics > span b { color: var(--accent); font-size: .78rem; }
.summary-metrics > small { color: #9a9388; font-size: .62rem; }

@keyframes flag-sway {
    from { transform: rotate(-4deg); }
    to { transform: rotate(5deg); }
}
@keyframes happy-dance {
    from { transform: translateY(0) rotate(-3deg); }
    to { transform: translateY(-9px) rotate(4deg); }
}
@keyframes confetti-fall {
    0% { transform: translateY(-20px) rotate(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateY(170px) rotate(280deg); opacity: 0; }
}
@keyframes grow-bar {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
    .bunting i, .party-person, .confetti, .hours-progress i { animation: none; }
}

@media (max-width: 800px) {
    .summary-grid { grid-template-columns: 1fr; }
    .celebration-card { grid-template-columns: 1fr 230px; }
}
@media (max-width: 600px) {
    .tabs-inner { overflow-x: auto; }
    .tab-btn { flex: 0 0 auto; margin-right: 1.2rem; }
    .celebration-card { grid-template-columns: 1fr; padding-bottom: 0; }
    .party-community { width: 220px; margin: 0 auto; }
    .summary-row {
        grid-template-columns: 28px 1fr auto;
        gap: .65rem;
        padding: .8rem;
    }
    .hours-progress { grid-column: 2 / 4; }
    .summary-metrics { grid-column: 3; grid-row: 1; }
    .ranking-heading { padding-inline: .8rem; }
}

/* ===== CELEBRAZIONE INCLUSIVA ===== */
.emp-avatar,
.summary-avatar {
    border: 2px solid #fff;
    box-shadow:
        0 0 0 2px var(--avatar-ring, #26786c),
        0 2px 8px rgba(32,32,29,.15);
}
.tone-0 { --avatar-ring: #d83b32; background: #8b2d62 !important; }
.tone-1 { --avatar-ring: #e58a25; background: #a04a27 !important; }
.tone-2 { --avatar-ring: #e7c735; background: #75641a !important; }
.tone-3 { --avatar-ring: #34865d; background: #286a55 !important; }
.tone-4 { --avatar-ring: #3979b9; background: #365c9a !important; }
.tone-5 { --avatar-ring: #8154a3; background: #68407f !important; }

.inclusion-slogan {
    display: inline-block;
    margin-top: .85rem;
    padding: .45rem .65rem;
    border-left: 4px solid #d83b32;
    background:
        linear-gradient(90deg,
            rgba(216,59,50,.12),
            rgba(229,138,37,.12),
            rgba(231,199,53,.12),
            rgba(52,134,93,.12),
            rgba(57,121,185,.12),
            rgba(129,84,163,.12));
    color: #49332f !important;
    font-size: .68rem !important;
    font-weight: 700;
    letter-spacing: .025em;
}

.bunting i:nth-child(1) { border-top-color: #d83b32; }
.bunting i:nth-child(2) { border-top-color: #e58a25; }
.bunting i:nth-child(3) { border-top-color: #e7c735; }
.bunting i:nth-child(4) { border-top-color: #34865d; }
.bunting i:nth-child(5) { border-top-color: #3979b9; }
.bunting i:nth-child(6) { border-top-color: #8154a3; }
.bunting i:nth-child(7) { border-top-color: #8b2d62; }

.party-community { width: 230px; }
.party-person { width: 62px; }
.party-person.person-one { left: 0; animation-name: happy-dance-left; }
.party-person.person-two { left: 84px; right: auto; animation-name: happy-dance-center; }
.party-person.person-three {
    right: 0;
    animation: happy-dance-right 1.05s ease-in-out -.3s infinite alternate;
}
.party-person.person-three .body { background: #8154a3; }
.party-person.person-three .head { background: #9a674b; }
.party-person.person-three .head::before {
    inset: -8px -7px auto;
    height: 19px;
    border-radius: 50%;
    background: #4a2c27;
}
.party-person.person-three .arm { background: #9a674b; }
.party-person.person-three .arm.left { transform: rotate(120deg); }
.party-person.person-three .arm.right { transform: rotate(-115deg); }
.person-one .head { background: #f3b18d; }
.person-two .head { background: #c98461; }
.person-two .head::before { border-radius: 45% 45% 0 0; background: #754b32; }
.person-one .body { background: #3979b9; }
.person-two .body { background: #d83b62; }

.pride-heart {
    position: absolute;
    top: 4px;
    left: 50%;
    z-index: 4;
    color: #b62e53;
    font-size: 1.4rem;
    text-shadow: 0 2px 0 rgba(255,255,255,.7);
    animation: heart-beat 1.4s ease-in-out infinite;
}
.confetti.c4 { left: 8%; top: 25px; background: #3979b9; animation-delay: -.4s; }
.confetti.c5 { right: 30%; top: -10px; background: #8154a3; animation-delay: -1.65s; }

@keyframes happy-dance-left {
    from { transform: translateY(0) rotate(-5deg); }
    to { transform: translateY(-12px) rotate(4deg); }
}
@keyframes happy-dance-center {
    from { transform: translateY(-4px) rotate(3deg); }
    to { transform: translateY(-15px) rotate(-3deg); }
}
@keyframes happy-dance-right {
    from { transform: translateY(-2px) rotate(5deg); }
    to { transform: translateY(-11px) rotate(-5deg); }
}
@keyframes heart-beat {
    0%, 100% { transform: translateX(-50%) scale(1); }
    45% { transform: translateX(-50%) scale(1.28) rotate(-5deg); }
}

@media (prefers-reduced-motion: reduce) {
    .pride-heart { animation: none; transform: translateX(-50%); }
}
