/* ==========================================================================
   FoxHR — Applicazione: shell (sidebar + barra superiore), tabelle, moduli,
   pannelli laterali, stati. Usato da admin/, employee/, consultant/.
   Si appoggia a variables.css, base.css, components.css, dashboard.css.
   ========================================================================== */

/* ---------- Elementi condivisi con la homepage (lì stanno in homepage.css) ---------- */
.avatar { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; background: var(--graphite); color: #fff; }
.avatar--red { background: var(--fox-red-strong); }
.avatar--lg { width: 3.25rem; height: 3.25rem; font-size: 1rem; }
.avatar--xl { width: 4.5rem; height: 4.5rem; font-size: 1.35rem; }
[data-theme="dark"] .avatar:not(.avatar--red) { background: #33353f; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--gray-400); flex: none; display: inline-block; }
.dot--ok { background: #1fa97a; box-shadow: 0 0 0 3px rgba(31, 169, 122, 0.2); }
.dot--warn { background: #e59a1d; box-shadow: 0 0 0 3px rgba(229, 154, 29, 0.2); }
.dot--err { background: var(--fox-red); box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.18); }
.dot--off { background: var(--gray-400); }
.progress { display: block; height: 0.5rem; border-radius: 1rem; background: var(--border); overflow: hidden; width: 100%; }
.progress__bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--fox-red), var(--fox-red-soft)); transition: width 0.6s var(--ease); }
.progress--ok .progress__bar { background: linear-gradient(90deg, #12805c, #1fa97a); }
.nfc-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--fox-red); animation: pulse-ring 2.4s ease-out infinite; }
.badge--info { --badge: #2457c5; --badge-text: #1d4aa8; }
[data-theme="dark"] .badge--info { --badge-text: #8fb0ff; }
.badge--plain::before { display: none; }

[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--bg-alt); }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s-5);
  padding: 1.25rem 0.9rem 1rem; background: var(--graphite); color: #f4f5f7;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  scrollbar-color: #3a3c46 transparent;
}
.sidebar .logo { padding: 0 0.5rem; }
.sidebar__org { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.75rem; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); font-size: var(--fs-sm); text-align: left; width: 100%; }
.sidebar__org small { display: block; color: #9a9eab; font-size: var(--fs-xs); }
.sidebar__org strong { display: block; font-weight: 600; line-height: 1.25; }
.sidebar__org .icon { margin-left: auto; color: #9a9eab; }
.sidebar__org-mark { width: 2.1rem; height: 2.1rem; flex: none; border-radius: 0.55rem; display: grid; place-items: center; background: #fff; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 0.8rem; }

.side-nav { display: grid; gap: 0.15rem; }
.side-nav__label { padding: 0.9rem 0.8rem 0.35rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #6f7380; }
.side-nav__link {
  display: flex; align-items: center; gap: 0.75rem; min-height: 2.6rem; padding: 0 0.8rem;
  border-radius: var(--radius-md); color: #b5b9c4; font-size: var(--fs-sm); font-weight: 500;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.side-nav__link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.side-nav__link[aria-current="page"] { background: var(--fox-red-strong); color: #fff; box-shadow: 0 8px 18px -8px var(--fox-red-glow); }
.side-nav__count { margin-left: auto; min-width: 1.4rem; height: 1.4rem; padding: 0 0.4rem; border-radius: 1rem; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; background: rgba(255, 255, 255, 0.1); color: #fff; }
.side-nav__link[aria-current="page"] .side-nav__count { background: rgba(255, 255, 255, 0.25); }
.side-nav__count--alert { background: var(--fox-red); }

.sidebar__foot { margin-top: auto; display: grid; gap: 0.6rem; padding-top: var(--s-4); border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar__user { display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem 0.4rem; font-size: var(--fs-sm); }
.sidebar__user small { display: block; color: #9a9eab; font-size: var(--fs-xs); }
.sidebar__user strong { display: block; font-weight: 600; line-height: 1.25; }
.sidebar__user .btn { margin-left: auto; color: #b5b9c4; }
.sidebar .powered { color: #6f7380; font-size: 0.72rem; padding: 0 0.5rem; }
.sidebar .powered strong { color: #b5b9c4; }
.powered { display: inline-flex; align-items: center; gap: 0.45rem; }
.powered__dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--fox-red); box-shadow: 0 0 10px var(--fox-red); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: 4rem; display: flex; align-items: center; gap: var(--s-3);
  padding: 0 clamp(1rem, 0.5rem + 2vw, 2.25rem);
  background: color-mix(in srgb, var(--bg-alt) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.topbar__menu.icon-btn { display: none; }
.topbar__title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__search { position: relative; flex: 0 1 22rem; margin-left: auto; }
.topbar__search .icon { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.topbar__search input { padding-left: 2.6rem; border-radius: var(--radius-pill); }
.topbar__actions { display: flex; align-items: center; gap: 0.4rem; }
.topbar__search + .topbar__actions { margin-left: 0; }
.topbar__actions:first-child, .topbar__title + .topbar__actions { margin-left: auto; }
.icon-btn { position: relative; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); transition: background-color var(--dur-fast), color var(--dur-fast); }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn__dot { position: absolute; top: 0.45rem; right: 0.5rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--fox-red); border: 2px solid var(--bg-alt); }
.icon--sun { display: none; }
[data-theme="dark"] .icon--sun { display: block; }
[data-theme="dark"] .icon--moon { display: none; }

.view { padding: clamp(1rem, 0.5rem + 2vw, 2.25rem); display: grid; gap: var(--s-5); align-content: start; width: 100%; max-width: 100rem; }
.view[hidden] { display: none; }
.view.is-entering { animation: modal-in var(--dur) var(--ease); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 0.3rem; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

/* ---------- Pannelli e griglie ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.panel__head h2, .panel__head h3 { font-size: var(--fs-md); }
.panel__head p { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 0.15rem; }
.panel__body { padding: 1.1rem 1.25rem; }
.panel__body--flush { padding: 0; }
.panel__foot { padding: 0.8rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s-2); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.grid-2--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.stack { display: grid; gap: var(--s-4); align-content: start; }

.kpi-grid .kpi { border-radius: var(--radius-lg); }
.view .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.view .kpi-grid .kpi strong { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.85rem); }
@media (max-width: 75rem) { .view .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-grid .kpi strong { font-family: var(--font-display); letter-spacing: -0.03em; }
.kpi-grid .kpi small { display: block; font-size: var(--fs-xs); }
.kpi__trend { font-size: var(--fs-xs); font-weight: 600; margin-left: 0.4rem; color: var(--success); }
.kpi__sub { display: block; color: var(--text-muted); font-size: var(--fs-xs); margin-top: 0.15rem; }
a.kpi, button.kpi { text-align: left; cursor: pointer; }

/* Liste semplici dentro i pannelli */
.list { display: grid; }
.list__item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.85rem; align-items: center; padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.list__item:last-child { border-bottom: 0; }
.list__item strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.list__item small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
.list__item time { font-variant-numeric: tabular-nums; font-weight: 600; }
.list__actions { display: flex; gap: 0.4rem; align-items: center; }
.list__icon { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); display: grid; place-items: center; background: color-mix(in srgb, var(--fox-red) 10%, transparent); color: var(--accent-text); }
.list__icon--ok { background: color-mix(in srgb, #1fa97a 14%, transparent); color: #137a58; }
.list__icon--warn { background: color-mix(in srgb, #e59a1d 16%, transparent); color: #9a5f00; }
[data-theme="dark"] .list__icon--ok { color: #4be0ae; }
[data-theme="dark"] .list__icon--warn { color: #ffc15a; }
button.list__item, a.list__item { width: 100%; text-align: left; transition: background-color var(--dur-fast); }
button.list__item:hover, a.list__item:hover { background: var(--surface-2); }

/* ---------- Barra strumenti, campi ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); }
.toolbar__grow { flex: 1 1 14rem; position: relative; }
.toolbar__grow .icon { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.toolbar__grow .input { padding-left: 2.5rem; }
.toolbar__end { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }

.field { display: grid; gap: 0.35rem; min-width: 0; }
.field > span, .label { font-size: var(--fs-xs); font-weight: 600; color: var(--text); }
.field small, .hint { color: var(--text-muted); font-size: var(--fs-xs); }
.field--full { grid-column: 1 / -1; }
.input, .textarea, .field .select {
  width: 100%; min-height: var(--tap); padding: 0.55rem 0.95rem; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-sm);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.field .select { border-radius: var(--radius-md); padding-right: 2.2rem; }
.textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--gray-400); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--fox-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fox-red) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--fox-red); }
.input--sm, .select--sm { min-height: 2.25rem; font-size: var(--fs-xs); }
.select { color: var(--text); }
[data-theme="dark"] .select { background-color: var(--surface); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.form-section { display: grid; gap: var(--s-4); }
.form-section + .form-section { padding-top: var(--s-5); border-top: 1px solid var(--border); }
.form-section h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.form-error { color: var(--fox-red-strong); font-size: var(--fs-xs); font-weight: 600; }
[data-theme="dark"] .form-error { color: var(--fox-red-soft); }

/* Interruttore */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: 0.75rem 0; cursor: pointer; font-size: var(--fs-sm); }
.switch + .switch { border-top: 1px solid var(--border); }
.switch small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 2.75rem; height: 1.6rem; border-radius: 1rem; background: var(--gray-300); position: relative; cursor: pointer; transition: background-color var(--dur-fast); }
[data-theme="dark"] .switch input { background: #3a3c46; }
.switch input::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.switch input:checked { background: var(--fox-red-strong); }
.switch input:checked::after { transform: translateX(1.15rem); }

/* Gruppo segmentato (filtri rapidi) */
.segmented { display: inline-flex; padding: 0.2rem; gap: 0.15rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); max-width: 100%; overflow-x: auto; }
.segmented button { min-height: 2.15rem; padding: 0 0.9rem; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .segmented button[aria-pressed="true"] { background: #2b2d36; }
.segmented .count { margin-left: 0.3rem; color: var(--text-muted); font-weight: 500; }

.btn--outline { --btn-bg: var(--surface); }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--fox-red-strong); --btn-bd: color-mix(in srgb, var(--fox-red) 35%, var(--border)); }
[data-theme="dark"] .btn--danger { --btn-fg: var(--fox-red-soft); }
.btn--ok { --btn-bg: #12805c; --btn-fg: #fff; --btn-bd: transparent; }
.btn--quiet { --btn-bg: transparent; --btn-bd: transparent; }
.btn--quiet:hover { --btn-bg: var(--surface-2); box-shadow: none; transform: none; }
.btn.is-loading { pointer-events: none; color: transparent; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid currentColor; border-color: var(--btn-fg) transparent var(--btn-fg) transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-muted { opacity: 0.55; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 0.25rem; }
.table th button { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; display: inline-flex; align-items: center; gap: 0.3rem; }
.person { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.person strong { display: block; font-weight: 600; white-space: nowrap; }
.person small { display: block; color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }
.time-cell { font-variant-numeric: tabular-nums; font-weight: 500; }
.time-cell--missing { color: var(--fox-red-strong); font-weight: 700; }
[data-theme="dark"] .time-cell--missing { color: var(--fox-red-soft); }
.muted { color: var(--text-muted); }

/* Su schermi stretti le tabelle diventano schede */
@media (max-width: 48rem) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards td { border: 0; padding: 0.2rem 0 !important; display: flex; justify-content: space-between; gap: var(--s-3); text-align: right; }
  .table--cards td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; text-align: left; }
  .table--cards td:first-child { padding-bottom: 0.5rem !important; justify-content: flex-start; text-align: left; }
  .table--cards td:first-child::before, .table--cards td.actions::before { display: none; }
  .table--cards td.actions { justify-content: flex-end; padding-top: 0.5rem !important; }
  .table--cards .num { text-align: right; }
}

/* ---------- Pannello laterale (dialog) ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; height: 100%; max-height: 100%;
  width: min(36rem, 100%); padding: 0; border: 0; border-left: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.drawer::backdrop { background: rgba(5, 5, 8, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in var(--dur) var(--ease); }
.drawer[open]::backdrop { animation: fade-in var(--dur) var(--ease); }
.drawer--wide { width: min(52rem, 100%); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: flex-start; gap: var(--s-3); padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.drawer__head h2 { font-size: var(--fs-lg); }
.drawer__head p { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 0.2rem; }
.drawer__head .icon-btn { margin-left: auto; flex: none; }
.drawer__body { flex: 1; overflow-y: auto; padding: 1.5rem; display: grid; gap: var(--s-5); align-content: start; }
.drawer__foot { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer__foot .btn--danger { margin-right: auto; }

.modal--confirm .modal__body { gap: var(--s-3); }

/* ---------- Varie ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: 2.5rem 1.5rem; color: var(--text-muted); font-size: var(--fs-sm); }
.empty .icon { width: 2.4rem; height: 2.4rem; color: var(--gray-400); }
.empty strong { color: var(--text); font-size: var(--fs-md); }
.callout { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.9rem 1rem; border-radius: var(--radius-md); font-size: var(--fs-sm); background: color-mix(in srgb, var(--info) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--info) 25%, var(--border)); }
.callout .icon { color: var(--info); margin-top: 0.15rem; }
[data-theme="dark"] .callout .icon { color: #8fb0ff; }
.callout--warn { background: color-mix(in srgb, #e59a1d 9%, var(--surface)); border-color: color-mix(in srgb, #e59a1d 35%, var(--border)); }
.callout--warn .icon { color: #b86e00; }
.callout--red { background: color-mix(in srgb, var(--fox-red) 6%, var(--surface)); border-color: color-mix(in srgb, var(--fox-red) 30%, var(--border)); }
.callout--red .icon { color: var(--accent-text); }
.callout strong { display: block; }
.callout p { color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.7rem; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
button.chip[aria-pressed="true"] { background: var(--fox-red-strong); color: #fff; border-color: transparent; }
.kbd { font-family: var(--font-mono); font-size: 0.85em; padding: 0.05rem 0.4rem; border-radius: 0.3rem; background: var(--surface-2); border: 1px solid var(--border); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.25rem; font-size: var(--fs-sm); }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.code-big { font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: 0.25em; text-align: center; padding: 1rem; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px dashed var(--border); }
.demo-note { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }

/* Dropzone per caricamento file */
.dropzone {
  display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: 2rem 1.25rem;
  border: 2px dashed color-mix(in srgb, var(--fox-red) 45%, var(--border)); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--fox-red) 4%, var(--surface)); cursor: pointer;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur) var(--ease);
}
.dropzone:hover, .dropzone.is-over { background: color-mix(in srgb, var(--fox-red) 9%, var(--surface)); border-color: var(--fox-red); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone .icon { width: 2.4rem; height: 2.4rem; color: var(--accent-text); }
.dropzone strong { font-size: var(--fs-md); }
.dropzone small { color: var(--text-muted); font-size: var(--fs-xs); }

/* Calendario mensile */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; }
.cal__dow { text-align: center; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); padding-bottom: 0.25rem; }
.cal__day { min-height: 4.2rem; padding: 0.4rem 0.45rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); display: grid; align-content: space-between; text-align: left; font-size: var(--fs-xs); transition: border-color var(--dur-fast), transform var(--dur-fast); }
button.cal__day:hover { border-color: var(--fox-red); }
.cal__day b { font-weight: 600; }
.cal__day span { font-variant-numeric: tabular-nums; color: var(--text-muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__day--empty { background: transparent; border-color: transparent; }
.cal__day--ok span { color: #137a58; }
.cal__day--warn { border-color: color-mix(in srgb, #e59a1d 55%, var(--border)); }
.cal__day--warn span { color: #9a5f00; }
.cal__day--err { border-color: color-mix(in srgb, var(--fox-red) 55%, var(--border)); background: color-mix(in srgb, var(--fox-red) 5%, var(--surface-2)); }
.cal__day--err span { color: var(--fox-red-strong); }
.cal__day--leave { background: color-mix(in srgb, var(--info) 8%, var(--surface-2)); }
.cal__day--leave span { color: var(--info); }
.cal__day--today { box-shadow: inset 0 0 0 2px var(--fox-red); }
.cal__day--off { opacity: 0.5; }
[data-theme="dark"] .cal__day--ok span { color: #4be0ae; }
[data-theme="dark"] .cal__day--warn span { color: #ffc15a; }
[data-theme="dark"] .cal__day--err span { color: var(--fox-red-soft); }
[data-theme="dark"] .cal__day--leave span { color: #8fb0ff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: var(--fs-xs); color: var(--text-muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.month-nav { display: inline-flex; align-items: center; gap: 0.25rem; }
.month-nav strong { min-width: 9.5rem; text-align: center; text-transform: capitalize; font-size: var(--fs-sm); }

/* Barra di navigazione inferiore (area dipendente su smartphone) */
.bottom-nav { display: none; }

/* Notifiche */
.notif-pop { position: absolute; top: calc(100% + 0.4rem); right: 0; width: min(22rem, calc(100vw - 2rem)); z-index: 60; }
.notif-pop[hidden] { display: none; }
.has-pop { position: relative; }

/* ---------- Responsive ---------- */
@media (max-width: 75rem) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 64rem) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 90; width: min(18rem, 86vw);
    transform: translateX(-102%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(5, 5, 8, 0.55); opacity: 0; pointer-events: none; transition: opacity var(--dur); }
  .sidebar.is-open + .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .topbar__menu.icon-btn { display: grid; }
  .topbar__search { display: none; }
}
@media (max-width: 40rem) {
  .grid-2--even, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: stretch; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1 1 auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .panel__head, .toolbar, .list__item { padding-inline: 1rem; }
  .cal { gap: 0.2rem; }
  .cal__day { min-height: 3.2rem; padding: 0.3rem; }
  .cal__day span { font-size: 0.66rem; }
  .drawer__body { padding: 1.1rem; }
  .drawer__head, .drawer__foot { padding-inline: 1.1rem; }
  .topbar__title { font-size: var(--fs-sm); }
  .topbar .month-nav > .icon { display: none; }
  .topbar .month-nav .select { max-width: 9.5rem; }
}
@media (min-width: 64.01rem) { .sidebar-scrim { display: none; } }
@media (pointer: coarse) { .side-nav__link { min-height: 3rem; } }
@media print {
  .sidebar, .topbar, .page-head__actions, .toolbar, .bottom-nav, .toast-region { display: none !important; }
  .app { display: block; background: #fff; }
  .panel { box-shadow: none; border-color: #ccc; }
}

/* ==========================================================================
   Area dipendente: pensata prima per lo smartphone
   ========================================================================== */
.emp-hero { position: relative; overflow: hidden; isolation: isolate; padding: clamp(1.25rem, 1rem + 2vw, 2.25rem); border-radius: var(--radius-xl); color: #fff;
  background: radial-gradient(110% 130% at 100% 0%, var(--fox-red) 0%, #7a0309 55%, var(--graphite) 100%); display: grid; gap: 0.9rem; box-shadow: var(--shadow-md); }
.emp-hero::after { content: ""; position: absolute; inset: auto -4rem -6rem auto; width: 16rem; height: 16rem; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12); z-index: -1; }
.emp-hero small { color: rgba(255, 255, 255, 0.75); font-size: var(--fs-sm); }
.emp-hero h1 { font-size: var(--fs-2xl); letter-spacing: -0.04em; }
.emp-hero__status { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.95rem 0.5rem 0.75rem; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18); font-weight: 600; font-size: var(--fs-sm); justify-self: start; }
.emp-hero__times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.emp-hero__times div { padding: 0.6rem 0.75rem; border-radius: var(--radius-md); background: rgba(0, 0, 0, 0.18); }
.emp-hero__times small { display: block; font-size: var(--fs-xs); }
.emp-hero__times strong { font-family: var(--font-display); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.emp-hero__note { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.7); }
.stat-card { padding: 1rem 1.1rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: grid; gap: 0.2rem; }
.stat-card small { color: var(--text-muted); font-size: var(--fs-xs); }
.stat-card strong { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .progress { margin-top: 0.4rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); }
.doc-year { font-family: var(--font-display); font-size: var(--fs-md); padding: 0.9rem 1.25rem 0.4rem; color: var(--text-muted); }
.ack { display: grid; gap: 0.75rem; padding: 1rem; border-radius: var(--radius-md); background: color-mix(in srgb, var(--fox-red) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--fox-red) 25%, var(--border)); }
.topbar__logo-mobile { display: none; }
.unread-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--fox-red); flex: none; }

@media (max-width: 64rem) {
  .app--employee .sidebar, .app--employee .sidebar-scrim, .app--employee .topbar__menu.icon-btn { display: none; }
  .app--employee .topbar__logo-mobile { display: inline-flex; }
  .app--employee .topbar__logo-mobile .logo__mark { width: 1.9rem; height: 1.9rem; }
  .app--employee .view { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 70;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-top: 1px solid var(--border);
  }
  .bottom-nav a { position: relative; display: grid; justify-items: center; gap: 0.15rem; padding: 0.45rem 0.2rem; border-radius: var(--radius-md); font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
  .bottom-nav a .icon { width: 1.45rem; height: 1.45rem; }
  .bottom-nav a[aria-current="page"] { color: var(--accent-text); }
  .bottom-nav a[aria-current="page"]::before { content: ""; position: absolute; top: -0.36rem; width: 2rem; height: 3px; border-radius: 0 0 3px 3px; background: var(--fox-red); }
  .bottom-nav__badge { position: absolute; top: 0.25rem; left: calc(50% + 0.45rem); min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem; border-radius: 1rem; background: var(--fox-red); color: #fff; font-size: 0.62rem; display: grid; place-items: center; }
  .bottom-nav__badge[hidden] { display: none; }
  .is-employee .toast-region { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 48rem) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 24rem) { .emp-hero__times { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sidebar select option { color: var(--ink); background: #fff; }
.preview-frame { width: 100%; height: min(70vh, 48rem); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.match { display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-xs); color: var(--text-muted); }
.match .icon { width: 0.95rem; height: 0.95rem; color: #1fa97a; }
.arch-cell { text-align: center; }
.arch-cell .icon { margin-inline: auto; }
.arch-ok { color: #1fa97a; }
.arch-draft { color: #e59a1d; }
.arch-miss { color: var(--gray-400); }
.step-num { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border); }
.step-num--done { background: #12805c; color: #fff; border-color: transparent; }
.step-num--now { background: var(--fox-red-strong); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px var(--fox-red-glow); }
