:root {
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --surface: #ffffff;
  --background: #f8fafc;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #b91c1c;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  min-width: 320px;
  color: var(--text);
  background: var(--background);
  font-family: var(--font-sans);
}

.app-shell { display: flex; width: min(1060px, calc(100% - 40px)); min-height: 0; flex: 1; flex-direction: column; margin: 0 auto; padding: 32px 0; overflow: hidden; }
.top-header { position: relative; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: .72rem; font-weight: 700; letter-spacing: .08em; }
.page-nav { display: flex; justify-content: center; gap: 10px; }
.page-nav a { min-width: 112px; padding: 9px 16px; color: #334155; background: var(--surface); border: 1px solid #cbd5e1; border-radius: 6px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); font-size: .88rem; font-weight: 700; text-align: center; text-decoration: none; white-space: nowrap; transition: color .15s, background .15s, border-color .15s, box-shadow .15s; }
.page-nav a:hover { color: var(--primary); background: #eff6ff; border-color: #93c5fd; box-shadow: 0 2px 5px rgba(29, 78, 216, .12); }
.page-nav a:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }
.page-nav a.active { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 2px 5px rgba(29, 78, 216, .22); }
.page-nav a.active:hover { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); }
.header-tools { position: absolute; top: 50%; right: 20px; display: flex; align-items: center; gap: 10px; transform: translateY(-50%); }
.header-company-logo { position: absolute; top: 50%; left: 20px; display: block; width: auto; max-width: 140px; height: 36px; object-fit: contain; transform: translateY(-50%); }
.page-nav .settings-nav-link { display: grid; width: 40px; min-width: 40px; height: 40px; place-items: center; padding: 0; font-size: 1.05rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.15; letter-spacing: -.03em; }
.intro, .section-title p { margin-bottom: 0; color: var(--muted); font-size: .92rem; }
.card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.directory-card { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: visible; }
.directory-topline { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.section-title { display: flex; align-items: flex-start; gap: 10px; }
.directory-topline > .section-title { min-width: 0; flex: 1; }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.section-heading h2 { margin-bottom: 0; }
.list-counter { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 8px; color: var(--muted); background: #f3f4f6; border-radius: 999px; font-size: .7rem; font-weight: 600; white-space: nowrap; }
.list-counter strong { color: var(--text); font-size: .78rem; }
.number { display: grid; place-items: center; flex: 0 0 26px; height: 26px; color: var(--primary); background: #eff6ff; border-radius: 50%; font-size: .72rem; font-weight: 700; }
h2 { margin-bottom: 3px; font-size: 1.05rem; line-height: 1.25; }

.list-tools { display: flex; align-items: center; gap: 10px; }
.list-panel-tools { display: contents; }
.search-field { position: relative; display: block; min-width: 235px; }
label { display: grid; gap: 7px; color: #374151; font-size: .82rem; font-weight: 600; }
input, select { width: 100%; height: 40px; padding: 0 12px; color: var(--text); background: var(--surface); border: 1px solid #d1d5db; border-radius: 5px; outline: none; font: 400 .9rem var(--font-sans); }
textarea { width: 100%; min-height: 78px; padding: 10px 12px; resize: vertical; color: var(--text); background: var(--surface); border: 1px solid #d1d5db; border-radius: 5px; outline: none; font: 400 .9rem var(--font-sans); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.search-field input { padding-right: 35px; font-size: .84rem; }
.search-field > span:last-child { position: absolute; right: 12px; bottom: 8px; color: var(--muted); font: 1.3rem/1 serif; pointer-events: none; }
button { border: 0; border-radius: 5px; cursor: pointer; font: 600 .83rem var(--font-sans); transition: background .15s, border-color .15s; }
button:disabled { cursor: wait; opacity: .7; }
.add-button, #submitButton, #stationSubmitButton { height: 40px; padding: 0 14px; color: #fff; background: var(--primary); white-space: nowrap; }
.add-button:hover, #submitButton:hover, #stationSubmitButton:hover { background: var(--primary-hover); }
.add-button span { margin-right: 4px; font-size: 1.1rem; }
#submitButton span, #stationSubmitButton span { margin-left: 6px; }

.register-shell { padding-top: 20px; }
.register-switch { display: inline-flex; flex: 0 0 auto; gap: 4px; padding: 4px; background: #e2e8f0; border-radius: 7px; }
.register-tab { min-width: 112px; height: 36px; padding: 0 16px; color: #475569; background: transparent; }
.register-tab:hover { color: var(--primary); background: rgba(255, 255, 255, .65); }
.register-tab.active { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.register-tab:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }
.register-panel[hidden] { display: none; }
.settings-shell { padding-top: 20px; overflow-y: auto; scrollbar-gutter: stable; }
.settings-card { flex: 0 0 auto; padding: 24px; }
.settings-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.settings-card h1 { margin: 0; font-size: 1.5rem; }
.app-version { padding: 5px 9px; color: #475569; background: #f1f5f9; border: 1px solid #dbe3ec; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.settings-card .settings-intro { margin: 0; color: var(--muted); font-size: .9rem; }
.logo-settings { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.setting-heading h2 { margin-bottom: 5px; font-size: 1rem; }
.setting-heading p { margin: 0; color: var(--muted); font-size: .8rem; }
.company-logo-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); align-items: stretch; gap: 22px; }
.company-logo-preview { position: relative; display: grid; height: 180px; place-items: center; padding: 18px 18px 42px; overflow: hidden; color: var(--muted); background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 7px; cursor: pointer; font-size: .82rem; transition: background .15s, border-color .15s; }
.company-logo-preview:hover { background: #eff6ff; border-color: #93c5fd; }
.company-logo-preview:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.company-logo-preview.is-upload-disabled { cursor: default; }
.company-logo-preview.is-upload-disabled:hover { background: #f8fafc; border-color: #cbd5e1; }
.company-logo-preview img { display: block; max-width: min(100%, 360px); max-height: 130px; object-fit: contain; }
.company-logo-upload-hint { position: absolute; right: 12px; bottom: 10px; left: 12px; color: #64748b; font-size: .72rem; font-weight: 600; text-align: center; }
.company-logo-controls { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; gap: 18px; }
.logo-remove-button { margin: 0; }
.logo-download-option { display: flex; align-items: center; gap: 10px; width: fit-content; font-weight: 600; }
.logo-download-option input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.settings-actions .delete-modal { margin-right: 0; }
.settings-status { min-width: 0; flex: 1; color: var(--muted); font-size: .78rem; }
.rotations-shell { padding-top: 20px; }
.rotations-panel[hidden] { display: none; }
.finalized-list-wrap { padding: 14px; }
.finalization-list { display: grid; gap: 10px; }
.finalization-card { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 15px 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; text-align: left; }
.finalization-card:hover { background: #f8fafc; border-color: #bfdbfe; }
.finalization-card:focus-visible { outline: 3px solid rgba(29, 78, 216, .18); outline-offset: 2px; }
.finalization-card-copy { display: grid; min-width: 0; gap: 4px; }
.finalization-card-copy strong { font-size: .9rem; }
.finalization-card-copy small, .finalization-card-stats { color: var(--muted); font-size: .72rem; font-weight: 600; }
.finalization-card-stats { white-space: nowrap; }
.finalization-card-arrow { color: var(--primary); font-size: 1.1rem; }
.finalization-dialog { width: min(1180px, calc(100% - 32px)); }
.finalization-modal-heading { position: sticky; z-index: 3; top: -24px; margin: -24px -24px 18px; padding: 20px 24px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.finalization-modal-heading .finalization-detail-meta { margin: 7px 0 0; color: var(--muted); font-size: .8rem; }
.finalization-detail-loading { min-height: 180px; }
.person-schedule-list { display: grid; gap: 14px; }
.person-schedule-card { overflow: hidden; border: 1px solid var(--border); border-radius: 7px; }
.person-schedule-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.person-schedule-copy { display: flex; min-width: 0; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; }
.person-schedule-heading h3 { margin: 0; font-size: .9rem; }
.person-schedule-heading span { color: var(--muted); font-size: .7rem; font-weight: 600; }
.person-schedule-employee-id { white-space: nowrap; }
.person-schedule-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.download-person-schedule { flex: 0 0 auto; height: 34px; padding: 0 11px; color: var(--primary); background: var(--surface); border: 1px solid #bfdbfe; }
.download-person-schedule:hover { background: #eff6ff; }
.download-person-schedule:focus-visible { outline: 3px solid rgba(29, 78, 216, .16); outline-offset: 2px; }
.share-person-schedule { flex: 0 0 auto; height: 34px; padding: 0 11px; color: #fff; background: var(--primary); border: 1px solid var(--primary); }
.share-person-schedule:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.share-person-schedule:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }
.person-week-wrap { overflow-x: auto; }
.person-week-grid { display: grid; min-width: 910px; grid-template-columns: repeat(7, minmax(130px, 1fr)); }
.person-day-card { min-height: 120px; padding: 10px; border-right: 1px solid var(--border); }
.person-day-card:last-child { border-right: 0; }
.person-day-heading { display: grid; gap: 1px; margin-bottom: 8px; color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: capitalize; }
.person-day-heading strong { color: var(--text); font-size: .74rem; }
.person-day-assignments { display: grid; gap: 6px; }
.person-shift-chip { display: grid; gap: 3px; padding: 8px 9px; color: #1e3a8a; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 5px; font-size: .73rem; }
.person-shift-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-shift-chip span { color: #334155; font-size: .72rem; font-weight: 700; }
.person-shift-time { display: inline-flex; width: fit-content; align-items: center; gap: 5px; }
.next-day-icon { display: inline-block; color: #000; font-size: .95rem; font-weight: 700; line-height: 1; white-space: nowrap; cursor: help; }
.person-rest-label { color: #9ca3af; font-size: .7rem; font-style: italic; }
.finalization-people-empty { padding-block: 44px; }

/* Area personale dipendenti */
.employee-page { height: auto; min-height: 100dvh; overflow-y: auto; }
.employee-header { position: relative; display: flex; min-height: 64px; align-items: center; justify-content: center; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.employee-header .employee-logo { position: static; max-width: 180px; height: 40px; transform: none; }
.employee-header:has(.employee-logo:not([hidden])) .employee-brand { display: none; }
.employee-brand { color: #334155; font-size: 1rem; font-weight: 800; letter-spacing: -.02em; }
.employee-shell { width: min(820px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 64px; }
.employee-shell:has(.employee-lookup-card[hidden]) { padding-top: 20px; }
.employee-intro { max-width: 620px; margin: 0 auto 24px; text-align: center; }
.employee-intro h1 { margin-bottom: 10px; }
.employee-intro > p:last-child { margin-bottom: 0; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.employee-lookup-card { max-width: 620px; margin: 0 auto; padding: 24px; box-shadow: 0 8px 28px rgba(15, 23, 42, .06); }
.employee-lookup-card h2 { margin-bottom: 2px; }
.employee-lookup-form { gap: 9px; margin-top: 0; }
.employee-lookup-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.employee-lookup-controls input { height: 44px; font-size: 1rem; }
.employee-lookup-controls button { min-height: 44px; padding: 0 18px; color: #fff; background: var(--primary); white-space: nowrap; }
.employee-lookup-controls button:hover { background: var(--primary-hover); }
.employee-lookup-controls button:focus-visible, .employee-secondary-button:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }
.employee-message { margin: 14px 0 0; padding: 10px 12px; color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 5px; font-size: .82rem; }
.employee-loading { max-width: 620px; min-height: 110px; margin: 18px auto 0; }
.employee-results { margin-top: 38px; }
.employee-lookup-card[hidden] + .employee-results { margin-top: 0; }
.employee-results-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.employee-results-heading .eyebrow { margin-bottom: 5px; }
.employee-results-heading h2 { margin-bottom: 4px; font-size: 1.35rem; }
.employee-secondary-button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; color: var(--primary); background: var(--surface); border: 1px solid #bfdbfe; }
.employee-secondary-button:hover { background: #eff6ff; }
.employee-rotation-list { display: grid; gap: 14px; }
.employee-rotation-card { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 17px 18px; color: var(--text); background: var(--surface); text-align: left; }
.employee-rotation-card:hover { background: #f8fafc; border-color: #bfdbfe; }
.employee-rotation-card:focus-visible { outline: 3px solid rgba(29, 78, 216, .18); outline-offset: 2px; }
.employee-rotation-copy { display: grid; min-width: 0; gap: 4px; }
.employee-rotation-copy strong { font-size: .92rem; }
.employee-rotation-arrow { color: var(--primary); font-size: 1.15rem; }
.employee-week-label { color: var(--primary); font-size: .65rem; font-weight: 800; letter-spacing: .07em; }
.employee-shift-count { padding: 4px 9px; color: #475569; background: #e2e8f0; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.employee-schedule-modal { width: min(820px, calc(100% - 32px)); padding: 0; }
.employee-modal-heading { position: sticky; z-index: 3; top: 0; padding: 20px 22px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.employee-modal-heading .eyebrow { margin-bottom: 5px; }
.employee-modal-person { margin: 6px 0 0; color: var(--muted); font-size: .8rem; font-weight: 600; }
.employee-schedule-table { margin: 18px 22px; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; }
.employee-schedule-table-head { display: grid; grid-template-columns: 150px minmax(0, 3fr) minmax(150px, 4fr); color: #475569; background: #e2e8f0; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.employee-schedule-table-head span { padding: 11px 13px; border-right: 1px solid #cbd5e1; }
.employee-schedule-table-head span:last-child { border-right: 0; }
.employee-schedule-table-body { display: grid; }
.employee-schedule-row { display: grid; min-height: 76px; grid-template-columns: 150px minmax(0, 3fr) minmax(150px, 4fr); border-top: 1px solid var(--border); }
.employee-schedule-row:nth-child(odd) { background: #f8fafc; }
.employee-schedule-date { display: grid; align-content: center; gap: 3px; padding: 12px 13px; }
.employee-schedule-date strong { font-size: .82rem; }
.employee-schedule-date span { color: var(--muted); font-size: .7rem; text-transform: capitalize; }
.employee-schedule-row-shifts { position: relative; display: grid; grid-column: 2 / 4; border-left: 1px solid var(--border); }
.employee-schedule-row-shifts:has(.employee-schedule-rest)::after { position: absolute; top: 0; bottom: 0; left: 42.857%; content: ""; border-left: 1px solid var(--border); }
.employee-schedule-table-shift { display: grid; min-width: 0; grid-template-columns: minmax(0, 3fr) minmax(150px, 4fr); align-items: stretch; background: #eff6ff; border-bottom: 1px solid #dbeafe; }
.employee-schedule-table-shift:last-child { border-bottom: 0; }
.employee-schedule-station { display: grid; min-width: 0; align-content: center; gap: 3px; padding: 10px 13px; }
.employee-schedule-station strong { overflow: hidden; color: #1e3a8a; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.employee-schedule-station span { overflow-wrap: anywhere; color: #64748b; font-size: .68rem; }
.employee-schedule-time { display: flex; align-items: center; padding: 10px 13px; color: #1e3a8a; border-left: 1px solid #dbeafe; font-size: .78rem; white-space: nowrap; }
.employee-schedule-rest { align-self: center; padding: 12px 13px; color: #9ca3af; font-size: .78rem; font-style: italic; }
.employee-results > .empty-state { min-height: 180px; }
.employee-modal-actions { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 22px; background: var(--surface); border-top: 1px solid var(--border); }
.employee-modal-actions p { min-width: 0; flex: 1; margin: 0; color: var(--muted); font-size: .75rem; }
.employee-modal-actions button { min-height: 40px; padding: 0 15px; color: #fff; background: var(--primary); }
.employee-modal-actions button:hover { background: var(--primary-hover); }
.employee-modal-actions button:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }

.table-wrap {
  min-height: 150px;
  flex: 1;
  width: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th { position: sticky; z-index: 2; top: 0; padding: 13px 24px; color: var(--muted); background: #f9fafb; border-bottom: 1px solid var(--border); font-size: .71rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
td { padding: 15px 24px; border-bottom: 1px solid var(--border); font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.rotation-row { cursor: pointer; }
.rotation-row:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: -3px; }
.rotation-status { width: 1%; white-space: nowrap; text-align: center; }
.rotation-finalized-check { display: inline-grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; color: #fff; background: #16a34a; border-radius: 50%; font-size: .72rem; font-weight: 800; line-height: 1; }
.rotation-finalized-check.is-outdated { color: #713f12; background: #facc15; animation: rotation-status-spin 1.4s linear infinite; }
@keyframes rotation-status-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rotation-finalized-check.is-outdated { animation: none; } }
.rotation-delete-button { height: 32px; padding: 0 10px; color: var(--danger); background: #fff; border: 1px solid #fecaca; }
.rotation-delete-button:hover { background: #fef2f2; border-color: #fca5a5; }
.rotation-delete-button:focus-visible { outline: 3px solid rgba(185, 28, 28, .15); outline-offset: 2px; }
.badge { display: inline-block; padding: 3px 7px; color: #374151; background: #f3f4f6; border-radius: 4px; font: 600 .75rem var(--font-sans); }
.actions { width: 1%; white-space: nowrap; text-align: right; }
.action-menu { position: relative; display: inline-block; }
.menu-trigger { width: 30px; height: 30px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; font-size: 1rem; letter-spacing: 1px; line-height: 1; }
.menu-trigger:hover, .menu-trigger[aria-expanded="true"] { color: var(--text); background: #f3f4f6; border-color: var(--border); }
.menu-options { position: absolute; z-index: 5; top: 50%; right: calc(100% + 5px); display: grid; min-width: 120px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; box-shadow: 0 7px 18px rgba(0, 0, 0, .12); transform: translateY(-50%); text-align: left; }
.menu-options.is-floating { position: fixed; z-index: 100; right: auto; transform: none; }
.menu-options[hidden] { display: none; }
.menu-options button { display: block; width: 100%; padding: 7px 9px; background: transparent; border-radius: 3px; text-align: left; font-size: .78rem; }
.menu-options button:hover { background: #f3f4f6; }
.edit { color: var(--text); }.delete { color: var(--danger); }
.empty-state { display: grid; justify-items: center; padding: 36px 20px; text-align: center; }
.empty-state.hidden { display: none; }
.loading-state { display: flex; min-height: 150px; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: .86rem; }
.loading-spinner { width: 20px; height: 20px; border: 2px solid #dbeafe; border-top-color: var(--primary); border-radius: 50%; animation: loading-spin .7s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation-duration: 1.4s; } }
h3 { margin-bottom: 5px; font-size: .95rem; }.empty-state p { margin: 0; color: var(--muted); font-size: .86rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 24px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 18px 50px rgba(0, 0, 0, .18); overflow-y: auto; }
dialog::backdrop { background: rgba(17, 24, 39, .42); }
.confirm-dialog { width: min(360px, calc(100% - 32px)); }
.confirm-dialog h2 { margin-bottom: 8px; font-size: 1.08rem; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: .86rem; }
.confirm-dialog .modal-actions { margin-top: 22px; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-heading .eyebrow { margin-bottom: 6px; }
.modal-heading h2 { margin: 0; font-size: 1.25rem; }
form { display: grid; gap: 16px; margin-top: 24px; }
.shift-editor { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.shift-editor legend { padding: 0; color: #374151; font-size: .82rem; font-weight: 600; }
.shift-list { display: grid; gap: 8px; }
.shift-row { display: grid; grid-template-columns: 1fr 1fr 30px; align-items: end; gap: 8px; }
.shift-row label { gap: 4px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.shift-row input { height: 38px; }
.shift-days { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(7, 1fr); gap: 4px; padding-top: 1px; }
.shift-days label { position: relative; display: flex; align-items: center; justify-content: center; padding: 5px 2px; color: #9ca3af; background: #f9fafb; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: .68rem; text-decoration: line-through; }
.shift-days label:has(input:checked) { color: #fff; background: var(--primary); border-color: var(--primary); text-decoration: none; }
.shift-days label:has(input:focus-visible) { outline: 2px solid #93c5fd; outline-offset: 1px; }
.shift-days input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.remove-shift { width: 30px; height: 38px; color: var(--danger); background: #fef2f2; border: 1px solid #fee2e2; font-size: 1.15rem; line-height: 1; }
.remove-shift:hover { background: #fee2e2; }
.assignment-editor { padding-top: 2px; border-top: 1px solid var(--border); }
.assignment-editor h3 { margin: 14px 0 3px; font-size: .9rem; }
.assignment-editor > p { margin: 0 0 10px; color: var(--muted); font-size: .78rem; }
.assignment-list { display: grid; gap: 8px; }
.add-assignment { width: fit-content; margin-top: 10px; padding: 5px 0; color: var(--primary); background: transparent; font-size: .8rem; }
.add-assignment:hover { text-decoration: underline; }
.person-assignment { display: grid; gap: 10px; padding: 12px; background: #f9fafb; border: 1px solid var(--border); border-radius: 5px; }
.person-assignment h4 { margin: 0; font-size: .82rem; }
.close-modal { width: 30px; height: 30px; color: var(--muted); background: transparent; font-size: 1.6rem; font-weight: 400; line-height: 1; }
.close-modal:hover { color: var(--text); background: #f3f4f6; }
.modal-actions { position: sticky; bottom: -24px; display: flex; justify-content: flex-end; gap: 8px; margin: 4px -24px -24px; padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--border); }
.cancel-button { height: 40px; padding: 0 14px; color: #374151; background: #f3f4f6; }
.cancel-button:hover { background: #e5e7eb; }
.delete-modal { height: 40px; margin-right: auto; padding: 0 14px; color: var(--danger); background: #fef2f2; border: 1px solid #fee2e2; }
.delete-modal:hover { background: #fee2e2; }
.week-preview { display: grid; gap: 4px; padding: 12px 14px; color: var(--muted); background: #f8fafc; border: 1px solid var(--border); border-radius: 5px; font-size: .78rem; }
.week-preview span { font-weight: 600; }
.week-preview strong { color: var(--text); font-size: .88rem; text-transform: capitalize; }
.week-selector-fieldset { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.week-selector-fieldset legend { margin-bottom: 7px; padding: 0; color: #374151; font-size: .82rem; font-weight: 600; }
.week-selector-controls { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 8px; }
.selected-week-label { display: flex; height: 40px; align-items: center; justify-content: center; padding: 0 12px; color: var(--text); background: var(--surface); border: 1px solid #d1d5db; border-radius: 5px; font-size: .88rem; font-weight: 700; text-align: center; }
.week-step-button { height: 40px; color: var(--primary); background: #eff6ff; border: 1px solid #bfdbfe; font-size: 1.05rem; }
.week-step-button:hover { background: #dbeafe; }
.week-step-button:focus-visible, .current-week-button:focus-visible { outline: 3px solid rgba(29, 78, 216, .16); outline-offset: 2px; }
.current-week-button { width: fit-content; padding: 4px 0; color: var(--primary); background: transparent; font-size: .76rem; }
.current-week-button:hover { text-decoration: underline; }

.schedule-shell { width: min(1400px, calc(100% - 40px)); overflow-y: auto; }
.schedule-hero { flex: 0 0 auto; }
.rotation-top-header { padding-block: 9px; }
.rotation-header-inner { display: flex; width: min(1400px, 100%); align-items: center; gap: 14px; margin: 0 auto; }
.rotation-header-title { min-width: 0; flex: 1; margin: 0; overflow: hidden; font-size: 1rem; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.header-back-button { flex: 0 0 auto; padding: 8px 12px; color: #334155; background: var(--surface); border: 1px solid #cbd5e1; border-radius: 5px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); font-size: .8rem; font-weight: 700; text-decoration: none; }
.header-back-button:hover { color: var(--primary); background: #eff6ff; border-color: #93c5fd; }
.header-back-button:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 2px; }
.back-link { display: inline-flex; width: fit-content; align-items: center; color: var(--primary); font-size: .82rem; font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.back-link:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: 3px; }
.schedule-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.save-status { color: var(--muted); font-size: .78rem; font-weight: 600; text-align: right; }
.schedule-loading { min-height: 180px; }
.rotation-summary-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 11px 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font-size: .82rem; }
.rotation-summary-bar strong { color: var(--text); }
.conflict-summary { color: var(--danger); font-weight: 700; }
.station-list { display: grid; gap: 14px; padding-bottom: 8px; }
.station-card { overflow: hidden; background: #e3ebf5; border: 1px solid #b9c9dd; border-radius: 8px; }
.station-card[open] { box-shadow: 0 4px 12px rgba(30, 64, 175, .08); }
.station-card-header { display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; align-items: center; gap: 16px; padding: 17px 20px; background: #d5e1f0; cursor: pointer; list-style: none; }
.station-card-header::-webkit-details-marker { display: none; }
.station-card-header:focus-visible { outline: 3px solid rgba(29, 78, 216, .2); outline-offset: -3px; }
.station-header-copy h2 { margin: 0; color: #172554; font-size: 1.08rem; }
.station-header-copy p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; font-weight: 400; }
.station-coverage { padding: 4px 9px; color: #334155; background: #e2e8f0; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.station-chevron { display: grid; width: 24px; height: 24px; place-items: center; color: var(--muted); font-size: 0; line-height: 1; transform: rotate(-90deg); transform-origin: center; transition: transform .15s; }
.station-chevron::before { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ""; transform: rotate(45deg); transform-origin: center; }
.station-card[open] .station-chevron { transform: rotate(0); }
.station-turns { display: grid; gap: 14px; padding: 16px 20px 20px; background: #e3ebf5; border-top: 1px solid #b9c9dd; }
.station-empty { margin: 0; padding: 12px; color: var(--muted); background: #f9fafb; border-radius: 5px; font-size: .84rem; text-align: center; }
.turn-block { overflow: hidden; background: #eef4fb; border: 1px solid #c7d6ea; border-radius: 6px; }
.turn-heading { display: flex; min-height: 39px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 6px 8px 6px 14px; color: #1e3a8a; background: #e8f0fa; border-bottom: 1px solid #c7d6ea; }
.turn-heading-copy { display: flex; min-width: 0; flex: 1 1 260px; align-items: center; gap: 5px; }
.turn-heading h3 { margin: 0; font-size: .86rem; }
.turn-heading-bands { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 5px; }
.turn-heading-band { display: inline-flex; align-items: center; gap: 6px; }
.turn-heading-time { color: #334155; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.turn-heading-separator { color: #94a3b8; font-weight: 700; }
.turn-heading-actions { display: flex; min-width: 0; flex: 0 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.shift-band + .shift-band { border-top: 1px solid var(--border); }
.assignment-grid-wrap { overflow-x: auto; }
.assignment-grid { display: grid; min-width: 920px; grid-template-columns: repeat(7, minmax(125px, 1fr)); }
.day-assignment { display: grid; min-width: 0; gap: 6px; padding: 10px; border-right: 1px solid var(--border); transition: background .15s; }
.day-assignment:last-child { border-right: 0; }
.day-assignment.is-assigned .assignment-picker-button { background: #eff6ff; border-color: #dbeafe; }
.day-label { color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: capitalize; }
.assignment-select { height: 36px; padding: 0 8px; font-size: .78rem; }
.assignment-picker-button { width: 100%; overflow: hidden; color: var(--text); background: var(--surface); border: 1px solid #d1d5db; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.assignment-picker-button:hover { border-color: #93c5fd; background: #f8fafc; }
.assignment-picker-button:focus-visible { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.assignment-select.is-conflict { color: var(--danger); background: #fef2f2; border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, .1); }
.day-assignment .assignment-picker-button.is-conflict { color: var(--danger); background: #fef2f2; border-color: #ef4444; }
.day-assignment.is-unavailable { align-content: center; background: #f9fafb; }
.unavailable-label { color: #9ca3af; font-size: .73rem; font-style: italic; }
.person-picker-dialog { width: min(500px, calc(100% - 32px)); padding-bottom: 0; }
.person-picker-context { margin: 10px 0 18px; color: var(--muted); font-size: .78rem; text-transform: capitalize; }
.person-picker-search { gap: 6px; }
.person-picker-list { display: grid; max-height: min(330px, 42vh); gap: 5px; margin-top: 12px; overflow-y: auto; }
.person-picker-option { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; color: var(--text); background: var(--surface); border: 1px solid var(--border); text-align: left; }
.person-picker-option:hover { background: #eff6ff; border-color: #bfdbfe; }
.person-picker-option:focus-visible { outline: 3px solid rgba(29, 78, 216, .18); outline-offset: -2px; }
.person-picker-option.is-selected { background: #e0f2fe; border-color: #7dd3fc; }
.person-option-copy { display: grid; min-width: 0; gap: 2px; }
.person-option-copy strong { overflow: hidden; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.person-option-copy small { color: var(--muted); font-size: .7rem; font-weight: 500; }
.person-option-check { color: var(--primary); font-size: 1rem; font-weight: 800; }
.person-picker-empty { margin: 18px 0; color: var(--muted); font-size: .82rem; text-align: center; }
.person-picker-footer { position: sticky; bottom: -24px; margin: 16px -24px 0; padding: 12px 24px; background: var(--surface); border-top: 1px solid var(--border); }
.clear-assignment { width: 100%; height: 38px; color: var(--danger); background: #fef2f2; border: 1px solid #fee2e2; }
.clear-assignment:hover:not(:disabled) { background: #fee2e2; }
.clear-assignment:disabled { cursor: not-allowed; opacity: .45; }
.shift-time-dialog { width: min(420px, calc(100% - 32px)); }
.shift-time-context { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.local-change-note { margin: 0; padding: 10px 12px; color: #475569; background: #f8fafc; border: 1px solid var(--border); border-radius: 5px; font-size: .76rem; line-height: 1.45; }
.custom-shift-days { margin: 0; padding: 0; border: 0; }
.custom-shift-days legend { margin-bottom: 7px; padding: 0; color: #374151; font-size: .82rem; font-weight: 600; }
.custom-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.custom-days-grid label { position: relative; display: flex; align-items: center; justify-content: center; padding: 7px 2px; color: #9ca3af; background: #f9fafb; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: .68rem; text-decoration: line-through; }
.custom-days-grid label:has(input:checked) { color: #fff; background: var(--primary); border-color: var(--primary); text-decoration: none; }
.custom-days-grid label:has(input:focus-visible) { outline: 2px solid #93c5fd; outline-offset: 1px; }
.custom-days-grid input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.add-local-turn { width: fit-content; padding: 7px 10px; color: var(--primary); background: #fff; border: 1px solid #bfdbfe; }
.add-local-turn:hover { background: #eff6ff; }
.add-local-turn:focus-visible { outline: 3px solid rgba(29, 78, 216, .16); outline-offset: 2px; }

/* Autenticazione amministratore */
.default-password-warning { position: relative; display: flex; min-height: 31px; align-items: center; justify-content: center; padding: 7px 48px 7px 20px; color: #854d0e; background: #fefce8; border-bottom: 1px solid #fde68a; font-size: .75rem; font-weight: 600; text-align: center; }
.default-password-warning a { color: #854d0e; }
.default-password-warning-close { position: absolute; top: 50%; right: 14px; display: grid; width: 25px; height: 25px; place-items: center; padding: 0; color: #854d0e; background: transparent; border-radius: 50%; font-size: 1.15rem; line-height: 1; transform: translateY(-50%); }
.default-password-warning-close:hover { background: #fef3c7; }
.default-password-warning-close:focus-visible { outline: 2px solid #d97706; outline-offset: 1px; }
.login-page { height: auto; min-height: 100dvh; overflow-y: auto; background: #f8fafc; }
.login-header { background: var(--surface); }
.login-shell { display: grid; width: min(100% - 32px, 430px); min-height: calc(100dvh - 65px); margin: 0 auto; place-items: center; padding: 36px 0; }
.login-card { width: 100%; padding: 30px; box-shadow: 0 12px 36px rgba(15, 23, 42, .08); }
.login-heading { text-align: center; }
.login-heading .eyebrow { margin-bottom: 8px; }
.login-heading h1 { margin-bottom: 8px; font-size: 1.55rem; }
.login-heading > p:last-child { margin: 0; color: var(--muted); font-size: .86rem; }
.login-form label { gap: 7px; }
.login-form input { height: 43px; }
.login-form button { min-height: 43px; color: #fff; background: var(--primary); }
.login-form button:hover { background: var(--primary-hover); }
.login-message { margin: -4px 0 0; padding: 10px 12px; color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 5px; font-size: .8rem; }
.login-personal-link { display: block; margin-top: 22px; color: var(--primary); font-size: .8rem; font-weight: 700; text-align: center; text-decoration: none; }
.login-personal-link:hover { text-decoration: underline; }
.credentials-settings { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.credentials-settings label { max-width: 560px; }
.credentials-settings label small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.optional-label { color: var(--muted); font-size: .72rem; font-weight: 400; }
.settings-notice { padding: 11px 13px; color: #854d0e; background: #fefce8; border: 1px solid #fde68a; border-radius: 5px; font-size: .8rem; }
.session-settings { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.settings-logout-button { flex: 0 0 auto; height: 40px; padding: 0 14px; color: var(--danger); background: #fff; border: 1px solid #fecaca; }
.settings-logout-button:hover { background: #fef2f2; border-color: #fca5a5; }
.settings-logout-button:focus-visible { outline: 3px solid rgba(185, 28, 28, .15); outline-offset: 2px; }

@media (max-width: 700px) { .page-nav { justify-content: center; overflow: visible; padding-inline: 100px; } .directory-topline { align-items: flex-start; flex-direction: column; } .list-tools { width: 100%; } .search-field { flex: 1; min-width: 0; } }
@media (max-width: 700px) { .company-logo-layout { grid-template-columns: 1fr; gap: 14px; } .company-logo-preview { height: 160px; } .company-logo-controls { gap: 12px; } }
@media (max-width: 700px) { .header-company-logo { max-width: 72px; height: 30px; } }
@media (max-width: 480px) { .top-header { padding-inline: 12px; } .page-nav { gap: 6px; padding-inline: 60px; } .page-nav > a:not(.settings-nav-link) { min-width: 88px; padding-inline: 10px; } .header-company-logo { left: 12px; max-width: 40px; height: 28px; } .header-tools { right: 12px; } }
@media (max-width: 580px) { body { height: auto; min-height: 100dvh; overflow-y: auto; } .app-shell { width: min(100% - 28px, 1060px); padding: 24px 0; overflow: visible; } .directory-card { flex: none; } .table-wrap { max-height: max(220px, calc(100dvh - 390px)); } .hero { align-items: flex-start; flex-direction: column; margin-bottom: 16px; } .schedule-actions { width: 100%; align-items: stretch; flex-direction: column; } .save-status { text-align: left; } .schedule-actions .add-button { width: 100%; } .rotation-summary-bar { align-items: flex-start; flex-direction: column; } .station-card-header { grid-template-columns: minmax(0, 1fr) 24px; padding: 14px; } .station-coverage { grid-column: 1 / -1; grid-row: 2; width: fit-content; } .station-chevron { grid-column: 2; grid-row: 1; } .station-turns { padding: 12px; } .shift-band-heading { align-items: flex-start; flex-direction: column; } .directory-topline { padding: 18px; } .list-tools { align-items: stretch; flex-direction: column; } .add-button { width: 100%; } th, td { padding: 13px 14px; } th:nth-child(3), td:nth-child(3) { display: none; } .actions { padding-left: 4px; } dialog { padding: 20px; } .modal-actions { bottom: -20px; margin: 4px -20px -20px; padding: 12px 20px; } }
@media (max-width: 580px) { .rotation-header-inner { flex-wrap: wrap; } .rotation-header-inner .schedule-actions { flex: 1 0 100%; width: auto; align-items: center; flex-direction: row; margin-left: 0; } .rotation-header-inner .save-status { flex: 1; text-align: left; } .rotation-header-inner .schedule-actions .add-button { width: auto; } .person-picker-footer { bottom: -20px; margin: 16px -20px 0; padding: 12px 20px; } }
@media (max-width: 580px) { .register-shell, .rotations-shell { padding-top: 16px; } .directory-topline > .register-switch { align-self: stretch; min-width: 0; } .register-tab { min-width: 0; flex: 1; padding-inline: 10px; } }
@media (max-width: 580px) { .logo-settings .settings-actions { align-items: stretch; flex-direction: column; } .logo-settings .settings-status { width: 100%; overflow-wrap: anywhere; line-height: 1.35; } .logo-settings .settings-actions button { width: 100%; } }
@media (max-width: 580px) { .finalized-list-wrap { padding: 10px; } .finalization-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 13px; } .finalization-card-stats { grid-column: 1; grid-row: 2; white-space: normal; } .finalization-card-arrow { grid-column: 2; grid-row: 1 / 3; } .finalization-modal-heading { top: -20px; margin: -20px -20px 16px; padding: 17px 20px 14px; } .person-schedule-heading { align-items: stretch; flex-direction: column; } .download-person-schedule { width: 100%; } }
@media (max-width: 580px) { .person-schedule-actions { width: 100%; } .person-schedule-actions button { min-width: 0; flex: 1; } }
@media (max-width: 580px) { .employee-header { min-height: 58px; } .employee-shell { width: min(100% - 28px, 820px); padding: 24px 0 48px; } .employee-shell:has(.employee-lookup-card[hidden]) { padding-top: 16px; } .employee-intro { margin-bottom: 18px; } .employee-intro h1 { font-size: 1.8rem; } .employee-lookup-card { padding: 18px; } .employee-lookup-controls { grid-template-columns: 1fr; } .employee-results { margin-top: 30px; } .employee-lookup-card[hidden] + .employee-results { margin-top: 0; } .employee-results-heading { align-items: flex-start; flex-direction: column; } .employee-secondary-button { width: 100%; } .employee-rotation-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px; } .employee-shift-count { grid-column: 1; grid-row: 2; width: fit-content; } .employee-rotation-arrow { grid-column: 2; grid-row: 1 / 3; } .employee-schedule-modal { max-height: calc(100dvh - 20px); } .employee-modal-heading { padding: 17px 16px 14px; } .employee-schedule-table { margin: 12px; } .employee-schedule-table-head, .employee-schedule-row { grid-template-columns: 88px minmax(0, 1fr) 110px; } .employee-schedule-table-head { font-size: .58rem; } .employee-schedule-table-head span, .employee-schedule-date { padding-inline: 8px; } .employee-schedule-date strong { font-size: .72rem; } .employee-schedule-date span { font-size: .62rem; } .employee-schedule-row-shifts:has(.employee-schedule-rest)::after { right: 110px; left: auto; } .employee-schedule-table-shift { grid-template-columns: minmax(0, 1fr) 110px; } .employee-schedule-station, .employee-schedule-time { padding-inline: 8px; } .employee-schedule-station strong { font-size: .72rem; } .employee-schedule-station span { font-size: .6rem; } .employee-schedule-time { font-size: .66rem; } .employee-modal-actions { align-items: stretch; flex-direction: column; padding: 12px 16px; } .employee-modal-actions button { width: 100%; } }
@media (max-width: 580px) { .login-shell { min-height: calc(100dvh - 59px); padding: 24px 0; } .login-card { padding: 22px; } .settings-card { padding: 20px; } .credentials-settings .settings-actions { align-items: stretch; flex-direction: column; } .credentials-settings .settings-actions .add-button { width: 100%; } .session-settings { align-items: stretch; flex-direction: column; } .settings-logout-button { width: 100%; } .default-password-warning { padding: 7px 44px 7px 12px; } .default-password-warning-close { right: 10px; } }
