    :root {
      --primary: #4f46e5; --primary-light: #818cf8; --primary-dark: #3730a3;
      --success: #059669; --danger: #dc2626; --warning: #d97706;
      /* Sfondo pagina: stessa intensità della barra titolo dashboard (indaco pieno). */
      --bg: #3730a3;
      --page-bg-gradient: linear-gradient(
        135deg,
        var(--primary-dark) 0%,
        var(--primary) 50%,
        var(--primary-light) 100%
      );
      /* Nessun velo: manteniamo la saturazione dell'indaco come nella barra titolo. */
      --page-bg-veil: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 100%
      );
      --surface: #ffffff; --surface-alt: #f8fafc;
      --border: #e2e8f0; --text: #1e293b; --text-muted: #64748b; --text-light: #94a3b8;
      /* Suggerimenti vuoti: più chiari del testo inserito */
      --placeholder: #b8c4d4;
      --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
      --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
      --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
      --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
      --transition: .2s cubic-bezier(.4,0,.2,1);
    }
    * { box-sizing: border-box; margin: 0; }
    body {
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      color: var(--text);
      min-height: 100vh;
      background-color: var(--bg);
      background-image: var(--page-bg-veil), var(--page-bg-gradient);
      background-attachment: fixed;
    }

    /* Date in testo gg/mm/aaaa (allineato alle etichette IT, senza locale browser su type=date) */
    input.input-date-it {
      font-variant-numeric: tabular-nums;
      min-width: 10rem;
      max-width: 100%;
    }

    /* HEADER */
    /* Header trasparente: eredita il gradiente del body (stesso --page-bg-gradient) → nessuna "giuntura" di colore con l'area sotto. */
    .header { background: transparent; color: #fff; padding: 1.5rem 2rem 1rem; box-shadow: none; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
    .header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
    .header-logo { height: 40px; width: auto; max-width: 140px; object-fit: contain; filter: brightness(0) invert(1); flex-shrink: 0; }
    .header-print-badge { font-size: .8rem; color: rgba(255,255,255,.95); text-decoration: none; font-weight: 600; padding: .35rem .6rem; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; white-space: nowrap; margin-right: .5rem; }
    .header-print-badge:hover { background: rgba(255,255,255,.15); }
    .header-brand { display: flex; align-items: center; gap: 1rem; }
    .header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .15rem; }
    .header p { font-size: .85rem; opacity: .8; }

    /* MAIN CONTAINER */
    .container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem 2rem; }

    /* SELECTOR BAR */
    .selector-bar { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 1rem 1.25rem; margin-top: -1.5rem; position: relative; z-index: 10; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
    .selector-bar .label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: .25rem; }

    /* FILTER CARD (es. sezione Timbrature) */
    .filter-card { margin-bottom: 1rem; }
    .filter-row { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-end; }
    .filter-group { display: flex; flex-direction: column; gap: .25rem; }
    .filter-group .label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
    .filter-group-employee { flex: 1; min-width: 220px; }
    .filter-group-employee select { width: 100%; max-width: 320px; }

    /* COMPANY CHIPS */
    .company-chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
    .chip { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .9rem; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .82rem; font-weight: 500; cursor: pointer; transition: all var(--transition); user-select: none; }
    .chip:hover { border-color: var(--primary-light); color: var(--primary); background: #eef2ff; }
    .chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
    .chip img.chip-logo { height: 20px; width: auto; object-fit: contain; flex-shrink: 0; }
    .chip.active img.chip-logo { filter: brightness(0) invert(1); }
    /* Solo logo, senza etichetta testuale accanto */
    .chip:has(> img.chip-logo:only-child) { padding: .35rem .65rem; gap: 0; }
    .chip .chip-name { display: block; font-weight: 700; }
    .chip .chip-sub { display: block; font-size: .7rem; opacity: .9; font-weight: 500; }

    /* SELECT */
    select { appearance: none; background: var(--surface-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6 6.5-6'/%3E%3C/svg%3E") no-repeat right .75rem center; padding: .5rem 2.2rem .5rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius-xs); font-size: .9rem; font-family: inherit; color: var(--text); cursor: pointer; transition: border-color var(--transition); min-width: 220px; }
    select:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }

    /* SELECT FILTRABILE (combobox: digita per filtrare) */
    .select-filterable-wrap { position: relative; min-width: 220px; width: 100%; max-width: 320px; }
    .select-filterable-wrap select { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
    .select-filterable-input { width: 100%; box-sizing: border-box; appearance: none; background: var(--surface-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6 6.5-6'/%3E%3C/svg%3E") no-repeat right .75rem center; padding: .5rem 2.2rem .5rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius-xs); font-size: .9rem; font-family: inherit; color: var(--text); transition: border-color var(--transition); }
    .select-filterable-input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
    .select-filterable-dropdown { display: none; position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-xs); box-shadow: var(--shadow); z-index: 100; }
    .select-filterable-dropdown.open { display: block; }
    .select-filterable-option { padding: .5rem .75rem; cursor: pointer; font-size: .9rem; color: var(--text); }
    .select-filterable-option:hover { background: #eef2ff; color: var(--primary); }
    .select-filterable-option.hidden { display: none; }

    /* Timbrature con orario rettificato (storico HR) */
    /* Giorno corrente (calendario allineato al fuso Europe/Rome come nel JS) */
    .cal-day.cal-day-today:not(.cal-empty) {
      border-color: var(--primary);
      border-width: 2px;
      box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.35), var(--shadow);
      z-index: 1;
    }
    .cal-day.cal-day-today:not(.cal-empty):hover {
      box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.45), var(--shadow-md);
    }
    .cal-day.cal-day-today .cal-day-num {
      color: var(--primary-dark);
    }
    .cal-day.cal-day-today .cal-day-num::after {
      content: ' · oggi';
      font-size: 0.62em;
      font-weight: 700;
      color: var(--primary);
      letter-spacing: 0.02em;
    }
    .cal-day.cal-day-today.cal-day-has-correction:not(.cal-empty) {
      box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.35), var(--shadow), inset 0 -3px 0 #7c3aed;
    }
    .cal-day.cal-day-today.cal-day-has-correction:not(.cal-empty):hover {
      box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.45), var(--shadow-md), inset 0 -3px 0 #7c3aed;
    }

    .cal-day-has-correction { box-shadow: inset 0 -3px 0 #7c3aed; }
    .cal-day-correction-hint {
      font-size: .62rem; font-weight: 700; color: #5b21b6; margin-top: .2rem; letter-spacing: .02em;
    }
    .day-entries-table tr.day-entry-corrected > td {
      background: linear-gradient(90deg, rgba(124, 58, 237, .09), transparent 70%);
    }
    .day-entry-correction-badge {
      display: inline-block; font-size: .58rem; font-weight: 800; padding: .12rem .32rem; border-radius: 4px;
      background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; white-space: nowrap;
      vertical-align: middle;
    }
    .corr-detail-modal .corr-detail-section { margin-bottom: 1rem; font-size: .85rem; }
    .corr-detail-modal .corr-detail-section h4 { font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .04em; }
    .corr-detail-modal table { width: 100%; border-collapse: collapse; font-size: .78rem; }
    .corr-detail-modal th, .corr-detail-modal td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
    .corr-detail-modal th { color: var(--text-muted); font-weight: 600; }

    /* TABS */
    /* Nav tab sopra fondo indaco: bianchi leggibili, pill chiara "vetro" per hover/active. */
    .nav-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.25rem; padding: .25rem; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
    .nav-tab { padding: .55rem 1.1rem; border-radius: 8px; border: none; background: transparent; color: rgba(255, 255, 255, 0.88); font-size: .88rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all var(--transition); position: relative; letter-spacing: .01em; }
    .nav-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
    .nav-tab.active { color: var(--primary-dark); background: #fff; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9); }
    .nav-tab.active:hover { color: var(--primary-dark); background: #fff; }
    .approval-menu-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 1.25rem;
      height: 1.25rem;
      padding: 0 .35rem;
      border-radius: 999px;
      background: #dc2626;
      color: #fff;
      font-size: .68rem;
      font-weight: 800;
      line-height: 1;
      box-shadow: 0 0 0 2px rgba(255,255,255,.85);
    }
    .approval-login-notice {
      margin: 0 0 1rem;
      padding: .8rem 1rem;
      border: 1.5px solid #f59e0b;
      border-left-width: 4px;
      border-radius: var(--radius-sm);
      background: #fffbeb;
      color: #92400e;
      font-size: .88rem;
      font-weight: 600;
      box-shadow: var(--shadow);
    }
    .approval-login-notice button {
      margin-left: .75rem;
      padding: .28rem .65rem;
      font-size: .76rem;
      background: #f59e0b;
      color: #fff;
    }

    /* PANELS / CARDS */
    .panel { display: none; margin-top: 1rem; }
    .panel.active { display: block; }
    .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
    .card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
    .card-title .icon { width: 28px; height: 28px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; font-size: .9rem; }

    /* BUTTONS */
    button, .btn { font-family: inherit; font-size: .85rem; font-weight: 600; padding: .5rem 1.1rem; border: none; border-radius: var(--radius-xs); cursor: pointer; transition: all var(--transition); display: inline-flex; align-items: center; gap: .4rem; }
    .btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
    .btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
    .btn-success { background: var(--success); color: #fff; }
    .btn-success:hover { background: #047857; }
    .btn-danger { background: var(--danger); color: #fff; }
    .btn-danger:hover { background: #b91c1c; }
    .btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
    .btn-ghost:hover { border-color: var(--primary-light); color: var(--primary); }
    .btn-link { background: none; color: var(--primary); padding: 0 .35rem; font-weight: 500; box-shadow: none; }
    .btn-link:hover { text-decoration: underline; }
    button:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

    /* INPUTS */
    input[type=text], input[type=password], input[type=email], input[type=search], input[type=url], input[type=number], input[type=date], input[type=month], textarea {
      font-family: inherit; font-size: .9rem; padding: .5rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-alt); color: var(--text); transition: border-color var(--transition);
    }
    textarea { line-height: 1.45; resize: vertical; min-height: 2.5rem; }
    input::placeholder,
    textarea::placeholder {
      color: var(--placeholder);
      opacity: 1;
    }
    input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
    textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

    /* FORM */
    .form-grid { display: grid; grid-template-columns: 130px 1fr; gap: .6rem .75rem; align-items: center; max-width: 480px; }
    .form-grid label { font-size: .82rem; font-weight: 500; color: var(--text-muted); text-align: right; }
    .form-grid input, .form-grid select { width: 100%; }
    .ws-calc-preview {
      margin-top: .5rem;
      max-width: 480px;
      padding: .55rem .65rem;
      background: var(--surface-alt);
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
      font-size: .82rem;
      line-height: 1.45;
    }
    .ws-calc-preview-title { font-weight: 700; margin-bottom: .28rem; color: var(--text); font-size: .84rem; }
    .ws-calc-preview-row { color: var(--text); }
    .ws-calc-preview-total { margin-top: .25rem; padding-top: .4rem; border-top: 1px dashed var(--border); }
    .ws-calc-preview-hint { font-weight: 500; color: var(--text-muted); font-size: .72rem; }

    /* TABLE */
    table { width: 100%; border-collapse: separate; border-spacing: 0; }
    th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: .6rem .75rem; background: var(--surface-alt); border-bottom: 1.5px solid var(--border); text-align: left; }
    th:first-child { border-radius: var(--radius-xs) 0 0 0; }
    th:last-child { border-radius: 0 var(--radius-xs) 0 0; }
    td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); font-size: .85rem; }
    tr:last-child td { border-bottom: none; }
    tr:hover td { background: #f8fafc; }

    /* Tabella Admin dipendenti — ordinamento colonne */
    .admin-emp-table th.admin-emp-th-sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
      transition: background 0.15s ease, color 0.15s ease;
    }
    .admin-emp-table th.admin-emp-th-sortable:hover {
      background: #e2e8f0;
      color: var(--text);
    }
    .admin-emp-table th.admin-emp-th-sortable:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: -2px;
    }
    .admin-emp-table th.admin-emp-th-sortable .admin-emp-sort-ind {
      display: inline-block;
      min-width: 0.85em;
      margin-left: 0.15em;
      font-size: 0.68em;
      vertical-align: middle;
      opacity: 0.4;
    }
    .admin-emp-table th.admin-emp-th-sortable.sorted-asc .admin-emp-sort-ind::after {
      content: '\25B2';
      opacity: 0.95;
    }
    .admin-emp-table th.admin-emp-th-sortable.sorted-desc .admin-emp-sort-ind::after {
      content: '\25BC';
      opacity: 0.95;
    }

    /* TOAST — slot ad altezza fissa: i messaggi non spostano tab e contenuti sotto */
    .toast-slot { position: relative; width: 100%; min-height: 3rem; margin-bottom: .35rem; }
    .toast {
      position: fixed;
      top: 1rem;
      right: 1rem;
      padding: .75rem 1.25rem;
      border-radius: var(--radius-sm);
      font-size: .85rem;
      font-weight: 500;
      box-shadow: var(--shadow-lg);
      z-index: 30000;
      display: none;
      animation: slideIn .25s ease-out;
      max-width: min(400px, calc(100vw - 2rem));
    }
    .toast.ok { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
    .toast.err { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
    @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

    /* CALENDAR */
    .cal-nav { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
    .cal-nav .nav-arrow { width: 36px; height: 36px; padding: 0; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-alt); border: 1.5px solid var(--border); color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
    .cal-nav .nav-arrow:hover { border-color: var(--primary); color: var(--primary); background: #eef2ff; }
    .cal-month-label { font-size: 1rem; font-weight: 700; min-width: 160px; text-align: center; }
    .cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 3px; }
    .cal-weekdays span { padding: .4rem; text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-light); }
    .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
    /* Selettore modalità calendario (Semplice / Dettaglio) */
    .cal-mode-toggle {
      display: inline-flex;
      align-items: stretch;
      margin-left: auto;
      padding: 3px;
      background: var(--surface-alt, #f1f5f9);
      border: 1.5px solid var(--border);
      border-radius: 999px;
      gap: 2px;
    }
    .cal-mode-btn {
      appearance: none;
      border: none;
      background: transparent;
      color: var(--text-muted);
      font-family: inherit;
      font-size: .8rem;
      font-weight: 600;
      letter-spacing: .01em;
      padding: .4rem .9rem;
      border-radius: 999px;
      cursor: pointer;
      transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    }
    .cal-mode-btn:hover { color: var(--text); background: rgba(15,23,42,.05); }
    .cal-mode-btn[aria-selected="true"] {
      background: var(--primary);
      color: #fff;
      box-shadow: 0 2px 6px rgba(15,23,42,.18);
    }
    .cal-mode-btn[aria-selected="true"]:hover { background: var(--primary-dark, var(--primary)); color: #fff; }
    .cal-mode-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
    /* Modalità SEMPLICE: nasconde dettagli, ingrandisce ore lavorate, assenze e chip team */
    .cal-mode-simple .cal-schedule-badge,
    .cal-mode-simple .cal-day-times-row,
    .cal-mode-simple .cal-day-correction-hint,
    .cal-mode-simple .cal-day-da-validare,
    .cal-mode-simple .cal-day-anomaly-icon { display: none !important; }
    .cal-mode-simple .cal-day-num { font-size: clamp(0.75rem, 3.6cqw + 0.32rem, 1rem); font-weight: 800; }
    .cal-mode-simple .cal-day-label {
      font-size: clamp(0.66rem, 3.6cqw + 0.3rem, 0.92rem) !important;
      font-weight: 800;
      padding: 3px 6px;
      letter-spacing: .03em;
      margin-bottom: 3px;
    }
    .cal-mode-simple .cal-day-total {
      font-size: clamp(1rem, 5.4cqw + 0.4rem, 1.5rem) !important;
      padding: 6px 12px;
      align-self: center;
      width: auto;
      box-shadow: 0 1px 4px rgba(15,23,42,.08);
    }
    .cal-mode-simple .cal-day-team {
      margin-top: auto;
      padding-top: 6px;
      max-height: none;
      gap: 5px;
    }
    .cal-mode-simple .cal-team-chip {
      font-size: clamp(0.7rem, 3.4cqw + 0.28rem, 0.92rem) !important;
      font-weight: 800;
      padding: 3px 9px 3px 3px;
      border-radius: 999px;
    }
    .cal-mode-simple .cal-team-chip .avatar {
      width: clamp(24px, 6.6cqw + 10px, 32px);
      height: clamp(24px, 6.6cqw + 10px, 32px);
      font-size: clamp(0.72rem, 2.8cqw + 0.22rem, 0.85rem);
    }
    .cal-mode-simple .cal-team-more {
      font-size: clamp(0.7rem, 3.2cqw + 0.24rem, 0.88rem) !important;
      font-weight: 800;
    }
    .cal-mode-simple .cal-day { min-height: 132px; }
    @media (max-width: 600px) {
      .cal-mode-toggle { margin-left: 0; }
      .cal-mode-btn { padding: .35rem .7rem; font-size: .76rem; }
    }
    /* Font che seguono la larghezza della cella (container query) */
    .cal-day {
      position: relative;
      container-type: inline-size;
      container-name: calcell;
      min-height: 118px;
      padding: .3rem .32rem;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      font-size: clamp(0.58rem, 3.2cqw + 0.28rem, 0.8rem);
      background: var(--surface);
      transition: box-shadow var(--transition), transform var(--transition);
      cursor: pointer;
      user-select: none;
    }
    /* Distribuisce lo spazio verticale: il totale ore resta in basso nella cella */
    .cal-day:not(.cal-empty) {
      display: flex;
      flex-direction: column;
      align-items: stretch;
    }
    /* Profilo orario effettivo (standard vs alternativo su periodo): codice in alto a destra */
    .cal-schedule-badge {
      position: absolute;
      top: 3px;
      right: 4px;
      z-index: 2;
      font-size: clamp(0.42rem, 2.6cqw + 0.16rem, 0.58rem);
      font-weight: 800;
      letter-spacing: 0.02em;
      line-height: 1;
      padding: 2px 4px;
      border-radius: 3px;
      border: 1px solid transparent;
      pointer-events: auto;
    }
    .cal-schedule-badge-default {
      background: #e2e8f0;
      color: #475569;
      border-color: #cbd5e1;
    }
    .cal-schedule-badge-default::before {
      content: '\25cb\00a0';
      font-size: 0.85em;
      opacity: 0.9;
    }
    .cal-schedule-badge-override {
      background: #fef3c7;
      color: #92400e;
      border-color: #fcd34d;
    }
    .cal-schedule-badge-override::before {
      content: '\25c6\00a0';
      font-size: 0.85em;
      opacity: 0.95;
    }
    .cal-day:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
    .cal-day:active:not(.cal-empty) { transform: scale(.97); }
    .cal-day.nonworking { background: #f1f5f9; border-color: #e2e8f0; color: var(--text-light); }
    .cal-day.ungranted-holiday { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #f59e0b; color: #92400e; }
    .cal-day.ungranted-holiday .cal-day-label { background: rgba(245,158,11,.15); font-size: .58rem; }
    /* Ferie: giallo */
    .cal-day.ferie { background: linear-gradient(135deg, #fffbeb, #fef08a); border-color: #eab308; color: #a16207; }
    .cal-day.malattia { background: linear-gradient(135deg, #fef2f2, #fee2e2); border-color: #fca5a5; color: #991b1b; }
    /* Permessi: arancio chiaro */
    .cal-day.permesso { background: linear-gradient(135deg, #fff7ed, #ffedd5); border-color: #fb923c; border-width: 2px; box-shadow: 0 0 0 2px rgba(251,146,60,.18); color: #c2410c; }
    .cal-day.congedo { background: linear-gradient(135deg, #faf5ff, #f3e8ff); border-color: #c084fc; color: #6b21a8; }
    .cal-day.altro-abs { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #86efac; color: #166534; }
    /* Trasferta: azzurro */
    .cal-day.trasferta { background: linear-gradient(135deg, #f0f9ff, #bae6fd); border-color: #0ea5e9; border-width: 2px; box-shadow: 0 0 0 2px rgba(14,165,233,.22); color: #0369a1; }
    .cal-day.permesso.trasferta { background: linear-gradient(120deg, #ffedd5 0%, #ffedd5 48%, #e0f2fe 52%, #bae6fd 100%); border-color: #0ea5e9; box-shadow: 0 0 0 2px rgba(14,165,233,.2); color: #0369a1; }
    .cal-day-num { font-weight: 800; font-size: clamp(0.68rem, 4cqw + 0.2rem, 0.85rem); margin-bottom: 1px; line-height: 1.1; }
    .cal-day-label { font-size: clamp(0.48rem, 2.8cqw + 0.22rem, 0.6rem); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; opacity: .85; padding: 1px 3px; border-radius: 3px; display: inline-block; margin-bottom: 1px; line-height: 1.15; }
    .cal-day.ferie .cal-day-label { background: rgba(234,179,8,.22); }
    .cal-day.malattia .cal-day-label { background: rgba(220,38,38,.1); }
    .cal-day.permesso .cal-day-label { background: rgba(251,146,60,.2); }
    .cal-day.congedo .cal-day-label { background: rgba(192,132,252,.15); }
    .cal-day.altro-abs .cal-day-label { background: rgba(34,197,94,.1); }
    /* Icone simboliche per le assenze (rese inline nel testo della label) */
    .cal-abs-icon { display: inline-block; font-weight: 900; line-height: 1; vertical-align: -1px; margin-right: 1px; }
    .cal-abs-icon-malattia { color: #dc2626; text-shadow: 0 0 1px rgba(220,38,38,.35); }
    .cal-abs-icon-ferie { color: #d97706; }
    .cal-abs-icon-permesso { color: #c2410c; font-weight: 700; }
    /* In modalità semplice le icone seguono la dimensione delle label */
    .cal-mode-simple .cal-abs-icon { font-size: inherit; }
    /* Trasferta: niente sfondo colorato sulla label (la label dedicata non viene più generata).
       L'unica indicazione è il simbolino "✈" davanti al numero del giorno, qui sotto. */
    .cal-day.trasferta .cal-day-num::before { content: '\2708\00a0'; font-size: .75rem; }
    .cal-day-team {
      margin-top: 4px;
      display: flex;
      flex-wrap: wrap;
      gap: 3px;
      align-items: center;
      max-height: 3.2em;
      overflow: hidden;
      line-height: 1.1;
    }
    .cal-team-chip {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: clamp(0.55rem, 2.6cqw + 0.22rem, 0.7rem);
      font-weight: 700;
      padding: 1px 5px 1px 1px;
      border-radius: 12px;
      white-space: nowrap;
      max-width: 100%;
      line-height: 1;
    }
    .cal-team-chip .avatar {
      width: clamp(18px, 5.5cqw + 8px, 26px);
      height: clamp(18px, 5.5cqw + 8px, 26px);
      font-size: clamp(0.6rem, 2.2cqw + 0.18rem, 0.72rem);
      border: 1px solid rgba(0,0,0,0.08);
    }
    .cal-team-chip-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: clamp(13px, 3.4cqw + 5px, 16px);
      height: clamp(13px, 3.4cqw + 5px, 16px);
      border-radius: 50%;
      font-size: clamp(0.5rem, 2cqw + 0.18rem, 0.62rem);
      font-weight: 800;
      color: #fff;
      margin-left: -7px;
      border: 1px solid #fff;
    }
    .cal-team-chip-hrs { font-size: clamp(0.52rem, 2.2cqw + 0.18rem, 0.66rem); font-weight: 800; font-variant-numeric: tabular-nums; padding-right: 2px; }
    .cal-team-chip.cal-team-f { background: rgba(234, 179, 8, 0.35); color: #713f12; }
    .cal-team-chip.cal-team-f .cal-team-chip-badge { background: #ca8a04; }
    .cal-team-chip.cal-team-p { background: rgba(251, 146, 60, 0.35); color: #7c2d12; }
    .cal-team-chip.cal-team-p .cal-team-chip-badge { background: #ea580c; }
    /* Badge come icona (☀/⏱): un filo più grande, peso normale, font-feature pulito */
    .cal-team-chip-badge-ferie,
    .cal-team-chip-badge-permesso {
      font-size: clamp(0.62rem, 2.2cqw + 0.22rem, 0.78rem);
      font-weight: 700;
      line-height: 1;
    }
    .cal-team-more { font-size: clamp(0.52rem, 2.4cqw + 0.18rem, 0.66rem); font-weight: 800; color: var(--text-muted); padding: 0 2px; align-self: center; }
    /* Avatar extra-piccolo per chip calendario */
    .avatar-xxs { width: 22px; height: 22px; }
    .avatar-placeholder.avatar-xxs { font-size: .65rem; }
    /* Lista colleghi in assenza nel dettaglio giornata */
    .day-team-abs {
      margin-top: .6rem;
      margin-bottom: .6rem;
      padding: .5rem .6rem;
      background: #fafafa;
      border: 1px solid var(--border);
      border-radius: var(--radius-xs);
    }
    .day-team-abs-title {
      font-size: .78rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: .4rem;
    }
    .day-team-abs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem .5rem; }
    .day-team-row {
      display: flex;
      align-items: center;
      gap: .4rem;
      padding: .25rem .4rem;
      border-radius: var(--radius-xs);
      border: 1px solid transparent;
      background: #fff;
      font-size: .78rem;
      min-width: 0;
    }
    .day-team-row-f { background: #fefce8; border-color: #fde68a; }
    .day-team-row-p { background: #fff7ed; border-color: #fed7aa; }
    .day-team-row-av { flex: 0 0 auto; display: inline-flex; }
    .day-team-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.2; }
    .day-team-row-name { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .day-team-row-meta { font-size: .68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .day-team-row-badge {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px; height: 20px;
      border-radius: 50%;
      font-weight: 800;
      font-size: .7rem;
      color: #fff;
    }
    .day-team-row-f .day-team-row-badge { background: #ca8a04; }
    .day-team-row-p .day-team-row-badge { background: #ea580c; }
    .day-team-row-badge-ferie,
    .day-team-row-badge-permesso { font-size: .82rem; font-weight: 700; line-height: 1; }
    .cal-day-times-row {
      display: flex;
      align-items: flex-start;
      gap: 0.06rem;
      margin-top: 3px;
      flex: 1 1 auto;
      min-height: 0;
    }
    .cal-day-times-col { flex: 1; min-width: 0; }
    .cal-day-times-applied-col { flex: 1.12; min-width: 0; }
    .cal-day-times-raw-col { flex: 1; min-width: 0; text-align: right; }
    .cal-day-times-lbl {
      display: block;
      font-size: clamp(0.52rem, 2.9cqw + 0.22rem, 0.72rem);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .02em;
      color: var(--text-muted);
      opacity: .9;
      margin-bottom: 2px;
      line-height: 1.15;
    }
    .cal-day-times-raw-col .cal-day-times-lbl { text-align: right; }
    .cal-day-times {
      font-size: clamp(0.58rem, 4.1cqw + 0.24rem, 0.84rem);
      line-height: 1.28;
      font-variant-numeric: tabular-nums;
    }
    .cal-day-times-applied { color: var(--text); font-weight: 600; }
    .cal-day-times-raw { color: var(--text-muted); opacity: .88; font-size: clamp(0.54rem, 3.7cqw + 0.22rem, 0.8rem); }
    .cal-day-times-raw-col .cal-day-times { text-align: right; }
    /* Fascia: riga orari + riga ore (h) sempre visibile, font legati alla larghezza cella */
    .cal-day-slot {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 1px;
      max-width: 100%;
      line-height: 1.2;
      font-variant-numeric: tabular-nums;
    }
    .cal-day-times-raw-col .cal-day-slot { align-items: flex-end; }
    .cal-day-slot-times {
      display: block;
      max-width: 100%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: clamp(0.56rem, 3.85cqw + 0.22rem, 0.8rem);
      font-weight: 600;
    }
    .cal-day-slot-dur {
      display: block;
      font-size: clamp(0.5rem, 3.35cqw + 0.2rem, 0.74rem);
      font-weight: 700;
      opacity: .88;
      letter-spacing: 0.01em;
    }
    .cal-day-slot-applied .cal-day-slot-dur { color: var(--primary); }
    .cal-day-slot-raw .cal-day-slot-dur { color: var(--text-muted); font-weight: 600; opacity: .95; }
    .cal-day-slot + .cal-day-slot { margin-top: 5px; }
    .cal-day-slot-applied {
      border-left: 2px solid var(--primary);
      padding-left: 4px;
      margin-left: 0;
    }
    .cal-day-slot-raw {
      border-left: 2px solid #cbd5e1;
      padding-left: 4px;
      margin-left: 0;
    }
    .cal-day-slot-empty { opacity: .5; font-weight: 500; }
    @media (max-width: 1100px) {
      .cal-day-times-row { flex-direction: column; gap: .4rem; align-items: stretch; }
      .cal-day-times-raw-col { text-align: left; }
      .cal-day-times-raw-col .cal-day-times-lbl { text-align: left; }
      .cal-day-times-raw-col .cal-day-times { text-align: left; }
    }
    .day-applied-ranges { padding: .4rem .5rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-xs); }
    .day-entries-raw { opacity: .9; }
    .cal-day-total {
      margin-top: auto;
      align-self: flex-start;
      font-weight: 800;
      font-size: clamp(0.66rem, 3.75cqw + 0.26rem, 0.9rem);
      padding: 3px 6px;
      border-radius: 4px;
      display: inline-block;
      line-height: 1.2;
    }
    .cal-day-total.hours-ok { background: #d1fae5; color: #065f46; }
    .cal-day-total.hours-over { background: #a7f3d0; color: #047857; font-weight: 700; }
    .cal-day-total.hours-short { background: #fee2e2; color: #991b1b; }
    .cal-day-total.hours-nw { background: #e2e8f0; color: #64748b; }
    .cal-day.day-overtime { border-color: #059669; border-width: 2px; box-shadow: 0 0 0 2px rgba(5,150,105,.15); }
    .cal-day.day-deficit { border-color: #dc2626; border-width: 2px; box-shadow: 0 0 0 2px rgba(220,38,38,.15); }
    /* Problematiche / da validare: rosso */
    .cal-day.day-requires-validation { border-color: #dc2626 !important; border-width: 2px; box-shadow: 0 0 0 2px rgba(220,38,38,.28); }
    .cal-day-da-validare { font-size: clamp(0.44rem, 2.5cqw + 0.2rem, 0.58rem); font-weight: 700; letter-spacing: .02em; color: #991b1b; background: rgba(254,202,202,.95); padding: 1px 3px; border-radius: 3px; margin-top: 2px; display: inline-block; border: 1px solid rgba(220,38,38,.25); line-height: 1.15; }
    .cal-day.anomaly { border-color: #f97316 !important; border-width: 2.5px !important; box-shadow: 0 0 0 2px rgba(249,115,22,.2); }
    .cal-day.anomaly .cal-day-num { color: #ea580c; }
    .cal-day-anomaly-icon { display: inline-block; font-size: .7rem; margin-left: 3px; color: #ea580c; vertical-align: middle; }
    .cal-day.nw-has-entries { border-color: #818cf8 !important; border-width: 2.5px !important; box-shadow: 0 0 0 2px rgba(129,140,248,.2); }
    .cal-day.nw-has-entries .cal-day-num { color: var(--primary); }
    .cal-day.cal-empty { min-height: 40px; border: none; background: transparent; }
    .cal-day.cal-empty:hover { box-shadow: none; transform: none; }

    /* DAY DETAIL MODAL */
    .day-detail-modal .modal { min-width: 420px; max-width: 520px; }
    .day-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
    .day-detail-header h3 { margin: 0; }
    .day-detail-close { background: none; border: none; font-size: 1.4rem; color: var(--text-light); cursor: pointer; padding: 0; line-height: 1; }
    .day-detail-close:hover { color: var(--text); }
    .day-entries-table { width: 100%; margin-bottom: .75rem; }
    .day-entries-table th { font-size: .7rem; padding: .4rem .5rem; }
    .day-entries-table td { padding: .4rem .5rem; font-size: .82rem; }
    .entry-valid-cell { text-align: center; width: 2rem; }
    .entry-valid-warn { color: var(--warning); font-size: 1rem; cursor: help; }
    .day-entries-empty { text-align: center; padding: 1rem; color: var(--text-light); font-size: .85rem; }
    .day-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .75rem; border-top: 1.5px solid var(--border); }
    .day-actions .btn { font-size: .8rem; padding: .45rem .9rem; }
    .day-action-form { margin-top: .75rem; padding: .75rem; background: var(--surface-alt); border-radius: var(--radius-sm); border: 1.5px solid var(--border); }
    .day-action-form .form-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
    .day-action-form .form-row:last-child { margin-bottom: 0; }
    .day-action-form label { font-size: .78rem; font-weight: 500; color: var(--text-muted); min-width: 60px; }
    .day-action-form input, .day-action-form select { font-size: .82rem; padding: .35rem .5rem; }

    /* SUMMARY BAR */
    .summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
    .stat-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; text-align: center; transition: box-shadow var(--transition); }
    .stat-card:hover { box-shadow: var(--shadow-md); }
    .stat-card .stat-val { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
    .stat-card .stat-lbl { font-size: .7rem; font-weight: 500; color: var(--text-muted); margin-top: .1rem; text-transform: uppercase; letter-spacing: .04em; }
    .stat-card.positive { border-color: #86efac; }
    .stat-card.positive .stat-val { color: var(--success); }
    .stat-card.negative { border-color: #fca5a5; }
    .stat-card.negative .stat-val { color: var(--danger); }

    /* MODAL */
    .modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadeIn .15s; }
    .modal { background: var(--surface); border-radius: var(--radius); padding: 1.75rem; min-width: 380px; max-width: 90vw; box-shadow: var(--shadow-lg); }
    .modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
    .modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* BROWSER CLOCK */
    .clock-card { text-align: center; padding: 2.5rem 1.5rem; background: linear-gradient(135deg, #f0fdf4, #ecfdf5); border: 1.5px solid #bbf7d0; border-radius: var(--radius); }
    .clock-card p { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.25rem; }
    .clock-card .btn-clock { font-size: 1.15rem; padding: .75rem 2.5rem; border-radius: 50px; background: linear-gradient(135deg, var(--success), #047857); color: #fff; box-shadow: var(--shadow-md); }
    .clock-card .btn-clock:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
    .clock-card--nudge { outline: 3px solid rgba(16,185,129,.35); outline-offset: 4px; animation: clock-nudge-pulse 1.2s ease-in-out 4; }
    @keyframes clock-nudge-pulse {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-2px); }
    }
    .browser-clock-choice {
      margin: 1.1rem auto 0;
      max-width: 34rem;
      padding: .85rem 1rem;
      border: 1px solid #86efac;
      border-radius: var(--radius-xs);
      background: rgba(255,255,255,.78);
      text-align: left;
    }
    .browser-clock-choice-title { font-weight: 800; color: #166534; margin-bottom: .25rem; }
    .browser-clock-choice p { margin: 0 0 .65rem; font-size: .86rem; line-height: 1.4; }
    .browser-clock-choice-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
    .browser-clock-choice-actions button { font-size: .8rem; padding: .38rem .7rem; }

    /* PRIVACY — contenuto Markdown (stile prose / viewer moderno) */
    .privacy-doc {
      background: var(--surface-alt);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 1.25rem;
      max-height: 280px;
      overflow: auto;
      font-size: .85rem;
      line-height: 1.7;
      margin: .75rem 0;
    }
    /* Tab Privacy: area lettura più ampia e colonna centrata */
    #privacyDocDynamic.privacy-doc {
      max-height: min(80vh, 960px);
      padding: 1.5rem clamp(1rem, 4vw, 2rem);
    }

    .privacy-md {
      font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      font-size: 0.9375rem;
      line-height: 1.72;
      color: var(--text);
      max-width: 42rem;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      -webkit-font-smoothing: antialiased;
    }
    .privacy-md-preview .privacy-md {
      font-size: 0.84rem;
      line-height: 1.62;
      max-width: 100%;
    }

    .privacy-md h1, .privacy-md h2, .privacy-md h3, .privacy-md h4 {
      font-weight: 700;
      line-height: 1.28;
      letter-spacing: -0.02em;
      color: var(--text);
    }
    .privacy-md h1 {
      font-size: 1.45rem;
      margin: 0 0 1rem;
      padding-bottom: 0.65rem;
      border-bottom: 1px solid var(--border);
    }
    .privacy-md h2 {
      font-size: 1.12rem;
      margin: 1.5rem 0 0.65rem;
    }
    .privacy-md h3, .privacy-md h4 {
      font-size: 1rem;
      margin: 1.15rem 0 0.5rem;
    }
    .privacy-md p { margin: 0.65em 0; }
    .privacy-md p:first-child { margin-top: 0; }
    .privacy-md ul, .privacy-md ol {
      margin: 0.65em 0;
      padding-left: 1.5rem;
    }
    .privacy-md li { margin: 0.4em 0; line-height: 1.65; }
    .privacy-md li > p { margin: 0.35em 0; }

    .privacy-md a {
      color: var(--primary-dark);
      text-decoration: underline;
      text-decoration-color: rgba(79, 70, 229, 0.35);
      text-underline-offset: 2px;
      font-weight: 500;
    }
    .privacy-md a:hover { color: var(--primary); text-decoration-color: var(--primary-light); }

    .privacy-md blockquote {
      margin: 1rem 0;
      padding: 0.85rem 1rem 0.85rem 1rem;
      border-left: 4px solid var(--primary-light);
      border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
      background: linear-gradient(90deg, rgba(79, 70, 229, 0.07) 0%, rgba(248, 250, 252, 0.95) 38%);
      color: var(--text);
      font-size: 0.92em;
    }
    .privacy-md blockquote p { margin: 0.4em 0; color: var(--text); }
    .privacy-md blockquote strong { color: var(--text); font-weight: 700; }
    .privacy-gate-body .privacy-md blockquote {
      border-left-color: var(--primary);
      background: linear-gradient(90deg, rgba(79, 70, 229, 0.09) 0%, rgba(250, 250, 250, 1) 40%);
    }

    .privacy-md table {
      border-collapse: collapse;
      width: 100%;
      margin: 1rem 0;
      font-size: 0.9em;
      border-radius: var(--radius-xs);
      overflow: hidden;
      box-shadow: 0 1px 0 rgba(0,0,0,.06);
    }
    .privacy-md th, .privacy-md td {
      border: 1px solid var(--border);
      padding: 0.45rem 0.65rem;
      text-align: left;
      vertical-align: top;
    }
    .privacy-md th { background: #f1f5f9; font-weight: 600; color: var(--text); }
    .privacy-md tbody tr:nth-child(even) { background: rgba(248, 250, 252, 0.85); }

    .privacy-md hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 1.35rem 0;
      opacity: 0.95;
    }
    .privacy-md code {
      font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
      font-size: 0.86em;
      background: rgba(15, 23, 42, 0.06);
      padding: 0.12em 0.4em;
      border-radius: 4px;
      color: var(--text);
    }
    .privacy-md pre {
      overflow: auto;
      max-width: 100%;
      padding: 0.65rem 0.85rem;
      background: rgba(15, 23, 42, 0.05);
      border-radius: var(--radius-sm);
      font-size: 0.82em;
      margin: 0.85em 0;
      border: 1px solid var(--border);
    }
    .privacy-md pre code { background: none; padding: 0; border: none; font-size: inherit; }

    /* SUBTABS */
    .subtabs { display: flex; flex-wrap: wrap; gap: .3rem; row-gap: .35rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1.5px solid var(--border); }
    .subtab { padding: .4rem .9rem; border-radius: var(--radius-xs); border: none; background: transparent; color: var(--text-muted); font-size: .8rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all var(--transition); }
    .subtab:hover { color: var(--primary); background: #eef2ff; }
    .subtab.active { color: var(--primary); background: #eef2ff; box-shadow: inset 0 -2px 0 var(--primary); }

    /* FOOTER */
    .footer { text-align: center; padding: 1.5rem; font-size: .82rem; color: var(--text-light); }
    .footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
    .footer a:hover { text-decoration: underline; }

    /* LOGIN OVERLAY — stesso ecosistema cromatico della pagina (non full-screen bianco né solo viola piatto) */
    .login-overlay {
      position: fixed;
      inset: 0;
      z-index: 300;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
      box-sizing: border-box;
      background-color: var(--bg);
      background-image:
        linear-gradient(145deg, rgba(79, 70, 229, 0.14) 0%, transparent 48%),
        linear-gradient(220deg, rgba(124, 58, 237, 0.1) 0%, transparent 52%),
        var(--page-bg-veil),
        var(--page-bg-gradient);
      background-attachment: fixed;
    }

    body.privacy-pending .header,
    body.privacy-pending .container { display: none !important; }

    /* Overlay: la card non supera l’altezza finestra; il testo scorre solo nel riquadro centrale, pulsanti sempre visibili */
    .privacy-gate-overlay {
      position: fixed; inset: 0; z-index: 350; background: var(--surface-alt);
      display: flex; align-items: center; justify-content: center;
      padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
      overflow: auto;
      box-sizing: border-box;
    }
    .privacy-gate-card {
      width: 100%; max-width: 720px;
      max-height: min(calc(100vh - 1.5rem), 920px);
      display: flex;
      flex-direction: column;
      min-height: 0;
      background: var(--surface); border-radius: var(--radius);
      box-shadow: var(--shadow-lg); border: 1px solid var(--border);
      padding: 1.25rem 1.35rem 1.1rem;
    }
    .privacy-gate-title { font-size: 1.25rem; font-weight: 800; margin-bottom: .35rem; color: var(--text); flex-shrink: 0; }
    .privacy-gate-meta { font-size: .88rem; color: var(--text-muted); margin-bottom: .85rem; line-height: 1.45; flex-shrink: 0; }
    .privacy-gate-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      margin-bottom: .75rem;
      padding: 1rem 1rem 1.1rem;
      background: #fafafa;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      font-size: .9rem;
      line-height: 1.65;
    }
    .privacy-gate-contacts {
      font-size: .88rem;
      margin-bottom: .65rem;
      padding: .75rem 1rem;
      background: var(--surface-alt);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      flex-shrink: 0;
      max-height: min(28vh, 220px);
      overflow-y: auto;
    }
    .privacy-gate-err { color: var(--danger); font-size: .85rem; font-weight: 600; min-height: 1.25rem; margin-bottom: .45rem; flex-shrink: 0; }
    .privacy-gate-actions {
      display: flex; flex-wrap: wrap; gap: .65rem; align-items: center;
      flex-shrink: 0;
      padding-top: .65rem;
      border-top: 1px solid var(--border);
    }
    .login-card {
      background: linear-gradient(180deg, #ffffff 0%, #faf8f6 55%, #f5f3ff 100%);
      border: 1px solid rgba(15, 23, 42, 0.06);
      border-radius: var(--radius);
      padding: 2.5rem 2rem;
      min-width: 360px;
      max-width: 460px;
      box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.65) inset;
      text-align: center;
    }
    .login-access-heading { font-size: 1.5rem; font-weight: 800; margin: 0 0 .5rem; color: var(--text); letter-spacing: -0.02em; line-height: 1.2; }
    /* In cima alla card: loghi in una sola riga (su schermi stretti scroll orizzontale) */
    .login-company-logos {
      display: flex;
      flex-wrap: nowrap;
      justify-content: center;
      align-items: center;
      gap: 0.65rem 1rem;
      margin: 0 0 1.1rem;
      min-height: 2.5rem;
      padding: .35rem .25rem .85rem;
      border-top: none;
      border-bottom: 1px solid var(--border);
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .login-company-logo-item {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: center;
      max-height: 48px;
    }
    .login-company-logo-item img {
      display: block;
      max-height: 44px;
      max-width: min(118px, 30vw);
      width: auto;
      height: auto;
      object-fit: contain;
    }
    .login-lead { font-size: .85rem; color: var(--text-muted); margin-bottom: 1.25rem; }
    .login-card p { font-size: .85rem; color: var(--text-muted); margin-bottom: 1.25rem; }
    .login-card select { width: 100%; margin-bottom: 1rem; }
    .login-card .btn-primary { width: 100%; justify-content: center; padding: .65rem; font-size: .95rem; }
    .login-error {
      min-height: 2.75rem;
      margin-top: .75rem;
      padding: .5rem .75rem;
      border-radius: var(--radius-sm);
      font-size: .85rem;
      font-weight: 500;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
      color: var(--danger, #b91c1c);
      background: #fef2f2;
      border: 1px solid #fecaca;
    }
    .login-error:empty {
      visibility: hidden;
      color: transparent;
      background: transparent;
      border-color: transparent;
    }
    .login-mode-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 1.1rem;
      width: 100%;
    }
    .login-mode-btn {
      flex: 1;
      padding: 0.55rem 0.5rem;
      font-size: 0.78rem;
      font-weight: 700;
      border-radius: var(--radius-xs);
      border: 1px solid var(--border);
      background: var(--surface-alt, #f8fafc);
      color: var(--text-muted);
      cursor: pointer;
      font-family: inherit;
      line-height: 1.25;
      transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }
    .login-mode-btn:hover {
      color: var(--primary);
      border-color: #c7d2fe;
      background: #eef2ff;
    }
    .login-mode-btn.active {
      color: var(--primary);
      border-color: var(--primary);
      background: #eef2ff;
      box-shadow: inset 0 -2px 0 var(--primary);
    }
    .login-mode-panel { margin-bottom: 0.35rem; }
    .login-forgot-wrap { text-align: center; margin: 0.65rem 0 0; font-size: 0.82rem; }
    .btn-link {
      background: none;
      border: none;
      color: var(--primary);
      cursor: pointer;
      text-decoration: underline;
      font: inherit;
      padding: 0;
    }
    .btn-link:hover { color: var(--primary-dark, #3730a3); }
    .login-flow-alt { margin-top: 0.25rem; }
    .login-pin-hint {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin: 0 0 0.85rem;
      text-align: center;
      line-height: 1.45;
    }
    .login-pin-display {
      display: flex;
      justify-content: center;
      gap: 0.5rem;
      margin-bottom: 1rem;
      min-height: 2.25rem;
      align-items: flex-end;
      user-select: none;
    }
    .login-pin-slot {
      width: 1rem;
      height: 1.35rem;
      border-bottom: 3px solid var(--border);
      border-radius: 1px;
      font-size: 1.1rem;
      font-weight: 800;
      text-align: center;
      line-height: 1.2;
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }
    .login-pin-slot.filled {
      border-bottom-color: var(--primary);
    }
    .login-pin-keypad {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.45rem;
      max-width: 240px;
      margin: 0 auto 0.25rem;
    }
    .login-pin-key {
      min-height: 48px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--surface);
      font-size: 1.2rem;
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      cursor: pointer;
      font-family: inherit;
      color: var(--text);
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
    .login-pin-key:active {
      transform: scale(0.98);
      background: var(--surface-alt, #f1f5f9);
    }
    .login-pin-key:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }
    .login-pin-key-fn {
      font-size: 0.78rem;
      font-weight: 700;
    }
    .user-badge-dropdown { position: relative; display: inline-block; }
    .user-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 20px; font-size: .8rem; font-weight: 600; cursor: pointer; transition: all var(--transition); border: 1.5px solid transparent; background: transparent; font-family: inherit; }
    .user-badge.role-admin { background: #fef3c7; color: #92400e; border-color: #fde047; }
    .user-badge.role-user { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
    .user-badge:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
    .user-badge-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px; width: max-content; max-width: min(280px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 30001; overflow: hidden; }
    .user-badge-menu-item { display: block; width: 100%; padding: .65rem .9rem; font-size: .88rem; line-height: 1.2; text-align: left; border: none; background: none; cursor: pointer; color: var(--text); font-family: inherit; white-space: nowrap; }
    .user-badge-menu-item:hover:not(:disabled) { background: var(--bg-hover, #f1f5f9); }
    .user-badge-menu-item:disabled { opacity: .45; cursor: not-allowed; }
    .user-badge-menu-item[data-action="logout"] { color: var(--danger, #dc2626); }

    /* AVATAR */
    .avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
    .avatar-sm { width: 36px; height: 36px; }
    .avatar-lg { width: 56px; height: 56px; }
    .avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; background: var(--primary-light); }
    .avatar-placeholder.avatar-lg { font-size: 1.05rem; }
    .avatar-placeholder.avatar-sm { font-size: .75rem; }

    /* CONTEXT BAR */
    .context-bar { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .6rem 1rem; margin-top: .75rem; display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
    .context-bar .ctx-label { color: var(--text-light); font-weight: 500; }
    .context-bar .ctx-name { font-weight: 700; color: var(--text); }
    .context-bar .ctx-company-logo { height: 28px; max-width: 88px; width: auto; object-fit: contain; flex-shrink: 0; }
    .context-bar .ctx-company { color: var(--text-muted); font-weight: 500; }
    .header-user-company-logo { height: 26px; max-width: 80px; width: auto; object-fit: contain; flex-shrink: 0; margin-right: .15rem; }
    .context-bar .ctx-admin-orari { display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
    .context-bar .ctx-select-group { display: inline-flex; align-items: center; gap: .4rem; }
    .context-bar .ctx-select-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); }
    .context-bar .company-chips-inline { display: inline-flex; }
    .context-bar select { min-width: 200px; font-size: .85rem; padding: .35rem .6rem; }

    /* STATUS BADGE */
    .status { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
    .status-inserita { background: #fef3c7; color: #92400e; }
    .status-approvata { background: #d1fae5; color: #065f46; }
    .status-rifiutata { background: #fee2e2; color: #991b1b; }
    .status-annullata { background: #f1f5f9; color: #64748b; text-decoration: line-through; }

    /* CHECKBOX */
    input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

    .work-schedule-list-wrap table { width: 100%; max-width: 920px; border-collapse: collapse; font-size: .85rem; }
    .work-schedule-list-wrap th, .work-schedule-list-wrap td { padding: .45rem .5rem; text-align: left; border-bottom: 1px solid var(--border); }
    .work-schedule-list-wrap th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

    /* Orario 24h (evita picker nativo 12h su Windows/Chrome) */
    input.input-time-24h,
    input.input-datetime-it-24h {
      width: 5.25rem;
      max-width: 100%;
      font-variant-numeric: tabular-nums;
      font-weight: 600;
      text-align: center;
      letter-spacing: 0.02em;
    }
    input.input-datetime-it-24h {
      width: 10.75rem;
    }

    /* RESPONSIVE */
    @media (max-width: 768px) {
      .header { padding: 1.25rem 1rem .75rem; }
      .container { padding: 0 .75rem 1.5rem; }
      .selector-bar { flex-direction: column; align-items: stretch; }
      .cal-day { min-height: 88px; padding: .22rem .2rem; font-size: clamp(0.52rem, 2.8vw, 0.68rem); }
      .summary-grid { grid-template-columns: repeat(3, 1fr); }
    }
    .login-card .login-form { text-align: left; margin-bottom: 0; }
