/* Agenda Visite — foglio di stile */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #F8F9F6;
  --line: #DADDD6;
  --line-soft: #ECEEE9;
  --line-strong: #C9CDC5;
  --ink: #1A1F23;
  --ink-2: #3A4147;
  --muted: #545B61;
  --faint: #6B7177;
  --brand: #0E5A61;
  --brand-ink: #0A4247;
  --brand-soft: #E2EEEE;
  --warn-bg: #FBEBD8;
  --warn-ink: #7E3F0E;
  --warn: #C46A1F;
  --danger: #B42318;
  --danger-bg: #F7E1DF;
  --ok-bg: #E2EEEE;
  --ok-ink: #0A4247;
  --info-bg: #E3EAF6;
  --info-ink: #1E3E73;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-pop: 0 14px 36px rgba(0,0,0,.18);
  --font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); }
a:hover { color: var(--brand-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
input, select, textarea, button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; display: flex; }
.side-col { flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar { width: var(--sidebar); flex-shrink: 0; display: flex; flex-direction: column; gap: 24px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 16px; font-weight: 600; }
.brand-text span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); text-decoration: none; font-weight: 500; color: var(--ink-2); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav a .label { flex-grow: 1; }
.nav-badge { font-size: 12px; font-weight: 600; background: var(--warn-bg); color: var(--warn-ink); padding: 1px 8px; border-radius: 999px; }
.nav-sep { height: 1px; background: var(--line-soft); margin: 8px 6px; }
.side-spacer { flex-grow: 1; }
.side-team { padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.side-team .avatars { display: flex; align-items: center; }
.side-team .avatars .avatar { margin-right: -6px; border: 2px solid var(--surface); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--line-soft); }
.side-user a { flex-grow: 1; min-width: 0; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.side-user a span { font-size: 12px; color: var(--muted); }
.label-up { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.main { flex-grow: 1; min-width: 0; padding: 26px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head .kicker { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.cols-400 { grid-template-columns: minmax(0, 1fr) 400px; }
.cols-380 { grid-template-columns: minmax(0, 1fr) 380px; }
.cols-360 { grid-template-columns: minmax(0, 1fr) 360px; }
.cols-left { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.cols > *, .cols-left > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- componenti ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.card-head + .card-body { padding-top: 0; }
.card-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.section { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line-soft); }
.section:first-child { border-top: none; }
.list-item { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.list-item .grow { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-danger { color: var(--danger); border-color: #E6B8B3; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-ink); font-weight: 600; padding: 0 8px; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 88px; }
.select { padding: 0 10px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); outline: 2px solid rgba(14,90,97,.18); outline-offset: 0; }
.input[readonly], .textarea[readonly] { background: var(--surface-2); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex-shrink: 0; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); }
.search input { border: none; outline: none; background: transparent; flex-grow: 1; min-width: 0; font-size: 14px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 14px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:has(input:checked) { border: 1.5px solid var(--brand); background: var(--brand-soft); font-weight: 600; }
.pill:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: #ECEEE9; color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-danger { background: var(--danger-bg); color: #8A2424; }
.badge-neutral { background: #ECEEE9; color: var(--ink-2); }
.count { font-size: 12px; font-weight: 600; background: var(--warn-bg); color: var(--warn-ink); padding: 2px 9px; border-radius: 999px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; color: #fff; font-weight: 600; line-height: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="false"] { border-style: dashed; color: var(--muted); text-decoration: line-through; }
.chip[aria-pressed="false"] .avatar { background: #8A9096 !important; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-bottom: 2px solid transparent; text-decoration: none; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tabs a.active { border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 11px 16px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.table tr:hover td { background: #FBFCFA; }
.table .num { text-align: right; }
.table a.strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.table a.strong:hover { color: var(--brand); text-decoration: underline; }
.cell-stack { display: flex; flex-direction: column; gap: 3px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; }
.filters .field { min-width: 150px; }
.filters .grow { flex-grow: 1; min-width: 220px; }

.dl { margin: 0; display: grid; grid-template-columns: 124px minmax(0, 1fr); row-gap: 11px; column-gap: 12px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 14px; }
.flash-success { background: var(--ok-bg); border-color: #B9D6D4; color: var(--ok-ink); }
.flash-info { background: #E9EEF7; border-color: #C3D0E8; color: #1C3B6B; }
.flash-warning { background: var(--warn-bg); border-color: #EBC79F; color: var(--warn-ink); }
.flash-error { background: var(--danger-bg); border-color: #E6B8B3; color: #8A2424; }
.flash button { margin-left: auto; border: none; background: transparent; cursor: pointer; color: inherit; padding: 0 4px; font-size: 18px; line-height: 1; }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

/* timeline scheda azienda */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 96px 20px minmax(0, 1fr); column-gap: 12px; }
.tl-date { display: flex; flex-direction: column; padding-top: 2px; text-align: right; }
.tl-date strong { font-size: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px currentColor; background: currentColor; }
.tl-line { flex-grow: 1; width: 2px; background: var(--line-soft); margin-top: 6px; }
.tl-body { display: flex; flex-direction: column; gap: 8px; padding-bottom: 22px; min-width: 0; }
.tl-docs { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.tl-doc { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; }

/* report: azioni concordate */
.actions-table { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.actions-table table { width: 100%; min-width: 560px; border-collapse: collapse; }
.actions-table th { text-align: left; padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); }
.actions-table td { padding: 4px 6px; border-top: 1px solid var(--line-soft); }
.actions-table input { width: 100%; min-height: 40px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; background: transparent; }
.actions-table input:hover { border-color: var(--line); }
.actions-table input:focus { border-color: var(--brand); outline: none; background: var(--surface); }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border: 1.5px dashed #A9AEA6; border-radius: 10px; background: #FAFBF9; text-align: center; cursor: pointer; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.file-row .name { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.steps .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #8A9096; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.steps .on { color: var(--brand-ink); font-weight: 600; }
.steps .on .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps .sep { width: 24px; height: 1px; background: var(--line-strong); }

.sticky-side { position: sticky; top: 20px; }
.agenda-slot { display: flex; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-soft); }
.agenda-slot.current { background: var(--brand-soft); border: 1.5px solid var(--brand); }
.agenda-slot.clash { background: var(--danger-bg); border: 1.5px solid var(--danger); }
.agenda-slot .t { width: 92px; flex-shrink: 0; font-family: var(--mono); font-size: 12px; color: var(--ink-2); padding-top: 2px; }

/* login */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- calendario (FullCalendar) ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cal-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-title h1 { font-size: 24px; }
.cal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.segmented { display: flex; padding: 3px; background: #E6E8E3; border-radius: 10px; }
.segmented button { min-height: 38px; padding: 0 14px; border: none; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.1); font-weight: 600; }
.segmented a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: inherit; text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.1); font-weight: 600; }
.importers-nav { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.cal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-card { padding: 0; overflow: hidden; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-box { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

#calendar { --fc-border-color: var(--line-soft); --fc-today-bg-color: #F4F9F8; --fc-now-indicator-color: var(--danger); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); font-size: 13px; }
#calendar .fc-scrollgrid { border: none; }
#calendar .fc-col-header-cell { padding: 8px 0; background: var(--surface); }
#calendar .fc-col-header-cell-cushion { color: var(--ink-2); font-weight: 600; text-decoration: none; text-transform: capitalize; }
#calendar .fc-day-today .fc-col-header-cell-cushion { color: var(--brand-ink); background: var(--brand-soft); border-radius: 999px; padding: 3px 10px; }
#calendar .fc-timegrid-slot { height: 28px; }
#calendar .fc-timegrid-slot-label-cushion, #calendar .fc-timegrid-axis-cushion { font-family: var(--mono); font-size: 11px; color: var(--muted); }
#calendar .fc-timegrid-slot-minor { border-top-style: none; }
#calendar .fc-daygrid-day-number { color: var(--ink); text-decoration: none; font-size: 13px; padding: 6px 8px; }
#calendar .fc-day-other .fc-daygrid-day-number { color: var(--faint); }
#calendar .fc-day-today .fc-daygrid-day-number { background: var(--brand); color: #fff; border-radius: 999px; min-width: 26px; text-align: center; margin: 4px; padding: 3px 6px; }
#calendar .fc-day-sat, #calendar .fc-day-sun { background: #FAFBF9; }
#calendar .fc-event { border-radius: 7px; border-width: 1.5px; cursor: pointer; }
#calendar .fc-timegrid-event { box-shadow: none; }
#calendar .fc-timegrid-event .fc-event-main { padding: 3px 6px; }
#calendar .ev-inviato, #calendar .ev-da_compilare, #calendar .ev-bozza { border-width: 1px; }
#calendar .ev-annullato { opacity: .7; text-decoration: line-through; }
#calendar .fc-event.fc-event-dragging, #calendar .fc-event.fc-event-mirror { box-shadow: 0 10px 24px rgba(0,0,0,.2); opacity: .95; }
#calendar .fc-event-draggable { cursor: grab; }
#calendar .fc-highlight { background: rgba(14,90,97,.12); }
#calendar .fc-daygrid-event { padding: 1px 4px; font-size: 12px; white-space: nowrap; overflow: hidden; }
#calendar .fc-daygrid-dot-event .fc-event-title { font-weight: 500; }
#calendar .fc-more-link { font-size: 12px; color: var(--ink-2); }
#calendar .fc-list-event:hover td { background: var(--surface-2); }
#calendar .fc-list-day-cushion { background: var(--surface-2); text-transform: capitalize; }

.ev { display: flex; flex-direction: column; gap: 1px; height: 100%; overflow: hidden; line-height: 1.25; }
.ev-top { display: flex; align-items: center; gap: 6px; }
.ev-time { font-family: var(--mono); font-size: 11px; }
.ev-ini { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ev-title { font-weight: 600; font-size: 13px; }
.ev-sub { font-size: 12px; }
.ev-tag { align-self: flex-start; margin-top: 2px; font-size: 11px; font-weight: 600; background: #fff; color: var(--warn-ink); padding: 1px 6px; border-radius: 4px; }
.ev-tag-bozza { color: var(--info-ink); }
.ev-done { font-size: 11px; font-weight: 500; }
.ev-month { display: flex; align-items: center; gap: 5px; overflow: hidden; }
.ev-month .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ev-month .txt { overflow: hidden; text-overflow: ellipsis; }

/* dettaglio evento */
.pop { position: fixed; z-index: 60; right: 24px; top: 24px; width: 380px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pop[hidden] { display: none; }
.pop-head { display: flex; align-items: flex-start; gap: 8px; }
.pop-head .grow { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.pop-move { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pop-move .btn { padding: 0 4px; font-size: 13px; }

.toast { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); width: 600px; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 16px; border-radius: 10px; background: #1F2A2E; color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.22); font-size: 14px; }
.toast.warn { background: #7E3F0E; }
.toast.err { background: #8A2424; }
.toast[hidden] { display: none; }
/* post-it nuovi a comparsa (notifiche istantanee) */
.note-pop { position: fixed; z-index: 80; top: 16px; right: 16px; width: 340px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.note-pop:empty { display: none; }
.note-pop-card { position: relative; pointer-events: auto; padding: 12px 40px 12px 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: #FFF1B3; color: #1F2A2E; box-shadow: 0 10px 28px rgba(0,0,0,.18); font-size: 14px; animation: note-pop-in .25s ease-out; }
.note-pop-head { font-size: 13px; margin-bottom: 4px; }
.note-pop-text { white-space: pre-line; overflow-wrap: anywhere; }
.note-pop-due { font-size: 12px; margin-top: 6px; opacity: .8; }
.note-pop-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.note-pop-foot .btn { background: rgba(255,255,255,.7); }
.note-pop-more { background: var(--surface-2, #F8F9F6); }
.note-pop-x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border: none; background: transparent; color: inherit; font-size: 18px; cursor: pointer; border-radius: 8px; }
.note-pop-x:hover { background: rgba(0,0,0,.06); }
@keyframes note-pop-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .note-pop-card { animation: none; } }
@media (max-width: 760px) { .note-pop { top: 64px; left: 16px; right: 16px; width: auto; max-width: none; } }
.toast .msg { flex-grow: 1; }
.toast .btn { min-height: 38px; background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.toast .x { width: 38px; height: 38px; border: none; background: transparent; color: #fff; cursor: pointer; font-size: 18px; border-radius: 8px; }

/* ---------- geolocalizzazione ---------- */
.geo-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.geo-status { margin: 0; font-size: 13px; color: var(--ink-2); }
.geo-status:empty { display: none; }
.geo-status.ok { color: var(--brand-ink); }
.geo-status.warn { color: var(--warn-ink); }
.geo-status.err { color: #8A2424; }
.geo-map { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: #E6E8E3; }
.geo-view { height: 220px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: #E6E8E3; }
@media (max-width: 760px) { .geo-map { height: 240px; } }

/* ---------- elenco appuntamenti stampabile ---------- */
.print-list { padding: 22px 26px; }
.pl-head { border-bottom: 2px solid var(--brand); padding-bottom: 10px; margin-bottom: 6px; }
.pl-org { font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.pl-title { font-size: 22px; margin: 4px 0 2px; }
.pl-period { color: var(--muted); }
.pl-day { margin-top: 18px; }
.pl-day-title { break-after: avoid; }
.pl-day-title { font-size: 15px; padding: 6px 10px; background: var(--brand-soft); color: var(--brand-ink); border-radius: 6px; margin-bottom: 4px; }
.pl-count { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.pl-today { font-size: 11px; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.pl-company { width: 24%; }
.pl-ref { width: 18%; }
.pl-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.pl-table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pl-table tr { break-inside: avoid; }
.pl-time { width: 96px; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.pl-type { width: 150px; }
.pl-who { width: 150px; }
.pl-notes { width: 26%; color: var(--ink-2); }
.pl-muted { color: var(--muted); font-size: 12px; }
a.pl-map { text-decoration: none; }
a.pl-map:hover { text-decoration: underline; }
.pl-cancelled td { color: var(--faint); text-decoration: line-through; }
.pl-foot { margin-top: 18px; font-size: 11px; color: var(--faint); }
@media (max-width: 760px) {
  .print-list { padding: 14px; overflow-x: auto; }
  .pl-table { min-width: 720px; }
}

/* ---------- stampa ---------- */
@media print {
  .side-col, .sidebar, .topbar, .bottomnav, .actions, .filters, .btn, .no-print, .flashes, .fab, .crumbs { display: none !important; }
  .shell { display: block; }
  .card { border: none; box-shadow: none; }
  .print-list { padding: 0; }
  .pl-table { font-size: 10.5pt; min-width: 0; }
  .pl-day-title { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 12mm; }
  .main { padding: 0; }
  body { background: #fff; }
}

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  .sidebar { width: 76px; padding: 18px 10px; align-items: center; }
  .brand-text, .nav a .label, .nav-badge, .side-team, .side-user a, .side-user form { display: none; }
  .brand { padding: 0; }
  .nav a { width: 52px; height: 52px; padding: 0; justify-content: center; position: relative; }
  .nav a .nav-badge-dot { display: flex; }
  .side-user { padding: 14px 0 0; justify-content: center; }
  .main { padding: 22px 22px 40px; }
  .cols, .cols-left, .cols-400, .cols-380, .cols-360 { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
}
.nav-badge-dot { display: none; position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 10px; font-weight: 600; align-items: center; justify-content: center; }

/* ---------- smartphone ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .side-col { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 40; height: 56px; align-items: center; gap: 10px; padding: 0 12px 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .title { font-size: 17px; font-weight: 600; flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 4px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; }
  .bottomnav a { position: relative; min-width: 58px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-2); font-size: 11px; font-weight: 500; }
  .bottomnav a .ic { width: 52px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
  .bottomnav a.active { color: var(--brand-ink); font-weight: 600; }
  .bottomnav a.active .ic { background: var(--brand-soft); }
  .bottomnav .nav-badge-dot { display: flex; top: 0; right: 6px; }
  .main { padding: 14px 12px 104px; gap: 14px; }
  h1 { font-size: 22px; }
  .cal-title h1 { font-size: 20px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .input, .select, .textarea { font-size: 16px; } /* evita lo zoom automatico su iOS */
  .hide-sm { display: none !important; }
  .page-head { align-items: flex-start; }
  .filters { padding: 12px; }
  .filters .field { min-width: 0; flex: 1 1 140px; }
  .tl-item { grid-template-columns: 70px 16px minmax(0, 1fr); column-gap: 8px; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .pop { left: 8px; right: 8px; top: auto; bottom: 76px; width: auto; }
  .toast { top: 64px; bottom: auto; }
  .fab { display: flex; position: fixed; right: 16px; bottom: 84px; z-index: 44; width: 56px; height: 56px; border-radius: 16px; background: var(--brand); color: #fff; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(14,90,97,.35); }
  .card-foot.sticky-sm { position: sticky; bottom: 68px; z-index: 30; }
  .steps { display: none; }
  .table-cards thead { display: none; }
  .table-cards tr { display: block; border-top: 1px solid var(--line-soft); padding: 10px 4px; }
  .table-cards td { display: flex; gap: 10px; border: none; padding: 4px 12px; }
  .table-cards td::before { content: attr(data-label); flex: 0 0 104px; font-size: 12px; color: var(--muted); padding-top: 2px; }
  .table-cards td.main-cell::before { display: none; }
  .table-cards td.num { text-align: left; }
}
.bottomnav, .fab { display: none; }
@media (max-width: 760px) { .bottomnav { display: flex; } .fab { display: flex; } }

/* =====================================================================
   Sopralluogo in visita (tablet / smartphone), firme e validazione
   ===================================================================== */
:root { --nc: #A3360F; --nc-bg: #FBE6DD; --nc-line: #EBC9B9; --auto-bg: #E6EDF7; --auto-ink: #1F4A85; }
.btn-lg { min-height: 52px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.grow { flex-grow: 1; }
.vs-auto { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; background: var(--auto-bg); color: var(--auto-ink); white-space: nowrap; vertical-align: middle; }
.prio { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.prio-U { background: #F9E0DC; color: #8E1B10; } .prio-A { background: #FBEBD8; color: #7E3F0E; }
.prio-M { background: #F3EBC6; color: #5A4800; } .prio-B { background: #ECEEE9; color: var(--ink-2); }
.vs-warning { display: flex; align-items: flex-start; gap: 6px; color: var(--warn-ink); margin: 0; }
.vs-warning svg { flex-shrink: 0; margin-top: 2px; }

/* avvio */
.vs-module { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.vs-module .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-module-ic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.vs-start-list { list-style: none; margin: 0; padding: 0; }
.vs-start-list li { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.vs-start-list li .mono { width: 28px; }

/* struttura della pagina di compilazione */
.visit-page .main { padding-bottom: 0; }
.vs { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.vs-head { position: sticky; top: 0; z-index: 35; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 4px; margin: -8px 0 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.vs-head-t { display: flex; flex-direction: column; min-width: 0; flex-grow: 1; }
.vs-head-t strong { font-size: 16px; }
.vs-back { border: none; background: transparent; }
.vs-save { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; white-space: nowrap; }
.vs-save.saving { background: #ECEEE9; color: var(--ink-2); }
.vs-save.offline { background: var(--warn-bg); color: var(--warn-ink); }
.vs-save.error { background: var(--danger-bg); color: #8A2424; }
.vs-banner { margin: 0; }
.vs-banner .btn { flex-shrink: 0; }
.vs-body { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 20px; align-items: start; }
.vs-rail { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); max-height: calc(100vh - 90px); overflow-y: auto; }
.vs-rail-top { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px 12px; }
.vs-bar { height: 6px; border-radius: 3px; background: #E6E8E3; overflow: hidden; }
.vs-bar > div { height: 100%; background: var(--brand); transition: width .3s; }
.vs-rail-item { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 10px; border: none; border-radius: 10px; background: transparent; text-align: left; text-decoration: none; color: var(--ink); cursor: pointer; font: inherit; }
.vs-rail-item:hover { background: var(--surface-2); color: var(--ink); }
.vs-rail-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.vs-rail-item.active .vs-rail-t > span:first-child { font-weight: 600; }
.vs-rail-n { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid #8A9096; background: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-2); }
.vs-rail-n.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.vs-rail-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.3; }
.vs-rail-m { display: flex; gap: 8px; font-size: 12px; font-weight: 400; color: var(--muted); }
.vs-rail-nc { font-weight: 600; color: var(--nc); }
.vs-fs { border: none; margin: 0; padding: 0; min-width: 0; }
.vs-main { display: flex; flex-direction: column; gap: 16px; }
.vs-sec { display: flex; flex-direction: column; gap: 14px; }
.vs[data-js] .vs-sec:not(.current) { display: none; }
.vs-sec-head { display: flex; flex-direction: column; gap: 4px; }
.vs-sec-head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.vs-sec-head p { margin: 0; max-width: 760px; }
.vs-legend { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vs-group { overflow: hidden; }
.vs-group-t { padding: 12px 16px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.vs-counters { display: flex; gap: 10px; flex-wrap: wrap; }
.vs-counters > span { display: flex; flex-direction: column; padding: 8px 14px; border-radius: 10px; min-width: 104px; font-size: 12px; color: var(--ink-2); }
.vs-counters b { font-size: 20px; font-weight: 600; }
.vs-foot { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 0 16px; background: linear-gradient(to bottom, rgba(243,244,241,0), var(--bg) 30%); }
.vs-fields .field-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* domanda */
.q { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 80px; }
.q:last-child { border-bottom: none; }
.q.is-neg { background: #FFFBF8; }
.q-main { display: flex; align-items: center; gap: 14px; }
.q-num { width: 40px; flex-shrink: 0; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted); }
.q-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.q-text { font-size: 15px; line-height: 1.4; }
.q-ref { font-size: 12px; color: var(--muted); }
.q-more { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 54px; }
.q-more .input { min-height: 40px; }
.q-note { flex: 1 1 220px; min-width: 0; }
.q-mini { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.q-mini .input { width: 64px; min-height: 40px; }
.q-date .input { width: 150px; }
.q-misure { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.q-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--warn-ink); }

/* pulsanti di scelta */
.vs-seg { display: flex; gap: 6px; flex-shrink: 0; }
.vs-seg-wrap { flex-wrap: wrap; }
.vs-seg-col { flex-direction: column; align-items: stretch; }
.vs-seg-wide .vs-opt { flex: 1 1 0; }
.vs-opt { position: relative; display: inline-flex; }
.vs-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.vs-opt span { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-width: 56px; min-height: 48px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; user-select: none; }
.vs-opt-pill span { min-width: 0; padding: 0 14px; }
.vs-opt-sm span { min-height: 40px; min-width: 0; padding: 0 10px; font-size: 13px; }
.vs-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.vs-opt input:checked + span { border: 1.5px solid var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.vs-opt.k-c input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.vs-opt.k-nc input:checked + span { background: var(--nc); border-color: var(--nc); color: #fff; }
.vs-opt.k-na input:checked + span { background: #545B61; border-color: #545B61; color: #fff; }
.vs-opt.k-pU input:checked + span { background: #F9E0DC; border-color: #8E1B10; color: #8E1B10; }
.vs-opt.k-pA input:checked + span { background: #FBEBD8; border-color: #7E3F0E; color: #7E3F0E; }
.vs-opt.k-pM input:checked + span { background: #F3EBC6; border-color: #5A4800; color: #5A4800; }
.vs-opt.k-pB input:checked + span { background: #ECEEE9; border-color: #3A4147; color: #3A4147; }
.vs-opt.k-esito-urgenti input:checked + span { background: var(--nc-bg); border-color: var(--nc); color: var(--nc); }
.vs-opt-check span { min-width: 0; padding: 0 14px; justify-content: flex-start; }
.vs-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.vs-checks .vs-opt span { justify-content: flex-start; text-align: left; line-height: 1.3; padding: 6px 12px; font-size: 13px; }
.vs-fs[disabled] .vs-opt span, .vs-fs[disabled] .input, .vs-fs[disabled] .textarea, .vs-fs[disabled] .select { cursor: default; }
.vs-fs[disabled] .nc-ph-add, .vs-fs[disabled] .lrow-del, .vs-fs[disabled] [data-add-list], .vs-fs[disabled] .nc-ph-del, .vs-fs[disabled] .ve-del, .vs-fs[disabled] .ve-add { display: none; }

/* rilievo */
.nc-box { margin-left: 54px; padding: 14px; border-radius: 10px; border: 1px solid var(--nc-line); background: #fff; display: flex; flex-direction: column; gap: 12px; }
.nc-head { display: flex; align-items: center; gap: 10px; color: var(--nc); }
.nc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nc-grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: end; }
.nc-grid .textarea { min-height: 72px; }
.nc-photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.nc-ph { position: relative; margin: 0; width: 120px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-strong); background: #D9DDD5; }
.nc-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nc-ph.uploading { opacity: .5; }
.nc-ph-del { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(26,31,35,.75); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.nc-ph-add { position: relative; width: 120px; height: 90px; border-radius: 8px; border: 1.5px dashed var(--line-strong); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--brand-ink); cursor: pointer; }
.nc-ph-add:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* righe ripetibili */
.vs-list { display: flex; flex-direction: column; gap: 10px; }
.vs-list:not(:empty) + .vs-list-empty { display: none; }
.lrow { position: relative; display: grid; gap: 10px; padding: 12px 52px 12px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-2); }
.lrow-del { position: absolute; top: 6px; right: 6px; }
.lrow-nuovo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lrow-nuovo .lrow-wide { grid-column: span 2; }
.lrow-oss { grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(4, minmax(0, .6fr)); }
.lrow-oss .field:nth-child(-n+2) { grid-column: span 2; }
.lrow-oss .field:nth-child(n+3) { grid-column: span 1; }
.lrow-oss { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lrow-oss .textarea { min-height: 60px; }
.lrow-doc { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
.lrow-ore { grid-template-columns: minmax(0, 1fr) 72px; }
.lrow-prev { grid-template-columns: minmax(0, 1fr) 160px; align-items: center; padding-right: 12px; }
/* anagrafica azienda: codice ATECO con descrizione e rischio */
.ateco-grid { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr) minmax(0, 120px); gap: 0 16px; }
.ateco-grid > .hint { grid-column: 1 / -1; margin-top: 6px; }
.ateco-grid .field { position: relative; }
.ateco-risk[data-level="BASSO"] { background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }
.ateco-risk[data-level="MEDIO"] { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.ateco-risk[data-level="ALTO"] { background: var(--danger-bg); color: #8A2424; font-weight: 600; }
.ateco-list { position: absolute; top: 100%; left: 0; z-index: 30; width: min(640px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.ateco-list li { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 40px; padding: 6px 8px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.ateco-list li:hover, .ateco-list li[aria-selected="true"] { background: var(--surface-2); }
.ateco-list .ateco-d { line-height: 1.3; }
.ateco-list li.ateco-none { display: block; color: var(--muted); cursor: default; background: none; }
/* impostazioni → codici ATECO */
.ateco-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ateco-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-2); }
.ateco-sum strong { font-size: 22px; font-weight: 600; }
.ateco-companies { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; max-height: 320px; overflow-y: auto; }
.ateco-details { display: block; padding-top: 12px; padding-bottom: 12px; }
.ateco-details > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.ateco-details[open] > summary { margin-bottom: 10px; }
.ateco-details .table-wrap { margin: 0 -22px; }
.ateco-file { padding: 9px 12px; }
@media (max-width: 760px) { .ateco-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ateco-details .table-wrap { margin: 0 -16px; } }
/* Impostazioni → Importa aziende (riusa riepilogo ed elenchi della pagina ATECO) */
.import-sum { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.import-changes { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 760px) { .import-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ateco-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ateco-list { width: 100%; }
  .ateco-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .ateco-list li .ateco-d { grid-column: 1 / -1; grid-row: 2; }
}
.lrow-ref { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lrow-ref .check { grid-column: 1 / -1; min-height: 32px; }

/* sezione 06 */
.vs-ril td { font-size: 13px; vertical-align: top; }
.vs-ril a.mono { font-weight: 600; }
.vs-prio-sum { display: flex; gap: 6px; align-items: center; }
.vs-auto-hint { color: var(--auto-ink); }
.vs-close-grid { align-items: start; }

/* una domanda alla volta (smartphone) */
.vs-oneq-pos { display: none; }
.vs.oneq .vs-oneq-pos { display: block; }
.vs.oneq .vs-sec.current[data-kind="items"] .q { display: none; }
.vs.oneq .vs-sec.current[data-kind="items"] .q.cur { display: flex; border-bottom: none; }
.vs.oneq .vs-sec.current[data-kind="items"] .vs-group-t { display: none; }
.vs.oneq .vs-sec.current[data-kind="items"] .vs-group:not(:has(.q.cur)) { display: none; }
.vs.oneq .q-main { flex-direction: column; align-items: stretch; gap: 12px; }
.vs.oneq .q-text { font-size: 19px; font-weight: 600; line-height: 1.35; }
.vs.oneq .q-num { font-size: 14px; }
.vs.oneq .q .vs-seg { flex-direction: column; }
.vs.oneq .q .vs-seg .vs-opt span { min-height: 58px; font-size: 16px; justify-content: flex-start; padding: 0 16px; }
.vs.oneq .q-more, .vs.oneq .nc-box { padding-left: 0; margin-left: 0; }
.vs.oneq .nc-box .vs-seg { flex-direction: row; }
.vs.oneq .nc-box .vs-seg .vs-opt span { min-height: 46px; font-size: 14px; justify-content: center; padding: 0 8px; }

/* firme */
.vs-sign-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.vs-kv { display: flex; justify-content: space-between; gap: 12px; min-height: 38px; align-items: center; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.vs-kv span { color: var(--ink-2); }
.vs-sign-ril { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.4; }
.vs-sign-ril li { display: flex; gap: 8px; align-items: flex-start; }
.sigpad { position: relative; height: 200px; border-radius: 10px; border: 1.5px dashed #9AA19B; background: #FCFCFA; touch-action: none; overflow: hidden; }
.sigpad-lg { height: 260px; }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.sigpad-hint { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-size: 15px; color: var(--muted); pointer-events: none; }
.sigpad.has-ink .sigpad-hint { display: none; }
.sigpad-line { position: absolute; left: 28px; right: 28px; bottom: 48px; border-bottom: 1px solid #B9BFB7; pointer-events: none; }
.vs-sig-img { display: block; max-width: 100%; height: 130px; object-fit: contain; object-position: left center; border-radius: 8px; background: #FCFCFA; border: 1px solid var(--line-soft); }
.vs-close .btn-block { min-height: 56px; }

/* validazione */
.vs-num { padding: 3px 8px; border-radius: 4px; background: #ECEEE9; color: var(--ink-2); }
.vs-autonote { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--auto-bg); color: var(--auto-ink); font-size: 13px; line-height: 1.45; }
.vs-autonote svg { flex-shrink: 0; margin-top: 2px; }
.ve { display: flex; flex-direction: column; gap: 14px; }
.ve-sec { overflow: hidden; }
.ve-bar { padding: 10px 16px; background: #1A1F23; color: #fff; }
.ve-bar h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.ve-head { display: grid; gap: 10px; padding: 8px 16px; background: #EEF2F5; color: #1F5C6E; font-size: 12px; font-weight: 600; }
.ve-body { display: flex; flex-direction: column; }
.ve-row { display: grid; gap: 10px; align-items: start; padding: 8px 16px; border-bottom: 1px solid var(--line-soft); }
.ve-row.is-mod { background: #FFFBF3; }
.ve-head, .ve-row { grid-template-columns: 34px minmax(0, 1fr) 100px 44px; }
.ve-cols-varie .ve-row, .ve-head.ve-cols-varie { grid-template-columns: 34px minmax(0, 1fr) 72px 100px 44px; }
.ve-head.ve-cols-cliente, .ve-head.ve-cols-consulente { display: none; }
.ve-cols-cliente .ve-row, .ve-cols-consulente .ve-row { grid-template-columns: 34px minmax(0, 1.4fr) minmax(0, 1fr) 64px 100px 44px; grid-template-areas: "n t t t t del" ". who by p src ."; row-gap: 6px; }
.ve-cols-cliente .ve-n, .ve-cols-consulente .ve-n { grid-area: n; }
.ve-cols-cliente .ve-c-t, .ve-cols-consulente .ve-c-t { grid-area: t; }
.ve-cols-cliente .ve-c-who, .ve-cols-consulente .ve-c-who { grid-area: who; }
.ve-cols-cliente .ve-c-by, .ve-cols-consulente .ve-c-by { grid-area: by; }
.ve-cols-cliente .ve-c-p, .ve-cols-consulente .ve-c-p { grid-area: p; }
.ve-cols-cliente .ve-src, .ve-cols-consulente .ve-src { grid-area: src; padding-top: 6px; }
.ve-cols-cliente .ve-del, .ve-cols-consulente .ve-del { grid-area: del; }
.ve-cols-cliente .ve-warn, .ve-cols-consulente .ve-warn { grid-column: 2 / -2; grid-row: 3; }
.ve-cols-prog .ve-row, .ve-head.ve-cols-prog { grid-template-columns: 34px minmax(0, 1fr) 112px 100px 44px; }
.ve-row-simple { grid-template-columns: 34px minmax(0, 1fr) 100px 44px; }
.ve-n { padding-top: 10px; font-size: 13px; color: var(--muted); }
.ve-c .input, .ve-c .select, .ve-c .textarea { min-height: 40px; font-size: 14px; }
.ve-c .textarea { padding: 8px 10px; min-height: 40px; resize: none; overflow: hidden; line-height: 1.4; }
.ve-src { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 8px; }
.ve-mod { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; background: var(--warn-bg); color: var(--warn-ink); }
.ve-warn { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn-ink); }
.ve-add { align-self: flex-start; margin: 6px 10px 10px; }
.ve-esito h2 { margin: 0; }
.vs-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vs-photo { display: flex; flex-direction: column; gap: 4px; }
.vs-photo img { width: 100%; height: 74px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.vs-sigs figure { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 8px; background: var(--surface-2); }
.vs-sigs img { width: 100%; height: 64px; object-fit: contain; }
.vs-sigs figcaption { display: flex; flex-direction: column; font-size: 12px; }
.vs-sigs figcaption span { color: var(--muted); }
.vs-changes { margin: 4px 0; padding-left: 16px; color: var(--ink-2); }
.vs-actions { position: sticky; bottom: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 -4px 16px rgba(26,31,35,.06); }
.vs-return { margin-top: 16px; border-color: #E3B3AA; }

.q-note-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; min-height: 30px; padding: 0 8px 0 4px; border: none; border-radius: 6px; background: transparent; color: var(--brand-ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.q-note-btn:hover { background: var(--brand-soft); }
.vs-fs[disabled] .q-note-btn { display: none; }
/* durante la visita il menu laterale resta a icone anche sui tablet larghi */
@media (max-width: 1440px) and (min-width: 761px) {
  .visit-page .sidebar { width: 76px; padding: 18px 10px; align-items: center; }
  .visit-page .brand-text, .visit-page .nav a .label, .visit-page .nav-badge, .visit-page .side-team, .visit-page .side-user a, .visit-page .side-user form { display: none; }
  .visit-page .brand { padding: 0; }
  .visit-page .nav a { width: 52px; height: 52px; padding: 0; justify-content: center; position: relative; }
  .visit-page .nav a .nav-badge-dot { display: flex; }
  .visit-page .side-user { padding: 14px 0 0; justify-content: center; }
  .visit-page .main { padding: 20px 22px 0; }
}
@media (max-width: 1180px) {
  .vs-body { grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
  .vs-rail-item { min-height: 50px; padding: 6px 8px; gap: 10px; }
  .vs-sign-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) and (min-width: 761px) {
  .vs-body { grid-template-columns: minmax(0, 1fr); }
  .vs-rail { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding: 6px; }
  .vs-rail-top { display: none; }
  .vs-rail-item { flex-shrink: 0; }
}
@media (max-width: 760px) {
  .visit-page .bottomnav { display: none; }
  .visit-page .main { padding-bottom: 0; }
  .vs-head { position: static; margin: -14px -12px 0; padding: 6px 8px 6px 2px; }
  .vs-foot .btn-lg { flex: 1 1 0; min-width: 0; }
  .vs-foot .grow { display: none; }
  .vs-oneq-btn span { display: none; }
  .vs-save span { display: none; }
  .vs-body { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .vs-rail { position: sticky; top: 56px; z-index: 34; flex-direction: row; overflow-x: auto; max-height: none; padding: 4px; margin: 0 -12px; border-radius: 0; border-left: none; border-right: none; gap: 4px; scrollbar-width: none; }
  .vs-rail-top { display: none; }
  .vs-rail-item { flex-shrink: 0; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: 999px; }
  .vs-rail-item .vs-rail-t > span:first-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .vs-rail-m { display: none; }
  .vs-sec-head h1 { font-size: 20px; }
  .q { padding: 12px; }
  .q-main { flex-wrap: wrap; gap: 10px; }
  .q-body { flex-basis: calc(100% - 54px); }
  .q .vs-seg { width: 100%; }
  .q .vs-seg .vs-opt { flex: 1 1 0; }
  .q-more, .nc-box { padding-left: 0; margin-left: 0; }
  .nc-grid, .nc-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .vs-checks, .lrow-nuovo, .lrow-oss, .lrow-doc, .lrow-ref { grid-template-columns: minmax(0, 1fr); }
  .lrow-nuovo .lrow-wide, .lrow-oss .field:nth-child(-n+2) { grid-column: auto; }
  .lrow-prev { grid-template-columns: minmax(0, 1fr); }
  .vs-foot { margin: 0 -12px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
  .vs-foot .btn-lg span { display: none; }
  .vs-foot [data-next] span, .vs-foot [data-prev] span { display: inline; }
  .vs-foot .btn-lg { padding: 0 14px; }
  .vs-ril thead { display: none; }
  .vs-ril tr { display: block; padding: 10px 6px; border-top: 1px solid var(--line-soft); }
  .vs-ril td { display: block; border: none; padding: 2px 10px; }
  .sigpad { height: 220px; }
  .ve-head { display: none; }
  .ve-row, .ve-cols-varie .ve-row, .ve-cols-prog .ve-row, .ve-row-simple { grid-template-columns: 26px minmax(0, 1fr) 44px; }
  .ve-cols-cliente .ve-row, .ve-cols-consulente .ve-row { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "n t t del" ". who who ." ". by p ." ". src src ."; }
  .ve-row .ve-c:not(.ve-c-t), .ve-row .ve-src { grid-column: 2 / 3; }
  .ve-row .ve-del { grid-row: 1; grid-column: 3; }
  .vs-actions { margin: 16px -12px 0; border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .vs-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.vs.oneq .q:not([data-type="dvr"]) .q-main .k-c span::after { content: ' · Conforme'; font-weight: 400; }
.vs.oneq .q:not([data-type="dvr"]) .q-main .k-nc span::after { content: ' · Non conforme'; font-weight: 400; }
.vs.oneq .q .q-main .k-na span::after { content: ' · Non applicabile'; font-weight: 400; }
.vs.oneq .q[data-type="dvr"] .q-main .k-c span::after { content: ' · valutato nel DVR'; font-weight: 400; }
.vs.oneq .q[data-type="dvr"] .q-main .k-nc span::after { content: ' · non valutato'; font-weight: 400; }
.ve-visit .ve-mod { display: none !important; }
.ve-visit .ve-row.is-mod { background: transparent; }

.pl-add { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--brand-ink); background: var(--surface); border: 1px solid var(--line-strong); }
.pl-add:hover { background: var(--brand-soft); color: var(--brand-ink); }
.pl-day-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

tr.pl-link { cursor: pointer; }
tr.pl-link:hover td { background: var(--surface-2); }
.pl-open { color: inherit; text-decoration: none; }
.pl-open:hover strong { text-decoration: underline; color: var(--brand-ink); }
@media print { tr.pl-link:hover td { background: none; } }

/* elenco settimana: filtri su una riga, azioni su una barra separata */
.pl-controls { display: flex; flex-direction: column; }
.pl-controls .filters { padding: 16px 16px 14px; }
.pl-controls .pl-check { min-height: 44px; }
.pl-controls .pl-nav { margin-left: auto; }
.pl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 760px) {
  .pl-controls .pl-nav { margin-left: 0; }
  .pl-toolbar .btn { flex: 1 1 auto; }
  .pl-toolbar .grow { display: none; }
}
@media print { .pl-controls { display: none !important; } }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }

/* ---------- bacheca ---------- */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.board-new { position: sticky; top: 20px; }
.board-new h2 { margin: 0; }
.board-to, .board-colors { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.board-to legend, .board-colors legend { padding: 0; margin-bottom: 8px; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pill-all { border-style: dashed; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch > span:first-of-type { display: block; width: 38px; height: 38px; border-radius: 8px; border: 1px solid; }
.swatch input:checked + span { outline: 3px solid var(--ink); outline-offset: 1px; }
.swatch input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.count-neutral { background: #ECEEE9; color: var(--ink-2); }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; align-items: start; }
.note { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid; border-radius: 4px 4px 14px 4px; box-shadow: 0 1px 2px rgba(26,31,35,.08), 0 6px 14px rgba(26,31,35,.06); color: var(--ink); scroll-margin-top: 20px; }
.note:target { outline: 3px solid var(--brand); outline-offset: 2px; }
.note-done { opacity: .75; }
.note-done .note-body { text-decoration: line-through; color: var(--muted); }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-head form { margin: 0; }
.note-who { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; line-height: 1.3; font-size: 13px; }
.note-who strong { font-weight: 600; }
.note-new { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: #fff; }
.note-pin { width: 36px; height: 36px; border: none; border-radius: 8px; background: transparent; color: var(--ink-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.note-pin:hover { background: rgba(255,255,255,.6); }
.note-pin.on { color: var(--brand); }
.note-pin.on svg { fill: currentColor; }
.note-body { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.note-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.72); color: var(--brand-ink); text-decoration: none; }
a.note-tag:hover { background: #fff; }
.note-tag.late { background: #F9E0DC; color: #8E1B10; }
.note-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px dashed rgba(26,31,35,.2); }
.note-foot form { margin: 0; }
.note-receipt { color: var(--ink-2); }
.note-done-btn { background: rgba(255,255,255,.75); border-color: rgba(26,31,35,.22); font-weight: 600; }
.hide-desk { display: none; }
@media (max-width: 1180px) { .board-layout { grid-template-columns: minmax(0, 1fr); } .board-new { position: static; } }
@media (max-width: 760px) { .notes-grid { grid-template-columns: minmax(0, 1fr); } .hide-desk { display: inline-flex; } .page-head .hide-desk { display: none; } }
/* fascia della bacheca nel calendario */
.board-strip { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: #FFF1B3; border: 1px solid #E8D27A; color: var(--ink); text-decoration: none; }
.board-strip:hover { color: var(--ink); background: #FFEC99; }
.board-strip .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.board-strip .go { font-size: 14px; font-weight: 600; color: var(--brand-ink); white-space: nowrap; }
@media (max-width: 760px) { .board-strip .go { display: none; } }

/* elenco appuntamenti: divisione per settimana dell'anno */
.pl-weeks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pl-weeks a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--brand-ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.pl-weeks a:hover { background: var(--brand-soft); }
.pl-week { margin-top: 22px; scroll-margin-top: 16px; }
.pl-week-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: #1A1F23; color: #fff; break-after: avoid; }
.pl-week-num { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 50px; height: 50px; border-radius: 8px; background: #fff; color: #1A1F23; font-size: 20px; font-weight: 600; line-height: 1; }
.pl-week-num span { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #545B61; margin-bottom: 2px; }
.pl-week-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pl-week-text strong { font-size: 16px; font-weight: 600; }
.pl-week-meta { font-size: 13px; color: #C9CDC5; }
.pl-week-toggle { background: transparent; color: #fff; border-color: #545B61; }
.pl-week-toggle:hover { background: #2A3035; color: #fff; }
.pl-week-days { padding-left: 14px; border-left: 3px solid var(--line); }
.pl-week.closed .pl-week-days { display: none; }
@media (max-width: 640px) {
  .pl-week-head { flex-wrap: wrap; gap: 10px; }
  .pl-week-num { min-width: 44px; height: 44px; font-size: 18px; }
  .pl-week-days { padding-left: 0; border-left: 0; }
}
@media print {
  .pl-week { break-inside: auto; margin-top: 14px; }
  .pl-week-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; padding: 6px 10px; border-radius: 0; }
  .pl-week-num { display: none; }
  .pl-week-days { padding-left: 0; border-left: 0; }
  .pl-week.closed .pl-week-days { display: block; }
}

/* team: scelta del ruolo */
.role-pick { border: 0; padding: 0; margin: 0; }
.role-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.role-option > span { display: flex; flex-direction: column; gap: 2px; }
.role-option input { margin-top: 3px; accent-color: var(--brand); }
.role-option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
[data-role-extras] { border: 0; padding: 0; margin: 0; }
[data-role-extras].is-included .check { opacity: .55; }
.table th.th-wrap { white-space: normal; min-width: 80px; }
/* team: sotto i 1100px la tabella utenti diventa a schede, come sul telefono */
@media (max-width: 1100px) {
  .team-table thead { display: none; }
  .team-table tr { display: block; border-top: 1px solid var(--line-soft); padding: 10px 4px; }
  .team-table td { display: flex; gap: 10px; border: none; padding: 4px 12px; }
  .team-table td::before { content: attr(data-label); flex: 0 0 104px; font-size: 12px; color: var(--muted); padding-top: 2px; }
  .team-table td.main-cell::before, .team-table td:not([data-label])::before { display: none; }
  .team-table td.num { text-align: left; }
  .team-table td:last-child > .row { justify-content: flex-start !important; }
}

/* ---------- planning settimanale (griglia come il foglio Excel) ---------- */
.wg-scroll { overflow-x: auto; margin-top: 14px; }
.wg-table { width: 100%; min-width: 1080px; border-collapse: collapse; table-layout: fixed; font-size: 12px; margin-bottom: 22px; }
.wg-table th, .wg-table td { border: 1px solid var(--line-strong); padding: 4px 6px; vertical-align: top; overflow-wrap: break-word; hyphens: auto; }
.wg-table td { height: 30px; }
.wg-week { border: 2px solid #1A1F23 !important; font-size: 14px; font-weight: 600; text-align: center; padding: 6px; }
.wg-day { border: 2px solid #1A1F23 !important; font-weight: 500; text-align: center; position: relative; }
.wg-day.wg-today { background: var(--brand-soft); color: var(--brand-ink); }
.wg-add { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 5px; color: var(--brand-ink); }
.wg-add:hover { background: var(--brand-soft); }
.wg-cols th { background: #DCE6F2; color: #1F3A5F; font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; padding: 4px 2px; }
.wg-first { border-left: 2px solid #1A1F23 !important; }
.wg-table tr > :last-child { border-right: 2px solid #1A1F23; }
.wg-table tbody tr:last-child td { border-bottom: 2px solid #1A1F23; }
.wg-table td.wg-time { padding: 4px 1px; text-align: center; font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.wg-open { color: inherit; font-weight: 600; text-decoration: none; }
.wg-open:hover { color: var(--brand-ink); text-decoration: underline; }
.wg-who { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.wg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wg-cancelled { color: var(--faint); text-decoration: line-through; }
td[draggable="true"] { cursor: grab; }
td[draggable="true"]:hover { background: var(--surface-2); }
.wg-table .wg-dragging { opacity: .45; }
.wg-table .wg-drop { background: var(--brand-soft); }
.wg-table th.wg-drop { box-shadow: inset 0 -3px 0 var(--brand); }
.wg-dialog { width: 380px; max-width: calc(100vw - 32px); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; background: var(--surface); color: inherit; box-shadow: 0 18px 48px rgba(0,0,0,.25); }
.wg-dialog::backdrop { background: rgba(20,26,30,.4); }
.wg-dialog-title { font-size: 18px; margin: 0 0 4px; }
.wg-dialog [data-f="what"] { margin: 0 0 16px; }
.wg-dialog .field { flex: 1; }
.wg-dialog [data-f="err"] { color: var(--danger); margin: 10px 0 0; }
.wg-dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media print {
  .wg-scroll { overflow: visible; margin-top: 8px; }
  .wg-table { min-width: 0; font-size: 7.5pt; break-inside: avoid; }
  .wg-table td { height: 18px; }
  .wg-cols th, .wg-day.wg-today { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* fascicolo dell'azienda */
.fz-upload > summary { cursor: pointer; list-style: none; justify-content: flex-start; flex-wrap: wrap; }
.fz-upload > summary::-webkit-details-marker { display: none; }
.fz-upload > summary h2 { display: inline-flex; align-items: center; gap: 8px; }
.fz-upload:not([open]) > summary::after { content: 'Apri'; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--brand); }
.fz-file { padding: 9px 12px; }
.fz-folders { display: flex; flex-wrap: wrap; gap: 8px; }
.fz-folder { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none; }
.fz-folder:hover { border-color: var(--brand); color: var(--brand); }
.fz-empty { margin: 0; padding: 0 18px 16px; }
.fz-row { display: grid; grid-template-columns: minmax(0, 1fr) 240px 150px auto; gap: 6px 16px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.fz-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fz-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); text-decoration: none; }
.fz-name:hover { color: var(--brand); text-decoration: underline; }
.fz-name span { overflow-wrap: anywhere; }
.fz-main > .small { overflow-wrap: anywhere; }
.fz-dates { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.fz-actions { display: flex; gap: 2px; }
.fz-edit { grid-column: 1 / -1; }
.fz-edit > summary { cursor: pointer; color: var(--brand); font-weight: 600; width: max-content; }
@media (max-width: 760px) {
  .fz-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; }
  .fz-dates { grid-column: 1; grid-row: 2; text-align: left; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
  .fz-badge { grid-column: 2; grid-row: 1; justify-self: end; }
  .fz-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .fz-empty { padding: 0 16px 14px; }
}

/* fascicolo: commento e ricerca */
.fz-comment { margin: 4px 0 0; padding: 6px 10px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.fz-search { flex-wrap: wrap; }
.fz-search .search { min-width: 220px; }
mark { background: #FCE7A6; color: inherit; padding: 0 1px; border-radius: 2px; }
.fs-form { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.fs-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.fs-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); width: max-content; min-height: 32px; display: flex; align-items: center; }
.fs-more[open] > summary { margin-bottom: 10px; }
.fs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.fs-range { border: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; min-width: 0; grid-column: span 2; }
.fs-range legend { font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 0; margin-bottom: 6px; }
.fs-range .input { flex: 1 1 0; min-width: 0; }
.fs-check { grid-column: span 2; min-height: 44px; }
.fs-comment { max-width: 320px; font-size: 13px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 1180px) { .fs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .fs-main { grid-template-columns: minmax(0, 1fr); }
  .fs-grid { grid-template-columns: minmax(0, 1fr); }
  .fs-range, .fs-check { grid-column: auto; }
  .fs-comment { max-width: none; }
}
.fs-scope { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid #C3D0E8; border-radius: var(--radius); background: #E9EEF7; color: #1C3B6B; font-size: 14px; }
.fs-scope-ic { display: inline-flex; }
.fs-scope .grow { flex: 1 1 220px; }

/* pagina Scadenze */
.dl-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dl-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.dl-tile strong { font-size: 26px; font-weight: 600; line-height: 1.1; }
.dl-tile:hover { border-color: var(--brand); }
.dl-tile.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.dl-tile.dl-danger strong { color: #8A2424; }
.dl-tile.dl-warn strong { color: var(--warn-ink); }
.dl-group { margin-bottom: 16px; }
.dl-act { text-align: right; white-space: nowrap; }
.dl-comment { overflow-wrap: anywhere; }
@media (max-width: 1180px) { .dl-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .dl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dl-tile { padding: 10px 12px; }
  .dl-tile strong { font-size: 22px; }
  .dl-act { text-align: left; }
}
@media (min-width: 761px) {
  .dl-group .table { table-layout: fixed; }
  .dl-group th:nth-child(1) { width: 17%; } .dl-group th:nth-child(2) { width: 24%; } .dl-group th:nth-child(3) { width: 23%; }
  .dl-group th:nth-child(4) { width: 14%; } .dl-group th:nth-child(5) { width: 11%; } .dl-group th:nth-child(6) { width: 190px; }
  .dl-group td { overflow-wrap: anywhere; }
}
