:root {
    --ink: #0B1622;
    --ink-soft: #142838;
    --paper: #0F1B28;
    --card: #16283A;
    --surface-soft: #1B2F42;
    --accent: #38BDF8;
    --accent-deep: #0EA5E9;
    --accent-ink: #06202E;
    --text-primary: #E7EEF6;
    --text-muted: #7E93A8;
    --line: #223449;
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.16);
    --success: #34D399;
    --success-soft: rgba(52, 211, 153, 0.16);
    --weekend: #E36B90;
    --stat-confirmed: #F2B84B;
    --stat-done: #34D399;
    --stat-canceled: #F87171;
    --heat-red: 248, 113, 113;
    --heat-yellow: 251, 191, 36;
    --heat-green: 52, 211, 153;
    --radius: 10px;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--ink);
    color: #D7E3EE;
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--line);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.brand-mark { color: var(--accent); font-size: 0.8rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #8FA3B8;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-index {
    font-family: var(--font-display);
    font-size: 0.72rem;
    color: #52667A;
    width: 20px;
}

.nav-item:hover { background: var(--ink-soft); color: #fff; }

.nav-item.is-active {
    background: var(--ink-soft);
    color: var(--accent);
}
.nav-item.is-active .nav-index { color: var(--accent); }

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    padding: 40px 48px;
    min-width: 0;
}

.page-head { margin-bottom: 14px; }

.page-eyebrow {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 6px;
}

.main-content h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin: 0;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.empty-state {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
}

.is-hidden { display: none !important; }

/* ---------- TABS PRINCIPALI: blocco durante la modifica ---------- */
.tabs.is-locked .tab-btn {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- EDIT VIEW (form concerto, senza box, larghezza piena) ---------- */
.edit-view { width: 100%; }

.edit-header { margin-bottom: 20px; }
.edit-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-primary);
}

/* ---------- TOOLBAR CONTABILITÀ (tutto su una riga) ---------- */
.accounting-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.accounting-toolbar h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 0;
    color: var(--text-primary);
    white-space: nowrap;
}
.accounting-toolbar #btn-new-movimento { margin-left: 0; }
.accounting-toolbar .accounting-summary { margin-left: auto; }

/* ---------- RIEPILOGO CONTABILITÀ ---------- */
.accounting-summary {
    display: flex;
    align-items: center;
    gap: 28px;
}
.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.summary-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.summary-value {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}
.summary-value.is-positive { color: var(--success); }
.summary-value.is-negative { color: var(--danger); }

.amount-in { color: var(--success); font-weight: 600; }
.amount-out { color: var(--danger); font-weight: 600; }

.edit-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.edit-sidenav {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--line);
    padding-right: 20px;
}

.edit-sidenav-item {
    text-align: left;
    background: none;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
}
.edit-sidenav-item:hover { background: var(--surface-soft); color: var(--text-primary); }
.edit-sidenav-item.is-active {
    background: rgba(56, 189, 248, 0.14);
    color: var(--accent);
    font-weight: 600;
}

.edit-content { flex: 1; min-width: 0; }

.edit-panel { display: none; }
.edit-panel.is-active { display: block; animation: fade-in 0.15s ease; }

.edit-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 12px 0;
}

.edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.field-row .field-small { flex: 0 0 190px; }

/* ---------- RIGHE DINAMICHE (Titolari / Sostituti) ---------- */
/* ---------- GRUPPI SOSTITUTI PER RUOLO ---------- */
.sostituti-group { margin-bottom: 20px; }
.sostituti-group:last-child { margin-bottom: 0; }

.sostituti-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.sostituti-group-title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.sostituti-group-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.dynamic-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.dynamic-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dynamic-row input[type="text"],
.dynamic-row select {
    flex: 1;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-primary);
}
.dynamic-row input[type="text"]:focus,
.dynamic-row select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.btn-row-remove {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.btn-row-remove:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ---------- PRESENZE CONCERTO (tabella: Ruolo / Titolare / Stato / Sostituto / Note) ---------- */
.stato-btn-group {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.stato-btn {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 9px;
    border: none;
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.stato-btn + .stato-btn { border-left: 1px solid var(--line); }
.stato-btn:hover:not(.is-active) { background: var(--surface-soft); color: var(--text-primary); }
.stato-btn.is-active { background: var(--accent); color: var(--accent-ink); }
.stato-btn.is-active[data-stato="attesa"] { background: var(--accent); color: var(--accent-ink); }
.stato-btn.is-active[data-stato="presente"] { background: var(--success); color: #062617; }
.stato-btn.is-active[data-stato="assente"] { background: #9CA9B8; color: #1B222B; }
.stato-btn.is-active[data-stato="in_forse"] { background: var(--danger); color: #2A0A0A; }
.stato-btn.is-active[data-stato="sostituito"] { background: rgb(var(--heat-yellow)); color: #3A2A00; }

.presenza-stato, .presenza-sostituto, .presenza-note {
    font-family: var(--font-body);
    font-size: 0.86rem;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-primary);
    width: 100%;
    max-width: 220px;
}
.presenza-note { max-width: 340px; min-width: 220px; }
.presenza-stato:focus, .presenza-sostituto:focus, .presenza-note:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

/* ---------- COMBOBOX (campo digitabile con ricerca) ---------- */
.combobox { position: relative; }

.combobox input[type="text"] {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-primary);
}
.combobox input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.combobox-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
}
.combobox-list.is-open { display: block; }

.combobox-option {
    padding: 9px 12px;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--text-primary);
}
.combobox-option:hover,
.combobox-option.is-highlighted { background: rgba(56, 189, 248, 0.14); }

.combobox-empty {
    padding: 10px 12px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.btn-link {
    display: inline-block;
    margin-top: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- TABS ---------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
}

.tab-btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    background: none;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    top: 1px;
}

.tab-btn.is-active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade-in 0.15s ease; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- TOOLBAR / BUTTONS ---------- */
.panel-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* ---------- DROPDOWN SELEZIONE VISTA (Elenco / Calendario) ---------- */
/* ---------- GRUPPO PULSANTI VISTA (Elenco / Calendario / Statistiche, solo icona) ---------- */
.view-btn-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: none;
    padding: 9px 14px;
    color: var(--text-muted);
    cursor: pointer;
}
.view-btn + .view-btn { border-left: 1px solid var(--line); }
.view-btn:hover:not(.is-active) { background: var(--surface-soft); color: var(--text-primary); }
.view-btn.is-active { background: var(--accent); color: var(--accent-ink); }

/* ---------- GRUPPO PULSANTI ANNO (visibile solo in vista Calendario) ---------- */
.year-btn-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.year-btn {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 14px;
    border: none;
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
}
.year-btn + .year-btn { border-left: 1px solid var(--line); }
.year-btn:hover:not(.is-active) { background: var(--surface-soft); color: var(--text-primary); }
.year-btn.is-active {
    background: var(--accent);
    color: var(--accent-ink);
}

.search-input {
    flex: 1;
    max-width: 340px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-primary);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}
.search-input::placeholder { color: var(--text-muted); }

/* In modalità calendario la ricerca lascia il posto al gruppo di pulsanti anno:
   viene rimossa dal flusso come qualsiasi altro elemento con .is-hidden. */

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.86rem;
    border-radius: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-deep); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text-primary); }

.row-actions {
    display: flex;
    justify-content: flex-end;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    width: fit-content;
    margin-left: auto;
}

.btn-text-action {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    white-space: nowrap;
}
.btn-text-action + .btn-text-action { border-left: 1px solid var(--line); }
.btn-text-action:hover { background: var(--surface-soft); color: var(--text-primary); }
.btn-text-action.danger { color: var(--danger); }
.btn-text-action.danger:hover { background: var(--danger-soft); }

/* ---------- TABLE ---------- */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

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

.data-table thead th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-soft);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    color: var(--text-primary);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table-loading, .table-empty { text-align: center; color: var(--text-muted); padding: 24px; }

.badge {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}
.badge-online { background: var(--success-soft); color: var(--success); }
.badge-offline { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.badge-pending { background: rgba(56, 189, 248, 0.14); color: var(--accent); }
.badge-warning { background: rgba(251, 191, 36, 0.16); color: rgb(var(--heat-yellow)); }
.badge-expired { background: var(--danger-soft); color: var(--danger); }

/* ---------- BADGE RIEPILOGO PRESENZE (elenco concerti) ---------- */
.presenze-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.badge-sostituito { background: rgba(251, 191, 36, 0.16); color: rgb(var(--heat-yellow)); cursor: default; }
.badge-in-forse { background: var(--danger-soft); color: var(--danger); cursor: default; }
.badge-assente { background: rgba(156, 169, 184, 0.18); color: #9CA9B8; cursor: default; }
.badge-attesa { background: rgba(56, 189, 248, 0.14); color: var(--accent); cursor: default; }

.cell-muted { color: var(--text-muted); font-size: 0.82rem; }

.data-table td a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 2px;
}
.data-table td a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- MODAL ---------- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 14, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; color: var(--text-primary); }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px 22px; overflow-y: auto; }

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

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

.field input, .field select, .field textarea {
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-primary);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

/* ---------- TOAST ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.86rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 200;
    max-width: 320px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}
.toast.is-error { background: var(--danger); border-color: var(--danger); color: #2A0A0A; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- CALENDARIO ANNUALE ---------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.month-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

.month-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 12px;
    background: var(--ink);
    color: var(--text-primary);
}

.month-count {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    background: rgba(255,255,255,0.14);
    color: var(--accent);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    margin-left: auto;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.month-day-label {
    text-align: center;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    padding: 7px 0 5px;
    background: var(--surface-soft);
}

.day-cell {
    text-align: center;
    font-size: 0.78rem;
    padding: 6px 0;
    color: var(--text-primary);
    background: var(--card);
}
.day-cell.is-empty { color: transparent !important; background: var(--card); }
.day-cell:not(.is-empty) { cursor: pointer; }
.day-cell:not(.is-empty):hover { background: var(--surface-soft); }
.day-cell.has-gig {
    background: var(--success-soft);
    color: var(--success);
    font-weight: 700;
}
.day-cell.has-gig:hover { background: var(--success); color: var(--accent-ink); }

/* Sabato (colonna 6) e domenica (colonna 7) in bordeaux, sia nell'header che nei giorni */
.month-grid > *:nth-child(7n+6):not(.has-gig),
.month-grid > *:nth-child(7n):not(.has-gig) {
    color: var(--weekend);
    font-weight: 700;
}

/* ---------- TOOLTIP RIEPILOGO CONCERTO ---------- */
.calendar-tooltip {
    position: fixed;
    z-index: 150;
    width: 250px;
    max-width: calc(100vw - 24px);
    background: var(--ink);
    border: 1px solid var(--line);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px;
    font-size: 0.8rem;
    box-shadow: 0 16px 34px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
}
.calendar-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.tooltip-entry { padding: 7px 6px; border-radius: 6px; cursor: pointer; }
.tooltip-entry:hover { background: rgba(255,255,255,0.10); }
.tooltip-entry + .tooltip-entry { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 4px; }
.tooltip-date {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 3px;
}
.tooltip-meta { display: block; color: #A9BBCC; font-size: 0.76rem; line-height: 1.4; }

.tooltip-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.tooltip-action-btn {
    flex: 1;
    border: none;
    border-radius: 6px;
    padding: 5px 8px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}
.tooltip-action-btn.is-confirm { background: rgba(52, 211, 153, 0.28); }
.tooltip-action-btn.is-confirm:hover { background: rgba(52, 211, 153, 0.45); }
.tooltip-action-btn.is-absent { background: rgba(248, 113, 113, 0.28); }
.tooltip-action-btn.is-absent:hover { background: rgba(248, 113, 113, 0.45); }

@media (max-width: 1100px) {
    .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .calendar-grid { grid-template-columns: 1fr; }
}

/* ---------- TABELLA STATISTICHE ---------- */
.stats-col-anno { width: 90px; }

.stats-head { text-align: center; color: #12141a; font-weight: 700; }
.stats-head-confirmed { background: var(--stat-confirmed); }
.stats-head-done { background: var(--stat-done); color: #0B2318; }
.stats-head-canceled { background: var(--stat-canceled); color: #fff; }
.stats-head-financial { background: var(--accent); color: var(--accent-ink); }
.stats-col-divider { border-left: 3px solid var(--paper); }

.stats-table td { text-align: center; }
.stats-table td.stats-col-anno { text-align: left; font-weight: 700; }
.stats-table td.stats-col-divider { border-left: 3px solid var(--paper); }

.stats-cell-confirmed { color: var(--stat-confirmed); font-weight: 700; }
.stats-cell-done { color: var(--stat-done); font-weight: 700; }

.stats-total-row td {
    font-weight: 700;
    border-top: 2px solid var(--line);
    background: var(--surface-soft);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 780px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 16px 20px; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; }
    .main-content { padding: 24px 20px; }
    .field-row { flex-direction: column; }
    .edit-layout { flex-direction: column; }
    .edit-sidenav {
        flex: 0 0 auto;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 12px;
    }
}
