/* Space42 · mockup gestione turni e progetti
   Colori presi dai file vettoriali ufficiali (SVG del brand kit):
   navy #0d4059 · celeste #2682a3 · arancio #f56100 · arancio chiaro #f78c5c
   Font: Roboto (manuale d'uso, pag. Tipografia). */

:root {
  --navy: #0d4059;
  --navy-900: #072536;
  --navy-700: #12506e;
  --celeste: #2682a3;
  --celeste-50: #e7f2f6;
  --arancio: #f56100;
  --arancio-chiaro: #f78c5c;
  --arancio-50: #fff0e6;
  /* Calendari Teamup: Availability (azzurro) e Management Availability (rosso) */
  --disp: #3fa9cb;
  --disp-50: #e4f4fa;
  --disp-ink: #136c89;
  --assenza: #d12d1d;
  --assenza-50: #fde8e6;

  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --line: #dbe3e8;
  --line-strong: #c3cfd7;
  --text: #10283a;
  --muted: #5a6e7b;
  --faint: #60717e;

  --ok: #1f7a51;
  --ok-50: #e5f4ec;
  --warn: #9a5e08;
  --warn-50: #fdf2dd;
  --danger: #c0352b;
  --danger-50: #fbe7e5;
  --info: var(--celeste);
  --info-50: var(--celeste-50);

  /* Token semantici. I nomi storici qui sopra restano validi; i valori del tema scuro sono in theme.css.
     Le coppie testo/sfondo sono verificate da tests/contrasto-token.cjs. */
  --surface-3: #eef2f4;
  --surface-hover: #fafcfd;
  --track: #e9eef1;
  --brand: var(--navy);        /* superficie di marca: barra laterale, pulsante di conferma */
  --brand-ink: var(--navy);    /* testo di marca: titoli e valori; nel tema scuro coincide con --text */
  --link: #1c6f8c;             /* celeste leggibile come testo */
  --on-accent: #10222e;        /* testo sopra l'arancio */
  --orange-ink: #b04600;
  --ok-line: #bfe3cf;
  --warn-line: #f0d49e;
  --danger-line: #f0c0bb;
  --info-line: #bcdbe7;
  --orange-line: #f9c9a8;
  /* Carico di lavoro: una sola tavolozza per barre e legende */
  --load-done: #748c9b;
  --load-confirmed: #0d4059;
  --load-task: #2682a3;
  --load-proposed: #e3b341;
  --load-draft: #f56100;
  --load-other: #8aa4b3;
  --cover-wait: #e4b64e;
  --cover-open: #d5685e;
  --tip-bg: #10283a;
  --tip-text: #ffffff;
  /* Scala tipografica e spaziatura */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(13, 64, 89, .06), 0 2px 8px rgba(13, 64, 89, .06);
  --shadow-lg: 0 10px 40px rgba(7, 37, 54, .25);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* Editor visualizzazioni: griglia vincolata, mai coordinate assolute. */
.vl-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.vl-block { grid-column: span var(--vl-span); order: var(--vl-order); min-width: 0; overflow-wrap: anywhere; }
.vl-block h2 { margin-bottom: 12px; }
.vl-block .table-wrap { max-width: 100%; overflow: auto; }
.vl-text { white-space: pre-wrap; }
.vl-title-small { font-size: 18px; } .vl-title-medium { font-size: 24px; } .vl-title-large { font-size: 32px; }
.vl-number { font-size: 32px; font-weight: 700; }
.vl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.vl-cards dl { margin: 0; border: 1px solid var(--line); padding: 12px; border-radius: 8px; }
.vl-cards dd { margin: 0 0 8px; } .vl-cards dt { font-weight: 600; }
.vl-bars > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; margin: 10px 0; }
.vl-track { grid-column: 1 / -1; height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.vl-track i { height: 100%; display: block; }
.vl-donut { width: 160px; height: 160px; border-radius: 50%; margin: 12px auto; position: relative; }
.vl-donut::after { content: ''; position: absolute; inset: 30px; border-radius: 50%; background: var(--surface); }
.vl-warning { color: var(--warn); padding: 8px 0; }
.vl-target { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; align-items: end; }
.vl-target label, .vl-settings label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vl-banner { background: var(--celeste-50); border: 1px solid var(--celeste); padding: 12px; margin: 12px 0; display: flex; flex-direction: column; }
.vl-tools { flex-wrap: wrap; margin: 16px 0; }
.vl-editor { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.vl-editor > *, .vl-preview-area { min-width: 0; }
.vl-settings { display: grid; gap: 12px; margin-top: 20px; }
.vl-settings .check { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; }
.vl-block-list { padding: 0; list-style: none; }
.vl-block-list li { border: 1px solid var(--line); padding: 8px; margin: 8px 0; border-radius: 8px; }
.vl-block-list .vl-selected { border-color: var(--celeste); background: var(--celeste-50); }
.vl-block-list .linkbtn { text-align: left; overflow-wrap: anywhere; margin-bottom: 8px; }
.vl-preview-area iframe { display: block; width: 100%; height: 780px; border: 1px solid var(--line-strong); background: white; margin: 12px auto; }
.vl-mobile-preview iframe { max-width: 375px; }
.vl-preview-body { padding: 16px; min-width: 0; }
.vl-intro { margin: 0 0 16px; white-space: pre-wrap; color: var(--ink-2, inherit); }
.vl-menu-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.vl-menu-row b { overflow-wrap: anywhere; }
.vl-menu-row .check { margin: 0; }
.vl-menu-preview, .sidebar.vl-menu-preview { position: static; width: 100%; max-width: 280px; min-height: 0; height: auto; display: block !important; flex: none; }
@media (max-width: 1100px) { .vl-editor { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .vl-block { grid-column: 1 / -1; order: var(--vl-mobile); } .vl-preview-body { padding: 8px; } }
/* Editor a blocchi: barra, tre colonne, pannello proprietà, catalogo. */
.vl-topbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; align-items: end; }
.vl-topbar label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.vl-toolbar .btn.on { background: var(--celeste-50); border-color: var(--celeste); }
.vl-seg { display: inline-flex; } .vl-seg .btn { border-radius: 0; } .vl-seg .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .vl-seg .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.vl-inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.vl-editor3 { display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(280px, 330px); gap: 16px; align-items: start; }
.vl-editor3.vl-menu-mode { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); }
.vl-editor3 > * { min-width: 0; }
.vl-structure, .vl-inspector { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.vl-structure-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.vl-block-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vl-block-list li .linkbtn.grow { flex: 1 1 130px; min-width: 0; margin: 0; overflow-wrap: break-word; }
.vl-callout { background: var(--arancio-50); border: 1px solid var(--arancio-chiaro); border-radius: var(--radius-sm); padding: 10px; margin: 8px 0; display: grid; gap: 8px; }
.vl-callout p { margin: 0; font-size: 13px; }
.vl-callout .btn { justify-self: start; }
.vl-block-list .vl-off { opacity: .6; }
.vl-block-list .vl-has-issue { border-color: var(--danger); }
.vl-grip { cursor: grab; color: var(--muted); }
.vl-issue-dot { background: var(--danger); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; font-weight: 700; cursor: pointer; }
.vl-preview-area { position: relative; overflow: hidden; }
.vl-preview-area iframe { margin: 0 0 12px; }
.vl-pop { position: absolute; z-index: 20; display: flex; flex-direction: column; padding: 6px; min-width: 210px; gap: 2px; box-shadow: var(--shadow-lg); }
.vl-pop .linkbtn { text-align: left; padding: 6px 8px; }
.vl-inspector-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.vl-inspector-head .h3 { margin: 0; overflow-wrap: anywhere; }
.vl-inspector .vl-settings { margin-top: 0; gap: 0; }
.vl-group { border-top: 1px solid var(--line); padding: 6px 0; }
.vl-group > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 0; }
.vl-group > summary .tiny { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.vl-group-body { display: grid; gap: 10px; padding: 6px 0 10px; }
.vl-dot { border: 0; background: none; color: var(--arancio); cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.vl-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.vl-tile { text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; }
.vl-tile.on { border-color: var(--celeste); background: var(--celeste-50); box-shadow: inset 0 0 0 1px var(--celeste); }
.vl-tile span { font-size: 12px; color: var(--muted); }
.vl-field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); align-items: center; }
.vl-field-row.off { opacity: .65; }
.vl-field-row > .input, .vl-field-row > .tiny { grid-column: 1 / -1; }
.vl-sentence { display: grid; gap: 8px; padding: 8px; background: var(--surface-2); border-radius: var(--radius-sm); }
.vl-linked { background: var(--celeste-50); padding: 8px; border-radius: var(--radius-sm); }
.vl-kind { font-weight: 600; margin: 0; }
.vl-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 60; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; border-radius: 0; box-shadow: var(--shadow-lg); }
.vl-drawer-head { display: flex; justify-content: space-between; align-items: center; }
.vl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vl-chip { border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; color: inherit; }
.vl-chip.on { background: var(--celeste-50); border-color: var(--celeste); }
.vl-cat-section h3 { font-size: 15px; margin: 12px 0 8px; }
.vl-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 8px; }
.vl-cat-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 4px; cursor: grab; background: var(--surface); min-width: 0; }
.vl-cat-card:hover { border-color: var(--celeste); }
.vl-cat-card.vl-cat-warn { border-style: dashed; }
.vl-cat-card .btn { align-self: flex-start; margin-top: auto; }
.vl-thumb { height: 100px; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-2); pointer-events: none; }
.vl-thumb-inner { transform: scale(.34); transform-origin: top left; width: 294%; padding: 8px; }
.vl-templates { margin-top: 12px; } .vl-templates summary { cursor: pointer; font-weight: 600; }
.vl-template { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.vl-template .btn { justify-self: start; }
.vl-issue-list { padding-left: 18px; display: grid; gap: 10px; }
.vl-banner-issue { color: var(--danger); font-weight: 600; }
/* Presentazioni dei blocchi nelle pagine. */
.vl-sub { margin: -6px 0 12px; }
.vl-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 6px; min-width: 0; align-content: start; background: var(--surface); }
.vl-card header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.vl-card dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
.vl-card dt { font-weight: 600; } .vl-card dd { margin: 0; }
.vl-card p, .vl-card footer { margin: 0; }
.vl-list { list-style: none; padding: 0; margin: 0; }
.vl-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vl-list li .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vl-group-h { font-size: 14px; margin: 12px 0 6px; }
.vl-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; }
.vl-col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 8px; align-content: start; }
.vl-col .vl-group-h { margin: 0; }
.tbl .vl-group th { background: var(--surface-2); text-align: left; }
.vl-tone { padding: 12px 16px; border-radius: var(--radius-sm); border-left: 4px solid var(--line-strong); }
.vl-tone-info { background: var(--info-50); border-color: var(--info); } .vl-tone-warn { background: var(--warn-50); border-color: var(--warn); } .vl-tone-ok { background: var(--ok-50); border-color: var(--ok); }
.vl-tone .vl-text { margin: 0; }
.vl-compact { font-size: 13px; } .vl-compact.card.pad { padding: 10px; } .vl-compact .vl-list li { padding: 4px 0; } .vl-compact .tbl td, .vl-compact .tbl th { padding: 4px 8px; }
.vl-accent-blu { border-top: 4px solid var(--navy); } .vl-accent-celeste { border-top: 4px solid var(--celeste); } .vl-accent-arancio { border-top: 4px solid var(--arancio); }
.vl-accent-verde { border-top: 4px solid var(--ok); } .vl-accent-viola { border-top: 4px solid #8a5bb5; } .vl-accent-grigio { border-top: 4px solid var(--faint); }
.vl-block h2 .ico { margin-right: 6px; vertical-align: -3px; }
@media (min-width: 601px) and (max-width: 1024px) { .vl-block { grid-column: span var(--vl-span-t, var(--vl-span)); } }
@media (max-width: 600px) { .vl-hide-mobile { display: none !important; } }
@media (min-width: 601px) { .vl-hide-desktop { display: none !important; } }
.vl-editor3.vl-wide { grid-template-columns: minmax(0, 1fr); } .vl-editor3.vl-wide > aside { display: none; }
@media (max-width: 1320px) { .vl-editor3 { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); } .vl-structure { position: static; } .vl-inspector { grid-column: 1 / -1; position: static; max-height: none; } }
@media (max-width: 900px) { .vl-editor3, .vl-editor3.vl-menu-mode { grid-template-columns: minmax(0, 1fr); } .vl-structure { position: static; max-height: none; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--arancio); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.strong { font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; background: linear-gradient(90deg, var(--brand) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy);
  color: #dbe8ef;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
/* Il file del logo include l'area di rispetto (margini trasparenti ai lati): logo e sottotitolo centrati nella barra */
.sidebar .brand { padding: 14px 16px 12px; display: flex; flex-direction: column; align-items: center; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 190px; max-width: 100%; display: block; margin: -6px auto -10px; }
.sidebar .brand .prod { margin-top: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #9fc3d3; }
.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #85aabd; margin: 14px 10px 4px; }
.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; text-align: left; cursor: pointer; }
.nav .nav-group-toggle { margin-top: 8px; padding: 8px 10px; color: #9fc3d3; }
.nav .nav-group-toggle:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-group-toggle:focus-visible { outline: 2px solid var(--arancio); outline-offset: -2px; }
.nav .nav-group-toggle.has-active { color: #fff; }
.nav-group-chevron { flex: none; font-size: 20px; line-height: 1; transform: rotate(90deg); }
.nav-group-toggle[aria-expanded="false"] .nav-group-chevron { transform: rotate(0); }
.nav .nav-group-links { display: flex; flex-direction: column; gap: 2px; }
.sheet .nav-group-toggle { padding: 12px 20px; color: var(--muted); }
.sheet .nav-group-toggle:hover { background: var(--surface-2); }
.sheet .nav-group-toggle.has-active { color: var(--text); }
.nav-group-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.nav-group-actions button { flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.nav .nav-group-actions button { border-color: rgba(255,255,255,.2); }
.nav .nav-group-actions button:hover { background: rgba(255,255,255,.07); }
.sheet .nav-group-actions { margin: 6px 20px; }
.sheet .nav-group-actions button:hover { background: var(--surface-2); }
.nav-reorder-group, .nav-reorder-page { position: relative; }
.nav-reorder-grip { position: absolute; left: -3px; top: 2px; z-index: 1; width: 25px; height: 34px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #9fc3d3; font-size: 20px; cursor: grab; touch-action: none; user-select: none; }
.nav-reorder-group > .nav-reorder-grip { top: 8px; }
.nav-reorder-grip:hover, .nav-reorder-grip:focus-visible { color: #fff; background: rgba(255,255,255,.1); }
.nav-reorder-grip:active { cursor: grabbing; }
.nav .nav-reorder-group > .nav-group-toggle, .nav .nav-reorder-page > a { padding-left: 27px; }
.nav-drop-before { box-shadow: 0 -3px 0 var(--arancio); }
.nav-drop-after { box-shadow: 0 3px 0 var(--arancio); }
.nav-drop-inside { outline: 2px solid var(--arancio); outline-offset: -2px; }
.nav-dragging { opacity: .45; }
.sidebar-editor-tools { margin: 0 0 12px; }
.sheet-editor-tools { padding: 12px 20px; }
.nav-edit-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-edit-controls button, .nav-edit-button { padding: 8px; border: 1px solid currentColor; border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.nav-edit-controls button { flex: 1; }
.nav-edit-button, .nav-edit-status, .nav-edit-controls .nav-order-reset { width: 100%; flex-basis: 100%; }
.nav-edit-status { font-size: 12px; }
.nav-edit-controls [data-action="sidebar-save"] { background: var(--arancio); border-color: var(--arancio); color: #fff; }
.nav-edit-controls button:disabled { opacity: .45; cursor: default; }
.sheet .nav-reorder-grip { left: 14px; top: 5px; color: var(--muted); }
.sheet .nav-reorder-group > .nav-reorder-grip { top: 6px; }
.sheet .nav-reorder-group > .nav-group-toggle, .sheet .nav-reorder-page > a { padding-left: 44px; }
.nav-group-toggle:disabled { cursor: default; opacity: 1; }
.nav-group-toggle:disabled .nav-group-chevron { visibility: hidden; }
.nav .nav-reorder-page > a, .sheet .nav-reorder-page > a { padding-right: 38px; }
.nav-visibility-toggle { position: absolute; right: 2px; top: 3px; width: 30px; height: 32px; display: grid; place-items: center; padding: 4px; border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; }
.nav-visibility-toggle .ico { width: 18px; height: 18px; }
.nav-visibility-toggle:hover { background: rgba(150,160,170,.15); }
.nav-visibility-toggle:disabled { cursor: default; opacity: .45; }
.sheet .nav-visibility-toggle { right: 10px; top: 6px; }
.sheet .nav-reorder-page > a { padding-right: 48px; }
.nav-reorder-page.is-menu-hidden > a, .nav-reorder-page.is-menu-hidden > .nav-reorder-grip { opacity: .45; filter: grayscale(1); }
.sidebar .nav .nav-reorder-page.is-menu-hidden > a { color: #bdc3ca; }
.sheet .nav-reorder-page.is-menu-hidden > a { color: var(--muted); }
.nav-reorder-page.is-menu-hidden { background: rgba(150,160,170,.05); border-radius: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: #dbe8ef; text-decoration: none; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 500; }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 5px;
  background: var(--arancio);
  clip-path: polygon(0 0, 100% 0, 100% 75%, 40% 100%, 0 100%);
}
.nav .ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; background: var(--arancio); color: var(--on-accent); border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.sidebar .foot { margin-top: auto; padding: 14px 20px 20px; font-size: 12px; color: #9fc3d3; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .foot a { color: #cfe3ec; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 700; font-style: italic; font-size: 18px; color: var(--brand-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mobile-logo { display: none; }
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; position: relative;
}
.iconbtn:hover { background: var(--surface-2); }
.iconbtn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--arancio); color: var(--on-accent); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 5px 10px; border-radius: 99px;
  border: 1px dashed var(--celeste); color: var(--link); background: var(--celeste-50); cursor: pointer;
  white-space: nowrap;
}
.sync-pill.busy { border-color: var(--arancio); color: var(--orange-ink); background: var(--arancio-50); }
.sync-pill .spin { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sync-pill.busy .spin { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.viewswitch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.viewswitch button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); }
.viewswitch button.on { background: var(--navy); color: #fff; }

.acct-switch { width: auto; max-width: 200px; flex-shrink: 0; }
.topbar .acct-switch ~ .userchip .who { display: none; } /* il nome è già nella lista: resta l'avatar per Account ed Esci */
.userchip { display: flex; align-items: center; gap: 8px; cursor: pointer; border: 0; background: transparent; padding: 4px; border-radius: 10px; }
.userchip:hover { background: var(--surface-2); }
.userchip .who { text-align: left; line-height: 1.15; }
.userchip .who b { display: block; font-size: 13px; }
.userchip .who span { font-size: 11px; color: var(--muted); }

.content { padding: 24px; max-width: 1320px; width: 100%; min-width: 0; }
.content:has(.table-wrap) { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Titoli con la "parentesi" arancione del manuale */
.h-bracket { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; font-style: italic; color: var(--brand-ink); }
.h-bracket::before {
  content: ""; width: 9px; height: 30px; flex: none; background: var(--arancio);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 30% 100%, 0 82%, 0 18%);
}
.h2 { font-size: 17px; font-weight: 700; color: var(--brand-ink); }
.h3 { font-size: 15px; font-weight: 600; }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.section-head .grow { flex: 1; }

/* ---------- Superfici ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head .grow { flex: 1; min-width: 0; }
.card-body { padding: 14px 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card.accent { border-left: 4px solid var(--arancio); }
.card.accent-celeste { border-left: 4px solid var(--celeste); }
.card.highlight { outline: 2px solid var(--arancio); }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }

/* KPI con angolo smussato (forma identitaria) */
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.kpi::after { content: ""; position: absolute; top: 0; right: 0; width: 26px; height: 26px; background: var(--celeste-50); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.kpi.warn::after { background: var(--warn-50); }
.kpi.danger::after { background: var(--danger-50); }
.kpi.ok::after { background: var(--ok-50); }
.kpi .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-size: 26px; font-weight: 700; color: var(--brand-ink); margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }

.hero {
  background: linear-gradient(110deg, var(--navy) 0%, var(--navy-700) 60%, var(--celeste) 130%);
  color: #fff; border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.hero::after { content: ""; position: absolute; right: -60px; top: -40px; width: 260px; height: 3px; background: linear-gradient(90deg, transparent, var(--arancio), #ffc04d, transparent); transform: rotate(-32deg); opacity: .8; }
.hero h2 { font-style: italic; font-size: 22px; }
.hero p { color: #cfe3ec; margin: 4px 0 0; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; clip-path: polygon(0 0, 100% 0, 100% 100%, 9px 100%, 0 calc(100% - 9px)); border-radius: 0; }
.btn.primary:hover { background: var(--navy-700); }
.btn.accent { background: var(--arancio); border-color: var(--arancio); color: var(--on-accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 9px 100%, 0 calc(100% - 9px)); border-radius: 0; }
.btn.accent:hover { background: #d95600; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e6b3ae; }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-align: inherit; }

/* ---------- Badge / tag ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-50); color: var(--warn); border-color: var(--warn-line); }
.badge.danger { background: var(--danger-50); color: var(--danger); border-color: var(--danger-line); }
.badge.info { background: var(--celeste-50); color: var(--link); border-color: var(--info-line); }
.badge.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.badge.orange { background: var(--arancio-50); color: var(--orange-ink); border-color: var(--orange-line); }
.badge.sim { background: repeating-linear-gradient(135deg, #fff, #fff 4px, #f1f6f8 4px, #f1f6f8 8px); border: 1px dashed var(--celeste); color: var(--link); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.badge.hyp { border: 1px dashed var(--warn); color: var(--warn); background: #fffaf0; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.badge.later { border: 1px dashed var(--faint); color: var(--muted); background: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.proj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.chip.ok { background: var(--ok-50); border-color: var(--ok-line); }
.chip.pending { background: var(--warn-50); border-color: var(--warn-line); }
.chip.refused { background: var(--danger-50); border-color: var(--danger-line); text-decoration: line-through; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }

/* ---------- Avvisi ---------- */
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--celeste-50); color: #164b61; border: 1px solid #bcdbe7; }
.note.warn { background: var(--warn-50); color: #6b4306; border-color: #f0d49e; }
.note.danger { background: var(--danger-50); color: #7b2019; border-color: #f0c0bb; }
.note.sim { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #f3f8fa 6px, #f3f8fa 12px); border: 1px dashed var(--celeste); }
.note.open { background: #fff; border: 1px dashed var(--faint); color: var(--muted); }
.note .ico { flex: none; margin-top: 1px; }

/* ---------- Tabelle / liste ---------- */
.table-wrap { overflow: auto; min-width: 0; max-width: 100%; max-height: min(72vh, 850px); overscroll-behavior-x: contain; scrollbar-gutter: stable; }
.table-wrap:focus-visible { outline: 2px solid var(--celeste); outline-offset: 2px; }
.table-wrap thead { position: sticky; top: 0; z-index: 3; }
.table-wrap .tbl { min-width: 100%; }
.legend button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font: inherit; padding: 5px 7px; cursor: pointer; }
.legend button:hover { border-color: var(--line-strong); }
.legend button[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.cal .ev.draggable { cursor: grab; user-select: none; }
.cal .ev.draggable:active { cursor: grabbing; }
.abil-partial { color: var(--warn); font-size: 11px; display: block; }
.abil-config-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width:640px) { .abil-config-row { grid-template-columns: minmax(0,1fr); gap:6px; } .table-wrap { max-height: 75vh; } }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-hover); }
.list { display: flex; flex-direction: column; }
.list > .item { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.list > .item:last-child { border-bottom: 0; }
.list > .item .grow { flex: 1; min-width: 0; }
.list > .item.click { cursor: pointer; }
.list > .item.click:hover { background: var(--surface-hover); }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Barre di carico ---------- */
.loadbar { position: relative; height: 12px; border-radius: 99px; background: var(--track); overflow: hidden; display: flex; min-width: 80px; }
.loadbar > span { height: 100%; }
.loadbar .s-turni { background: var(--load-confirmed); }
.loadbar .s-task { background: var(--load-task); }
.loadbar .s-altri { background: var(--load-other); }
.loadbar .s-prop { background-color: var(--load-proposed); }
.loadbar .s-bozza { background-color: var(--load-draft); }
.load-part-proposed, .load-part-draft, .loadbar .s-prop, .loadbar .s-bozza { background-image: repeating-linear-gradient(135deg, transparent, transparent 3px, var(--text) 3px, var(--text) 4px); box-shadow: inset 0 0 0 1px var(--text); }
.load-part-other { background-image: repeating-linear-gradient(90deg, transparent, transparent 3px, var(--text) 3px, var(--text) 4px); box-shadow: inset 0 0 0 1px var(--text); }
.loadbar .cap { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--danger); }
.legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.progress { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--celeste); }
.progress.over > span { background: var(--danger); }
.sat { font-weight: 700; font-variant-numeric: tabular-nums; }
.sat.hi { color: var(--danger); }
.sat.mid { color: var(--brand-ink); }
.sat.lo { color: var(--ok); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label, .lbl-s { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { border-color: var(--celeste); outline: none; box-shadow: 0 0 0 3px rgba(38,130,163,.15); }
.input.sm { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg label { padding: 7px 12px; cursor: pointer; font-size: 14px; border-right: 1px solid var(--line); background: #fff; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--brand-ink); font-weight: 600; }
.seg label:has(input:checked) { background: var(--celeste-50); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--navy); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs .on { color: var(--brand-ink); font-weight: 600; border-bottom-color: var(--arancio); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 140px; }

/* ---------- Calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; position: relative; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: #fafbfc; color: var(--faint); }
.cal .day.today .dnum { background: var(--arancio); color: var(--on-accent); }
.cal .dnum { font-size: 12px; font-weight: 600; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal .ev, .avail-event-list .ev { display: block; font-size: 11.5px; line-height: 1.25; padding: 2px 5px; margin-top: 2px; border-radius: 4px; color: #fff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; border: 0; width: 100%; text-align: left; }
.cal .ev.mine { box-shadow: inset 3px 0 0 #fff; font-weight: 600; }
.cal .ev.reserved { background: repeating-linear-gradient(135deg, #8aa4b3, #8aa4b3 4px, #9db3c0 4px, #9db3c0 8px) !important; }
.cal .more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.avail-cal .day { min-height: 74px; cursor: pointer; }
.avail-cal .day.av-full { background: var(--disp-50); box-shadow: inset 3px 0 0 var(--disp); }
.avail-cal .day.av-part { background: linear-gradient(180deg, var(--disp-50) 50%, #fff 50%); box-shadow: inset 3px 0 0 var(--disp); }
.avail-cal .day .tag { font-size: 11px; display: block; color: var(--disp-ink); }
.avail-cal .day .shift { font-size: 11px; display: block; color: var(--brand-ink); font-weight: 600; }
.avail-controls { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.avail-projects { flex: 1; min-width: 200px; font-size: 13px; }
.avail-projects summary { cursor: pointer; color: var(--brand-ink); }
.avail-project-options { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 12px 0 0; }
.avail-project-options > .row { width: 100%; }
.avail-project-options .check { font-size: 12px; align-items: center; }
.avail-filter-hint { margin: 0 0 10px; }
.avail-scroll { overflow-x: auto; }
.avail-cal.with-events { min-width: 700px; }
.avail-cal.with-events .day { min-height: 108px; }
.avail-cal .day { cursor: default; }
.avail-day-toggle { background: none; color: inherit; border: 0; padding: 0; text-align: left; width: 100%; min-height: 44px; cursor: pointer; }
.avail-day-toggle::after { content: ''; position: absolute; inset: 0; }
.avail-day-toggle:disabled { opacity: .6; cursor: default; }
.avail-day-toggle:disabled::after { pointer-events: none; }
.avail-day-toggle:focus-visible::after { outline: 2px solid var(--celeste); outline-offset: -2px; }
.avail-event, .avail-more { position: relative; z-index: 1; }
.avail-more { display: block; width: 100%; text-align: left; margin-top: 4px; font-size: 11px; padding: 3px 0; }
.avail-event-list { display: grid; gap: 6px; }
.avail-event-list .ev { font-size: 14px; padding: 6px 8px; white-space: normal; }
.my-task { box-shadow: none; }
.my-task-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 8px; }
.my-task-head h2 { margin: 0 0 4px; }
.my-task-title { color: var(--text); text-align: left; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.my-task-badges { justify-content: flex-end; gap: 5px; }
.my-task-badges .badge { font-size: 11px; }
.my-task-body { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,38%); gap: 20px; padding: 4px 16px 12px; }
.my-task-description p { margin: 3px 0; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.my-task-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.my-task-metrics > div { display: flex; flex-direction: column; gap: 2px; }
.my-task-metrics span { font-size: 11px; color: var(--muted); }
.my-task-metrics b { font-size: 18px; color: var(--brand-ink); }
.my-task-hours .progress { margin-top: 7px; height: 4px; }
.my-task-foot { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding: 9px 16px; }
.my-task-details { min-width: 180px; flex: 1; }
.my-task-details summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px 0; }
.my-task-details p { margin: 6px 0; }
.my-task-details[open] { flex-basis: 100%; }
.my-task-actions { gap: 6px; }
.my-task-alert { margin: 0 16px 10px; }
.task-description-full { margin-bottom: 14px; }
.task-description-full p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.ts-summary { grid-template-columns: repeat(auto-fit,minmax(min(100%,160px),1fr)); }
.ts-project-total { justify-content: space-between; align-items: center; gap: 12px; background: var(--surface-2); }
.ts-project-total .h2 { white-space: nowrap; }
@media (max-width: 700px) {
  .my-task-head { flex-wrap: wrap; }
  .my-task-badges { justify-content: flex-start; }
  .my-task-body { grid-template-columns: 1fr; gap: 12px; }
  .my-task-actions { width: 100%; }
  .my-task-actions .btn { flex: 1; font-size: 12px; padding-left: 8px; padding-right: 8px; }
  .avail-scroll { padding-bottom: 4px; }
}
.agenda .dayhead { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px 4px; background: var(--surface-2); border-bottom: 1px solid var(--line); }

/* Copertura giornata */
.slots { display: flex; gap: 4px; flex-wrap: wrap; }
.slot { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--line-strong); background: #fff; }
.slot.c { background: var(--ok); border-color: var(--ok); }
.slot.p { background: var(--warn-50); border-color: var(--warn); }
.slot.e { border-style: dashed; border-color: var(--danger); }

/* Compatibilità */
.compat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.compat::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.compat.ok { color: var(--ok); }
.compat.avviso { color: var(--warn); }
.compat.blocco { color: var(--danger); }
.compat.impossibile { color: #6d1a14; }
.compat.assegnato { color: var(--link); }
.reasons { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.reasons li.blocco, .reasons li.impossibile { color: var(--danger); }
.reasons li.avviso { color: var(--warn); }

/* Timeline stato richiesta */
.steps { display: flex; gap: 0; align-items: center; flex-wrap: wrap; font-size: 12px; }
.steps .st { display: flex; align-items: center; gap: 6px; color: var(--faint); }
.steps .st b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; font-size: 11px; }
.steps .st.done { color: var(--ok); }
.steps .st.now { color: var(--arancio); font-weight: 600; }
.steps .st.ko { color: var(--danger); font-weight: 600; }
.steps .sep { width: 22px; height: 2px; background: var(--line-strong); margin: 0 6px; }

/* ---------- Modal / sheet / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 37, 54, .5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 980px; }
.ev-date-controls { border-block:1px solid var(--line); padding-block:16px; margin-block:16px; }
.ev-weekdays { display:flex; flex-wrap:wrap; gap:14px; border:0; padding:8px 0; margin:0 0 12px; }
.ev-weekdays legend { font-weight:600; }
.ev-calendar-tools { margin-top:14px; align-items:center; }
.ev-pick-calendar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; }
.ev-pick-dow { text-align:center; font-size:12px; font-weight:600; padding:6px; }
.ev-pick-day { background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:6px; padding:6px; min-height:76px; text-align:left; cursor:pointer; overflow:hidden; }
.ev-pick-day.outside { opacity:.55; }
.ev-pick-day.selected { background:#e4f2f6; border-color:var(--celeste); box-shadow:inset 0 0 0 1px var(--celeste); }
.ev-pick-day:focus-visible { outline:2px solid var(--navy); outline-offset:1px; }
.ev-pick-number { display:block; font-weight:600; margin-bottom:4px; }
.ev-existing { display:block; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:3px; color:var(--brand-ink); }
.ev-date-list { max-height:330px; overflow:auto; margin-bottom:12px; }
.ev-date-row { grid-template-columns:minmax(150px,1.4fr) repeat(3,minmax(90px,1fr)) auto; align-items:end; border-bottom:1px solid var(--line); padding:8px 0; }
.ev-date-row > .btn { margin-bottom:12px; }
@media(max-width:600px) { .ev-date-row { grid-template-columns:repeat(2,minmax(0,1fr)); } .ev-pick-day { padding:4px; min-height:65px; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 18px; font-style: italic; color: var(--brand-ink); }
.modal-body { padding: 16px 18px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
/* Avvisi in basso a destra, uno alla volta: non coprono il contenuto centrale (calendari, tabelle) e non intercettano i clic */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; width: min(92vw, 360px); }
.toast { background: var(--navy-900); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--arancio); width: 100%; animation: up .2s ease-out; }
.toast.ok { border-left-color: #4cc38a; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
.dropdown { position: absolute; right: 16px; top: calc(var(--topbar-h) - 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); width: min(380px, calc(100vw - 24px)); z-index: 60; overflow: hidden; }
.dropdown .list > .item { padding: 10px 14px; }
.notif.unread { background: #fbf7f3; }
.notif.unread .grow b::after { content: " •"; color: var(--arancio); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: #071a26;
}
.login .art {
  position: relative; overflow: hidden; color: #fff; padding: 48px;
  background:
    linear-gradient(118deg, transparent 47%, rgba(245,97,0,.0) 48%, rgba(255,170,40,.85) 49.2%, rgba(245,97,0,.0) 50.5%, transparent 52%),
    linear-gradient(60deg, transparent 62%, rgba(38,130,163,.5) 62.5%, transparent 63.5%),
    linear-gradient(160deg, #020b12 0%, #072536 45%, #0d4059 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login .art img { width: min(420px, 80%); }
.login .art .claim { font-size: 15px; color: #a9c7d6; max-width: 420px; }
.login .panel { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login .box { width: 100%; max-width: 440px; }
.demo-users { display: grid; gap: 8px; }
.demo-user { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left; width: 100%; }
.demo-user:hover { border-color: var(--celeste); }
.demo-user .grow { flex: 1; }

/* ---------- Pianificazione assistita ---------- */
.stepper { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stepper .s { padding: 8px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.stepper .s.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.stepper .s.done { color: var(--ok); border-color: #bfe3cf; }
.draft-cell { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; min-width: 180px; }
.draft-cell.fixed { border-color: var(--navy); background: var(--celeste-50); }
.draft-cell.existing { background: var(--ok-50); border-color: #bfe3cf; }
.draft-cell.manual { border-color: var(--arancio); }
.draft-cell.empty { border-style: dashed; border-color: var(--danger); }
.draft-cell select { border: 0; background: transparent; min-width: 0; flex: 1; font-size: 13px; padding: 2px 0; }
.draft-cell.err { border-color: var(--danger); border-width: 2px; background: var(--danger-50); }
.draft-cell.hi, .row-hi .draft-cell { box-shadow: 0 0 0 3px rgba(245, 97, 0, .35); }
.draft-slot { display: flex; flex-direction: column; gap: 4px; max-width: 280px; }
.draft-slot .reasons { margin: 0; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 53, 43, .12); }
.as-cal .day { min-height: 92px; }
.as-ev { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--ok); background: #fff; border-radius: 6px; padding: 3px 5px; margin-top: 3px; cursor: pointer; color: var(--text); }
.as-ev.lv-avviso { border-left-color: var(--warn); }
.as-ev.lv-blocco, .as-ev.lv-impossibile { border-left-color: var(--danger); background: var(--danger-50); }
.as-ev.lv-vuoto { border-left-style: dashed; border-left-color: var(--danger); }
.as-ev.hi { box-shadow: 0 0 0 2px var(--arancio); }
.as-ev .tiny { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-av { display: flex; gap: 2px; margin-top: 2px; flex-wrap: wrap; }
.as-nomi { display: flex; flex-direction: column; margin-top: 2px; font-size: 11px; line-height: 1.25; }
.as-nome { overflow-wrap: break-word; }
.as-nome.vuoto { color: var(--danger); font-style: italic; }
.as-av .avatar { width: 18px; height: 18px; font-size: 8px; }
.avatar.empty-av { background: #fff !important; color: var(--danger); border: 1px dashed var(--danger); }
.as-side .item.sel { background: #fff3ea; box-shadow: inset 3px 0 0 var(--arancio); }
.tchip { display: inline-flex; align-items: center; gap: 2px; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font-size: 11px; font-weight: 600; justify-content: center; }
.tchip i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.tchip.cf { background: var(--navy); color: #fff; }
.tchip.cf i { box-shadow: 0 0 0 1px #ffffffcc; } /* punto progetto leggibile sul fondo scuro */
.tchip.pd { background: repeating-linear-gradient(135deg, var(--arancio-chiaro), var(--arancio-chiaro) 3px, #ffd9c4 3px, #ffd9c4 6px); color: #5a2a10; }
.tchip.bz { background: #fff; color: var(--orange-ink); border: 2px solid var(--arancio); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--muted); user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--navy); }
.switch input:checked::after { left: 16px; }
.switch input:focus-visible { outline: 2px solid var(--celeste); outline-offset: 2px; }

/* ---------- Calendario: creazione, spostamento, persone ---------- */
.cal .day-add { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 6px; border: 1px dashed var(--celeste); background: var(--celeste-50); color: var(--link); display: grid; place-items: center; cursor: pointer; opacity: 0; padding: 0; }
.cal .day-add .ico { width: 14px; height: 14px; }
.cal .day:hover .day-add, .cal .day-add:focus-visible { opacity: 1; }
.cal .ev.draggable { cursor: grab; }
.cal .day.drop-on { background: var(--celeste-50); outline: 2px dashed var(--celeste); outline-offset: -3px; }
.cal .ev .cal-people { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; padding-top: 2px; border-top: 1px solid rgba(255,255,255,.35); }
.cal .ev .cal-person { display: block; font-weight: 400; line-height: 1.25; overflow-wrap: break-word; }
.cal .ev .cal-person.pending { opacity: .85; font-style: italic; }
.cal .ev .cal-person.refused { opacity: .75; text-decoration: line-through; }
.chip.refused { text-decoration: line-through; color: var(--muted, #6b7280); }
.cal .ev:has(.cal-people) { white-space: normal; }
.cal .more.linkbtn { font-size: 11px; display: block; margin-top: 2px; }
.agenda .item.with-people { flex-wrap: wrap; }
.cal-people-list { gap: 4px; flex: 1 1 260px; justify-content: flex-end; }
.cal-people-list .chip { font-size: 12px; }

/* ---------- Gantt di progetto ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt { --g-label: 240px; position: relative; }
.g-row { display: grid; grid-template-columns: var(--g-label) 1fr; border-bottom: 1px solid var(--line); min-height: 34px; }
.g-row.g-head { background: var(--surface-2); min-height: 56px; position: sticky; top: 0; z-index: 3; }
.g-head .g-track { min-height: 56px; }
.g-row.g-wp { background: #fafcfd; }
.g-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 10px; font-size: 13px; min-width: 0; border-right: 1px solid var(--line); position: sticky; left: 0; background: inherit; z-index: 1; }
.g-row:not(.g-wp):not(.g-head) .g-label { background: var(--surface); padding-left: 22px; }
.g-label .avatar { width: 18px; height: 18px; font-size: 8px; box-shadow: 0 0 0 1px #fff; }
.g-label .row { flex-wrap: nowrap; flex: none; }
.g-label .row .avatar + .avatar { margin-left: -6px; }
.g-task-name { text-align: left; color: var(--text); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; font-size: 13px; }
.g-task-name:hover { text-decoration: underline; }
.g-track { position: relative; min-height: 34px; overflow: hidden; }
.g-month, .g-year { position: absolute; box-sizing: border-box; padding: 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); font-size: 11px; }
.g-year { top: 0; height: 27px; background: #eaf0f3; font-weight: 700; }
.g-month { top: 27px; height: 29px; color: var(--muted); text-transform: uppercase; }
.g-context .g-label { font-style: italic; color: var(--muted); }
.g-filters { padding: 16px; margin-bottom: 14px; box-shadow: none; }
.g-filter-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.g-filter-grid label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.g-filter-grid .input { min-width: 0; width: 100%; }
.g-visibility { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.g-visibility label { cursor: pointer; gap: 6px; }
.g-toolbar { justify-content: space-between; gap: 12px; }
.project-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--sp-4); }
.project-preview { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px var(--sp-4) var(--sp-3); border-top: 3px solid var(--project-color-vis, var(--project-color)); box-shadow: none; min-width: 0; }
.project-preview:hover, .project-preview:focus-within { border-color: var(--line-strong); border-top-color: var(--project-color-vis, var(--project-color)); box-shadow: var(--shadow); }
.project-preview-head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.project-preview-head h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.project-preview-head .proj-dot { background: var(--project-color-vis, var(--project-color)); }
.project-preview-meta { display: flex; align-items: center; gap: var(--sp-1); margin-top: -6px; }
.project-preview-status { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.project-preview > p { margin: 0; }
.project-preview-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--sp-3); }
.project-preview-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-preview-metric b { font-size: var(--fs-lg); color: var(--brand-ink); white-space: nowrap; }
.project-preview-metric b small { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.project-preview-metric :is(.progress, .mg-resource-bar) { height: 5px; margin: 0; }
.project-preview-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.project-preview-foot .ico { width: 13px; height: 13px; vertical-align: -2px; }
.project-preview-link { font-weight: 600; white-space: nowrap; margin-left: auto; }
/* Tutta la scheda apre la dashboard: un solo collegamento, esteso; le informazioni restano raggiungibili sopra. */
.project-preview-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.project-preview .info-btn { position: relative; z-index: 1; }
.project-preview-table .project-preview-status { min-width: 150px; }
@media (max-width: 860px) { .g-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.g-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--arancio); z-index: 1; }
.g-bar { position: absolute; top: 8px; height: 18px; border-radius: 4px; background: #9cc6d6; border: 0; padding: 0; overflow: hidden; cursor: pointer; min-width: 4px; }
.g-bar .g-fill { display: block; height: 100%; background: var(--celeste); }
.g-bar.todo { background: #dfe7ec; }
.g-bar.todo .g-fill { background: #c9d6de; }
.g-bar.done { background: var(--ok); }
.g-bar.done .g-fill { background: var(--ok); }
.g-bar.late { background: #f0c0bb; box-shadow: inset 0 0 0 2px var(--danger); }
.g-bar.late .g-fill { background: var(--danger); }
.g-sum { position: absolute; top: 14px; height: 6px; background: var(--navy); border-radius: 2px; opacity: .55; }
.g-ms { position: absolute; top: 9px; width: 14px; height: 14px; margin-left: -7px; transform: rotate(45deg); background: var(--navy); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--navy); padding: 0; cursor: pointer; z-index: 2; }
.g-ms.done { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.g-ms.late { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.g-ms-ico { display: inline-block; width: 10px; height: 10px; transform: rotate(45deg); background: var(--navy); flex: none; margin: 0 4px; }
.g-ms-ico.done { background: var(--ok); }
.g-ms-ico.late { background: var(--danger); }
.legend .g-ms-ico { width: 9px; height: 9px; border-radius: 0; margin: 0 6px 0 2px; }
.g-day { position: absolute; top: 9px; height: 16px; min-width: 3px; border: 0; padding: 0; border-radius: 2px; background: var(--ok); cursor: pointer; }
.g-day.att { background: var(--warn); }
.g-day.scop { background: var(--danger); }
.g-day.past { background: #b8c7d0; }

/* ---------- Direzione ---------- */
.dir-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dir-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dir-kpis .strong { font-size: 18px; }
.dir-more { margin-top: 10px; }
.dir-more summary { cursor: pointer; color: var(--link); }
.ecobar { height: 14px; }

/* ---------- Guida ---------- */
.path { counter-reset: st; }
.path li { margin-bottom: 4px; }
.kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav { display: none; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(7,37,54,.45); z-index: 90; display: flex; align-items: flex-end; }
.sheet { background: var(--surface); width: 100%; border-radius: 16px 16px 0 0; padding: 10px 0 calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
.sheet .grab { width: 40px; height: 4px; background: var(--line-strong); border-radius: 99px; margin: 4px auto 10px; }
.sheet a { display: flex; gap: 12px; align-items: center; padding: 12px 20px; color: var(--text); text-decoration: none; }
.sheet a.active { color: var(--brand-ink); font-weight: 600; background: var(--celeste-50); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { background: none; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .mobile-logo { display: block; width: 30px; height: 30px; }
  .topbar .title { font-size: 16px; }
  .userchip .who, .sync-pill .lbl-long { display: none; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .g2, .g3 { grid-template-columns: 1fr; }
  .h-bracket { font-size: 21px; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a, .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--muted); text-decoration: none; border: 0; background: none; padding: 4px 0; position: relative; min-height: 48px; justify-content: center;
  }
  .bottomnav .on { color: var(--brand-ink); font-weight: 600; }
  .bottomnav .on .ico { color: var(--arancio); }
  .bottomnav .ico { width: 22px; height: 22px; }
  .bottomnav .count { position: absolute; top: 0; left: 55%; background: var(--arancio); color: var(--on-accent); border-radius: 99px; font-size: 10px; padding: 0 5px; font-weight: 700; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px 20px; min-height: 180px; }
  .login .art .claim { display: none; }
  .cal .day { min-height: 64px; padding: 2px; }
  .cal .ev { font-size: 10px; padding: 1px 3px; }
  .cal .dow { padding: 4px; font-size: 10px; }
  .cal .day-add { display: none; }
  .gantt { --g-label: 150px; }
  .g-label { font-size: 12px; padding: 4px 6px; }
  .g-row:not(.g-wp):not(.g-head) .g-label { padding-left: 10px; }
  .g-label .row { display: none; }
  .draft-slot { max-width: none; width: 100%; }
  .draft-cell { min-width: 0; }
  .as-cal .day { min-height: 70px; }
  .as-ev .tiny { display: none; }
  .cal-people-list { justify-content: flex-start; }
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl.responsive td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.responsive td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .tbl.responsive td.full { display: block; text-align: left; }
  .tbl.responsive td.full::before { display: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-width: none !important; }
  .modal-body { max-height: 66vh; }
  .dropdown { right: 8px; }
  #toast-root { bottom: calc(80px + env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%); width: min(92vw, 460px); align-items: center; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 861px) { .only-mobile { display: none !important; } }

/* Iterazione 3: assenze e disponibilità nel calendario, sotto-attività, voci del listino */
.cal .ev.assenza, .agenda .ev.assenza { background: var(--assenza); }
.cal .ev.disp, .agenda .ev.disp { background: var(--disp-50); color: var(--disp-ink); border: 1px solid var(--disp); cursor: default; }
.cal .ev.task-chip, .agenda .cal-extra .ev.task-chip, .legend i.task-chip { background: var(--surface-2); background: color-mix(in srgb, var(--project-color, var(--muted)) 8%, transparent); color: var(--text); border: 1px dashed var(--project-color-vis, var(--muted)); }
.agenda .cal-extra { gap: 6px; flex-wrap: wrap; }
.agenda .cal-extra .ev { display: inline-block; width: auto; font-size: 12px; padding: 2px 8px; border-radius: 6px; color: #fff; border: 0; }
.agenda .cal-extra .ev.disp { color: var(--disp-ink); border: 1px solid var(--disp); }
.tbl tr.task-child td:first-child { padding-left: 28px; }
.tbl tr.task-child { background: var(--surface-2); }
.quota-row { align-items: flex-end; border-bottom: 1px dashed var(--line); padding-bottom: 6px; margin-bottom: 6px; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

/* Iterazione 4: menu per funzione, avvisi, azioni sempre raggiungibili */
.nav .view-label { font-size: 12px; font-weight: 700; color: #fff; margin: 6px 10px 2px; letter-spacing: .02em; }
.sheet-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 20px 2px; }
.app-avviso { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid #bcdbe7; background: var(--celeste-50); font-size: 13px; }
.app-avviso.warn { border-color: #f0d49e; background: var(--warn-50); }
.app-avviso .ico { flex: none; }
.ts-top .ico { width: 16px; height: 16px; }
.formula-choice { width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 0; border-bottom: 1px solid var(--line); }
.formula-choice.sel { background: var(--surface-2); color: var(--brand-ink); font-weight: 600; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
label.btn { cursor: pointer; }
.seg-wrap { flex-wrap: wrap; }
code.codice { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--brand-ink); white-space: nowrap; }
.row-off { opacity: .55; }
.row-off td { text-decoration: none; }
.modo-btn { font-weight: 600; white-space: nowrap; }
.carico-det .loadbar { margin-bottom: 2px; }
.carico-det .tiny { line-height: 1.35; }
:focus-visible { outline: 3px solid rgba(245, 97, 0, .55); outline-offset: 2px; }

/* Team Possibile */
.tp-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.tp-row .reasons { margin: 2px 0 0; }
.tp-cols > div { min-width: 0; }

/* Pianificazione trasversale: elenco riducibile | calendario | persone e selezione */
.ex-sum { gap: 6px; flex-wrap: wrap; }
.ex-grid { display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(280px, 360px); gap: 14px; align-items: start; }
.ex-grid.no-list { grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); }
.ex-list-body { max-height: 70vh; overflow: auto; padding: 0 0 8px; }
.ex-list .dayhead { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px 2px; text-transform: capitalize; }
.ex-item { display: flex; align-items: flex-start; gap: 4px; margin: 3px 8px; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 6px; background: #fff; }
.ex-item.lv-avviso { border-left-color: var(--warn); }
.ex-item.lv-blocco, .ex-item.lv-impossibile { border-left-color: var(--danger); }
.ex-item.lv-vuoto { border-left-style: dashed; border-left-color: var(--danger); }
.ex-item.sel { box-shadow: 0 0 0 2px var(--arancio); }
.ex-item-main { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; background: none; border: 0; padding: 5px 6px; cursor: pointer; color: var(--text); font: inherit; }
.ex-item-main .as-av { display: flex; gap: 2px; margin-top: 3px; flex-wrap: wrap; }
.ex-menu { position: relative; }
.ex-menu summary { list-style: none; cursor: pointer; }
.ex-menu summary::-webkit-details-marker { display: none; }
.ex-menu-pop { position: absolute; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.ex-cal .as-ev.on { box-shadow: 0 0 0 2px var(--arancio); }
.ex-cal .as-ev .as-av { display: flex; gap: 2px; flex-wrap: wrap; }
.as-ev.cp-ok::after, .as-ev.cp-avviso::after, .as-ev.cp-blocco::after, .as-ev.cp-impossibile::after, .as-ev.cp-assegnato::after { float: right; font-size: 11px; font-weight: 700; margin-top: -16px; }
.as-ev.cp-ok::after { content: "✓"; color: var(--ok); }
.as-ev.cp-avviso::after { content: "⚠"; color: var(--warn); }
.as-ev.cp-blocco::after { content: "✕"; color: var(--danger); }
.as-ev.cp-impossibile::after { content: "⛔"; }
.as-ev.cp-assegnato::after { content: "•"; color: var(--brand-ink); }
.ex-cal .day.p-disp { background: var(--disp-50); }
.ex-cal .day.p-imp { box-shadow: inset 0 0 0 2px var(--navy); }
.p-imp-lbl { display: block; color: var(--brand-ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-pill { position: relative; display: inline-flex; }
.as-pill i { position: absolute; right: -4px; top: -6px; font-style: normal; font-size: 10px; }
.as-pill.esistente .avatar { box-shadow: 0 0 0 2px var(--ok); }
.as-pill.fissato .avatar { box-shadow: 0 0 0 2px var(--navy); }
.as-pill.manuale .avatar { box-shadow: 0 0 0 2px var(--arancio); }
.ex-side .tabs { margin: 0; padding: 0 12px; }
.ex-side .card-body { max-height: 74vh; overflow: auto; }
.ex-people .item { border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: inherit; }
.ex-people .item.sel { background: var(--arancio-50); }
.ex-det .ex-slot { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.rc-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }

@media (max-width: 1100px) {
  .ex-grid, .ex-grid.no-list { grid-template-columns: 1fr; }
  .ex-list-body, .ex-side .card-body { max-height: none; }
}
@media (max-width: 860px) {
  .ts-top { display: inline-flex; width: 40px; min-height: 40px; padding: 10px; flex: none; }
  .ts-top .ico { width: 20px; height: 20px; }
  .ts-top span, .topbar:has(.ts-top) .title { display: none; }
  .ts-tbl td[data-l="Notion"], .ts-tbl td[data-l="Totale"] { font-size: 12px; }
  .tp-cols { gap: 10px; }
  .ex-cal .as-ev .as-av { display: none; }
}
.slot-dots { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.sd { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--celeste); vertical-align: middle; }
.sd.esistente { background: var(--ok); }
.sd.esistente.attesa { background: #fff; border: 2px solid var(--ok); }
.sd.fissato { background: var(--navy); box-shadow: 0 0 0 2px var(--arancio-50); }
.sd.manuale { background: var(--arancio); }
.sd.vuoto { background: #fff; border: 1px dashed var(--danger); }
.toolbar .btn { white-space: normal; }
/* Le colonne delle griglie non si allargano oltre lo schermo per contenuti lunghi (codici, badge, pulsanti) */
.grid > * { min-width: 0; }
@media (max-width: 860px) { .list .item { flex-wrap: wrap; } }

/* Pannello laterale (es. candidati e carichi in "Pianifica il mese"): si apre sopra la pagina senza perdere il modulo */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 70; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .2s ease; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-body .item { border-bottom: 1px solid var(--line); }
.drawer-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-body .list { max-height: none; overflow: visible; }
.ruolo-scelta { align-items: flex-start; } .ruolo-scelta > span { display: flex; flex-direction: column; gap: 2px; } .ruolo-scelta .badge { align-self: flex-start; }

/* Pianificazione trasversale: pannello Operatori a destra e trascinamento */
.ex-side { position: sticky; top: 76px; }
.ex-side .card-body { padding: 0; }
.op-panel-head { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.op-sort { gap: 6px; flex-wrap: nowrap; }
.op-sort select { flex: 1; min-width: 0; }
.op-list { max-height: none; overflow: visible; }
.op-row { display: block; border-bottom: 1px solid var(--line); padding: 8px 12px; cursor: grab; background: var(--surface); }
.op-row:active { cursor: grabbing; }
.op-row.non-cand { background: var(--bg, #f6f8fa); }
.op-row.non-cand .op-name b { color: var(--muted); }
.op-row .op-name { min-width: 0; gap: 6px; }
.op-row .op-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-row .grip { color: var(--faint, #9aa7b2); font-size: 14px; line-height: 1; }
.op-ctl { gap: 8px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.op-ctl .check { margin: 0; }
.drop-slot { display: inline-flex; border-radius: 50%; }
body.ex-dragging [data-drop-g] { outline: 2px dashed rgba(245, 97, 0, .45); outline-offset: 1px; cursor: copy; }
body.ex-dragging .drop-slot { outline-offset: 0; }
[data-drop-g].drop-over { outline: 3px solid var(--arancio) !important; background: var(--arancio-50); }
@media (max-width: 1100px) {
  .ex-side { position: static; }
  .op-panel-head { position: static; }
}
.ex-side .ex-det, .ex-side .card-body > .empty { padding: 12px 14px; }

/* Bozza trasversale come elenco eventi: bordo con colore progetto, posti con nome intero */
.ex-grid .ex-list .ex-list-body { max-height: none; overflow: visible; padding: 0 12px 12px; }
.ex-list .dayhead { padding: 12px 2px 4px; }
.ex-ev { border-radius: 8px; padding: 8px 10px; margin: 6px 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.ex-ev.sel { box-shadow: 0 0 0 3px var(--arancio), 0 1px 2px rgba(0, 0, 0, .12); }
.ex-ev-head { display: flex; gap: 8px; align-items: flex-start; }
.ex-ev-head b { color: inherit; }
.ex-ev-sub { opacity: .9; margin-top: 2px; }
.ex-ev-head .badge, .pf-ev .badge { background: #fff; border-color: transparent; }
.ex-ev-stato.danger { color: var(--danger); }
.ex-ev-stato.warn { color: #8a5a00; }
.ex-ev-stato.ok { color: var(--ok); }
.ex-ev-head .ex-menu summary { color: var(--text); }
.ex-ev-head .ex-menu-pop { color: var(--text); }
.ex-ev-motivo { margin-top: 6px; background: #fff; color: var(--danger); border-radius: 6px; padding: 3px 8px; display: inline-flex; gap: 4px; align-items: center; }
.ex-ev-motivo .ico { width: 13px; height: 13px; }
.ex-posti { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ex-posto { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--celeste); border-radius: 6px; padding: 4px 6px 4px 6px; min-width: 0; max-width: 100%; }
.ex-posto-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ex-posto-txt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-posto.o-esistente { border-left-color: var(--ok); }
.ex-posto.o-esistente.attesa { border-left-style: dashed; }
.ex-posto.o-fissato { border-left-color: var(--navy); }
.ex-posto.o-manuale { border-left-color: var(--arancio); }
.ex-posto.vuoto { border: 1px dashed var(--danger); border-left: 4px dashed var(--danger); }
.ex-posto.vuoto b { color: var(--danger); }
.iconbtn.xs { width: 24px; height: 24px; min-width: 24px; padding: 0; font-size: 12px; }
.pf-ev .small, .pf-ev .row { color: inherit; }
.pf-ev .small { font-weight: 600; }

/* Pannello destro a scomparsa */
.ex-grid.lato-chiuso { grid-template-columns: minmax(0, 1fr) 44px; }
.ex-side .tabs { display: flex; align-items: center; }
.ex-side-chiuso { position: sticky; top: 76px; }
.ex-side-chiuso .btn { writing-mode: vertical-rl; padding: 12px 8px; gap: 6px; height: auto; }
.ex-side-chiuso .btn .ico { transform: none; }
@media (max-width: 1100px) {
  .ex-grid.lato-chiuso { grid-template-columns: 1fr; }
  .ex-side-chiuso { position: static; }
  .ex-side-chiuso .btn { writing-mode: horizontal-tb; }
}
.tbl.responsive td.pf-ev::before { color: inherit; opacity: .85; }
.list.op-list .op-row { display: block; }

/* Pianificazione compatta: progetto e risposta restano due codici indipendenti. */
[hidden], .list.op-list .op-row[hidden] { display: none !important; }
.help { margin: 6px 0; font-size: 12px; }
.help > summary { cursor: pointer; color: var(--muted); }
.help > div { margin-top: 6px; line-height: 1.45; }
.response-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.response-ok { --response: #16845d; color: #14694d; }
.response-wait { --response: #d49b19; color: #805d0a; }
.response-no { --response: #c7463d; color: #a32b23; }
.draft-cell.existing { flex-wrap: wrap; min-width: 0; padding: 5px 8px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--response); }
.draft-cell.existing .tiny { margin-left: auto; color: inherit; }
.draft-cell.existing.response-ok, .ex-posto.response-ok { background: #f1f9f5; }
.draft-cell.existing.response-wait, .ex-posto.response-wait { background: #fff9e8; }
.draft-cell.fixed { background: #f5f9fb; border-color: #a7c0cc; }
.draft-cell.empty { border-color: #c5d2da; border-style: dashed; background: #fff; }
.draft-cell select { min-height: 27px; }
.pf-ev { border-left: 6px solid var(--project-color-vis, var(--project-color)); background: var(--surface); color: var(--text); }
.pf-ev .row { color: var(--muted); }
.ex-ev { background: #fff; color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--project-color-vis, var(--project-color)); box-shadow: none; padding: 12px; margin: 8px 0; }
.ex-ev.sel { box-shadow: 0 0 0 2px #c4dde8; }
.ex-ev-head .badge { border: 1px solid var(--line); }
.ex-ev-head .badge.navy, .pf-ev .badge.navy { background: #eef4f7; color: var(--brand-ink); border-color: #c6d6df; }
.ex-ev-sub { color: var(--muted); margin-top: 5px; }
.ex-posto { padding: 5px 7px; border-left: 3px solid #b6c9d2; border-radius: 5px; }
.ex-posto .avatar, .draft-cell .avatar { width: 25px; height: 25px; font-size: 10px; flex-shrink: 0; }
.ex-posto.o-esistente { border-left-color: var(--response); }
.ex-posto.o-esistente .tiny { color: var(--response); }
.ex-posto.o-fissato { background: #f4f8fa; border-left-color: var(--navy); }
.ex-posto.o-auto, .ex-posto.o-manuale { border-left-color: #b6c9d2; }
.ex-posto.vuoto { border: 1px dashed #bccbd3; background: #fafcfd; }
.ex-posto.vuoto b { color: var(--muted); }
.ex-ev-motivo { background: transparent; color: var(--muted); padding: 0; }
.declined-list { display: flex; flex-wrap: wrap; gap: 6px; }
.declined-list:empty { display: none; }
.declined-person { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; }
.declined-person .ico { width: 13px; height: 13px; }
.as-pill.response-wait .avatar { box-shadow: 0 0 0 2px #d49b19; }
.op-panel-head { gap: 5px; padding: 8px 12px; }
.op-panel-head .month-label { text-transform: capitalize; }
.op-panel-head .input.sm { padding: 5px 8px; min-height: 32px; font-size: 12px; }
.op-panel-head .help { margin: 0; }
.compact-legend { display: flex; flex-wrap: wrap; gap: 3px 9px; line-height: 1.5; color: var(--muted); }
.compact-legend span { display: inline-flex; align-items: center; gap: 4px; }
.compact-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.list.op-list .op-row { padding: 8px 12px; }
.op-row .op-name b { font-size: 13px; }
.op-row .avatar { width: 25px; height: 25px; font-size: 10px; flex-shrink: 0; }
.op-numbers { gap: 6px; }
.op-numbers .sat { font-size: 13px; }
.compact-load { margin-top: 6px; padding: 0 2px; }
.compact-load .loadbar { height: 7px; border-radius: 3px; margin: 2px 0 0; }
.load-values { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; }
.load-values:empty { display: none; }
.load-value { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-size: 11px; font-weight: 600; line-height: 16px; white-space: normal; font-variant-numeric: tabular-nums; }
.load-value i { width: 10px; height: 10px; flex: none; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--text); }
.op-ctl { gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.op-ctl label { gap: 3px; white-space: nowrap; font-size: 10px; }
.op-ctl .check input { width: 14px; height: 14px; }
.op-ctl .input { width: 45px; height: 24px; min-height: 24px; padding: 1px 3px; font-size: 11px; text-align: right; }
.op-cap { margin-left: auto; white-space: nowrap; font-size: 10px; }
.ex-side .tabs { padding: 0 10px; }
.ex-side .tabs button { padding: 10px 6px; }
.ex-side .card-body { max-height: calc(100vh - 140px); }
.tp-review-event { border-left: 3px solid var(--project-color-vis, var(--project-color)); padding: 4px 12px; margin-bottom: 14px; }
.tp-review-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tp-review-row > .row:first-child { flex: 1; min-width: 210px; }
.tp-review-row > .row:first-child > div { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.tp-review-row > .row:last-child { margin-left: auto; }
.tp-review-row .avatar { width: 27px; height: 27px; font-size: 11px; }
@media (min-width: 1101px) { .ex-grid.no-list { grid-template-columns: minmax(0,1fr) 360px; } .ex-grid.lato-chiuso { grid-template-columns: minmax(0,1fr) 44px; } }
@media (max-width: 1100px) { .ex-side { order: -1; } .ex-side .card-body { max-height: 440px; } .op-panel-head { position: sticky; } }
@media (max-width: 600px) {
  .ex-ev-head { flex-wrap: wrap; } .ex-ev-head > .grow { flex-basis: 100%; }
  .ex-posti { gap: 5px; } .ex-posto { max-width: 100%; }
  .ex-posto-txt b { white-space: normal; } .tp-review-row > .row:last-child { margin-left: 0; }
  .response-legend { gap: 5px 10px; } .op-panel-head .input.sm { font-size: 14px; }
}

@media (max-width: 600px) {
  .topbar { gap: 4px; padding: 0 8px; }
  .topbar .viewswitch { min-width: 0; }
  .topbar .viewswitch button { padding: 4px 6px; font-size: 12px; }
  .topbar .spacer { min-width: 0; }
  .topbar .userchip { flex-shrink: 0; }
  .topbar .acct-switch.topbar-only { display: none; } /* su telefono il cambio account è nel menu Account */
}

/* Team Possibile usa gli stessi colori e componenti della pianificazione turni. */
.tp-guide { padding: 0 12px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tp-guide .response-legend { padding: 9px 0; border-bottom: 0; }
.tp-guide .help { margin: 0 0 4px; }
.tp-card { border-left: 4px solid var(--project-color-vis, var(--project-color)); box-shadow: none; overflow: hidden; }
.tp-card.tp-evid { box-shadow: 0 0 0 2px #c4dde8; }
.tp-card-head { align-items: flex-start; gap: 12px; padding: 12px 14px; }
.tp-card-head .h3 { margin: 4px 0 0; line-height: 1.3; font-size: 15px; }
.tp-event-meta { line-height: 1.5; }
.tp-coverage { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.tp-package { margin-top: 5px; background: #eef4f7; color: var(--brand-ink); border-color: #c6d6df; }
.tp-card-body { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; padding: 12px 14px; }
.tp-section-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.tp-section-label .badge { font-weight: 400; }
.tp-card .tp-row { padding: 7px 0; border-bottom: 1px solid var(--line); gap: 6px; }
.tp-card .tp-row:last-of-type { border-bottom: 0; }
.tp-card .tp-row .avatar { width: 25px; height: 25px; font-size: 10px; }
.tp-person-head { gap: 4px 8px; }
.tp-card .tp-row .help { margin: 3px 0 0; font-size: 11px; }
.tp-card .tp-row .help > div { font-size: 12px; }
.tp-card .tp-row .iconbtn { flex-shrink: 0; }
.tp-candidates, .tp-assigned { min-width: 0; }
.tp-candidates > .btn { margin-top: 5px; }
.tp-assigned .ex-posti { margin-top: 0; }
.tp-assigned .ex-posto-txt b { white-space: normal; }
.tp-empty { margin: 6px 0; }
.tp-card-foot { padding: 7px 14px; justify-content: flex-end; background: var(--surface); }
.tp-side .tabs { padding: 7px 12px; border-bottom: 1px solid var(--line); min-height: 45px; }
.tp-side .tabs > b { font-size: 14px; color: var(--brand-ink); }
.tp-side .tabs > .iconbtn { width: 28px; height: 28px; }
.tp-op-bottom { margin-top: 4px; }
.tp-op-bottom .btn { padding: 3px 5px; min-height: 26px; font-size: 11px; }
.tp-op-bottom .btn .ico { width: 13px; height: 13px; }
.tp-event-picker .item { gap: 10px; align-items: flex-start; }
.tp-event-picker .item > .btn { flex-shrink: 0; }
.tp-selected { margin: 12px 0; }
.mg-card { height: 100%; box-shadow: none; min-width: 0; }
.mg-card .card-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.mg-card .card-head p { margin: 4px 0 0; }
.mg-card h2 { margin: 0; }
.mg-card .card-body { padding: 18px; }
.mg-legend { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.mg-legend span { display: inline-flex; gap: 5px; align-items: center; }
.mg-legend i, .mg-state-button i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.mg-bars { display: grid; gap: 15px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.mg-bar-row { display: grid; grid-template-columns: minmax(90px,30%) minmax(0,1fr); gap: 14px; align-items: center; }
.mg-bar-label { font-size: 12px; overflow-wrap: anywhere; }
.mg-bar-label small { display: block; margin-top: 3px; }
.mg-bar-series { display: grid; gap: 5px; }
.mg-bar-line { display: flex; align-items: center; gap: 8px; }
.mg-bar-line > .num { font-size: 11px; min-width: 64px; text-align: right; }
.mg-bar-track { height: 8px; background: var(--surface-2); flex: 1; border-radius: 4px; overflow: hidden; }
.mg-bar-track span { display: block; height: 100%; border-radius: 4px; min-width: 0; }
.mg-state-chart { display: flex; align-items: center; gap: 24px; min-height: 160px; }
.mg-donut { width: 136px; height: 136px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.mg-donut > div { border-radius: 50%; background: white; width: 105px; height: 105px; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.mg-donut b { font-size: 28px; color: var(--brand-ink); }
.mg-donut span { font-size: 12px; color: var(--muted); }
.mg-state-list { flex: 1; min-width: 0; }
.mg-state-button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 0; font: inherit; font-size: 13px; cursor: pointer; text-align: left; color: var(--text); }
.mg-state-button > span { flex: 1; }
.mg-state-button .ico { width: 14px; color: var(--muted); }
.mg-state-button:hover, .mg-task-link:hover { background: var(--surface-2); }
.mg-task-link { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-decoration: none; padding: 12px 0; cursor: pointer; }
.mg-task-link > span:first-child { flex: 1; min-width: 0; }
.mg-task-link b { font-size: 13px; }
.mg-task-link small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.mg-task-link .badge { flex-shrink: 0; }
.mg-section-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }
.mg-section-heading .h2 { flex: 1; margin: 0; }
.mg-wp-table td { vertical-align: top; }
.wp-responsabile { font-weight: 400; }
.mg-wp-table .progress { margin-top: 7px; }
.mg-project-filters label, .mg-dashboard-filters label { display: flex; align-items: center; gap: 8px; }
.mg-project-filters .input, .mg-dashboard-filters .input { width: auto; max-width: 260px; }
.mg-resource-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(270px,1fr)); gap: 16px 28px; }
.mg-resource { padding: 4px 0 13px; border-bottom: 1px solid var(--line); min-width: 0; }
.mg-resource .avatar { width: 27px; height: 27px; font-size: 11px; }
.mg-resource-bar { height: 10px; position: relative; background: #edf2f5; display: flex; margin: 9px 0 6px; border-radius: 3px; }
.mg-resource-bar > span { height: 100%; }
.mg-resource-bar > i { width: 2px; height: 16px; position: absolute; top: -3px; background: #637b88; }
.mg-coverage { display: grid; gap: 18px; }
.mg-coverage a { color: var(--text); }
.mg-deltas { display: flex; flex-wrap: wrap; gap: 15px; }
.mg-deltas > div { min-width: 130px; display: grid; gap: 8px; padding: 10px 15px; border-left: 3px solid var(--line); }
.mg-assignment-groups details { border-bottom: 1px solid var(--line); }
.mg-assignment-groups summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; cursor: pointer; }
.mg-assignment-groups summary:before { content: '›'; color: var(--muted); }
.mg-assignment-groups details[open] summary:before { content: '⌄'; }
.mg-assignment-groups summary .muted { margin-left: auto; }
@media (max-width: 700px) {
  .mg-state-chart { gap: 14px; }
  .mg-donut { width: 104px; height: 104px; }
  .mg-donut > div { width: 80px; height: 80px; }
  .mg-bar-row { grid-template-columns: minmax(80px,28%) minmax(0,1fr); gap: 8px; }
  .mg-resource-list { grid-template-columns: 1fr; }
  .mg-card .card-body { padding: 14px; }
  .mg-project-filters label, .mg-dashboard-filters label { width: 100%; justify-content: space-between; }
  .mg-project-filters .input, .mg-dashboard-filters .input { max-width: 70%; min-width: 0; }
}
body.tp-dragging [data-tp-drop] { outline: 2px dashed #f5610070; outline-offset: 1px; }
.tp-card.tp-drop-over { outline: 3px solid var(--arancio) !important; background: #fff9f2; }
@media (min-width: 1101px) and (max-width: 1350px) {
  .tp-card-body { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 600px) {
  .tp-card-head { flex-wrap: wrap; }
  .tp-coverage { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tp-card-body { grid-template-columns: 1fr; gap: 12px; }
  .tp-event-picker .item { flex-wrap: wrap; }
}

/* Presenze dei manager ("sempre presente"): giorni di assenza in rosso, come nel calendario condiviso */
.avail-cal .day.pr-assente { background: var(--assenza-50); box-shadow: inset 3px 0 0 var(--assenza); }
.avail-cal .day.pr-assente .tag { color: var(--assenza); font-weight: 600; }
.avail-cal .day.pr-presente .avail-day-toggle:hover { background: var(--assenza-50); }

/* Calendario condiviso: elenco dei disponibili apribile e vista settimanale */
.cal .ev.disp-toggle { cursor: pointer; text-align: left; }
.disp-lista { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px; padding: 3px 5px; border-left: 3px solid var(--disp); background: var(--disp-50); border-radius: 4px; font-size: 11px; line-height: 1.3; }
.disp-nome { color: var(--text); overflow-wrap: break-word; }
.disp-nome small { color: var(--muted); }
.cal.cal-week .day { min-height: 320px; }
.cal.cal-week .dnum { text-transform: capitalize; width: auto; padding: 0 7px; border-radius: 99px; white-space: nowrap; display: inline-block; line-height: 22px; }
.cal .day:has(.day-add) .dnum { margin-right: 24px; } /* il + resta sopra il numero, non sopra gli eventi */
.cal .dnum-dow { display: none; }
/* Telefono: la settimana diventa un giorno per riga, così i nomi restano interi */
@media (max-width: 600px) {
  .cal.cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal.cal-week .dow { display: none; }
  .cal.cal-week .day { min-height: 0; border-right: 0; padding: 6px 8px 8px; }
  .cal.cal-week .dnum-dow { display: inline; }
  .cal.cal-week .ev { font-size: 12px; padding: 3px 6px; white-space: normal; }
}

/* Pianificazione trasversale: evidenziazione delle giornate per la persona sotto il mouse o trascinata */
body.ex-hl .ex-ev.hl-ok { outline: 3px solid var(--ok); outline-offset: 1px; background: #eaf7ef; }
body.ex-hl .ex-ev.hl-gia { outline: 3px solid var(--navy); outline-offset: 1px; }
body.ex-hl .ex-ev.hl-no { opacity: .45; }
body.ex-hl .tp-card.hl-ok { outline: 3px solid var(--ok); outline-offset: 1px; background: #eaf7ef; }
body.ex-hl .tp-card.hl-gia { outline: 3px solid var(--navy); outline-offset: 1px; }
body.ex-hl .tp-card.hl-no { opacity: .45; }
.tp-card.focus { box-shadow: 0 0 0 3px var(--celeste); }
body.ex-hl tr.hl-ok > td { background: #eaf7ef; }
body.ex-hl tr.hl-ok > td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
body.ex-hl tr.hl-gia > td:first-child { box-shadow: inset 4px 0 0 var(--navy); }
body.ex-hl tr.hl-no > td { opacity: .45; }
.ex-ev.focus { box-shadow: 0 0 0 3px var(--celeste); }
tr.focus > td { background: #eef6fb; }
tr.focus > td:first-child { box-shadow: inset 4px 0 0 var(--celeste); }
.ex-ev-titolo, .pf-ev-btn { text-align: left; color: inherit; font: inherit; padding: 0; }
.pf-ev-btn { font-size: 13px; font-weight: 600; }
.ex-ev-titolo:hover, .pf-ev-btn:hover { text-decoration: underline; }
.op-focus { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: #eef6fb; border-left: 4px solid var(--celeste); }
.op-focus-liv { margin-top: 3px; }
.op-row.op-no { opacity: .5; }

/* ---------- Archivio Notion TEST ---------- */
.app-avviso.archivio-test { border-color: #b7a3d6; background: #f3eefa; }
.cal .ev.da-associare, .ev.da-associare { background: repeating-linear-gradient(135deg, #eef1f4 0 6px, #e2e7ec 6px 12px); color: #2b3a46; border: 1px dashed #7d8b97; }
.legend i.da-associare, .proj-dot.da-associare { background: repeating-linear-gradient(135deg, #eef1f4 0 4px, #c9d1d8 4px 8px); border: 1px dashed #7d8b97; }
details.anom { border-bottom: 1px solid var(--line, #e5e9ee); padding: 6px 0; }
details.anom summary { cursor: pointer; font-size: 13px; display: flex; gap: 8px; align-items: center; }
details.anom ul { margin: 6px 0 4px 18px; }
.archivio-sel .btn[disabled] { opacity: .55; cursor: not-allowed; }
pre.formula { white-space: pre-wrap; background: var(--surface-2, #f4f6f8); border-radius: 6px; padding: 8px 10px; font-size: 12px; margin: 6px 0; overflow-x: auto; }
.formula-esito ol { margin: 4px 0 8px 18px; }
.list .item.sel { background: var(--celeste-50); }
table.poteri td.poteri-cella { white-space: nowrap; }
.chk-ambito { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; padding: 2px 6px; margin: 1px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.chk-ambito.on { border-color: var(--celeste, #2a8bb5); color: #0d4059; background: var(--celeste-50); }
.chk-ambito input { margin: 0; }
table.poteri tr.grp td { background: var(--surface-2, #f4f6f8); }

/* Matrice «Chi sa fare cosa»: le prime due colonne restano visibili mentre la tabella scorre in orizzontale nella card */
.abil-card { min-width: 0; max-width: 100%; }
.abil-tbl { border-collapse: separate; border-spacing: 0; }
.abil-tbl td { background: var(--surface); }
.abil-tbl .abil-c1, .abil-tbl .abil-c2 { position: sticky; z-index: 1; }
.abil-tbl .abil-c1 { left: 0; min-width: 190px; max-width: 190px; }
.abil-tbl .abil-c2 { left: 190px; min-width: 170px; border-right: 1px solid var(--line-strong); }
.abil-tbl thead .abil-c1, .abil-tbl thead .abil-c2 { background: var(--surface-2); z-index: 2; }
.abil-tbl .abil-prog { text-align: center; border-left: 1px solid var(--line); background: var(--surface-2); }
.abil-tbl .abil-att { text-align: center; white-space: normal; min-width: 96px; max-width: 120px; text-transform: none; letter-spacing: 0; font-size: 12px; vertical-align: bottom; }
.abil-tbl .abil-cella { text-align: center; padding: 6px 8px; }
.abil-tbl .abil-cella input { width: 18px; height: 18px; cursor: pointer; }
.abil-si { color: var(--ok); font-weight: 700; }
.abil-badge { font-size: 10px; margin-left: 4px; }
@media (max-width: 640px) {
  .abil-tbl .abil-c1 { min-width: 140px; max-width: 140px; }
  .abil-tbl .abil-c2 { position: static; }
}

/* Matrici lunghe: scrollbar accessibile senza percorrere tutte le righe. */
.abil-wrap { max-height: clamp(250px, calc(100vh - 420px), 850px); }
.table-wrap:has(.poteri) { max-height: clamp(250px, calc(100vh - 280px), 850px); }
.poteri th:first-child, .poteri td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 180px; }
.poteri th:first-child { background: var(--surface-2); }

/* Dossier operativi: foglio leggibile, tabelle larghe e composizione responsive. */
.ds-document,.ds-editor{max-width:1100px;margin:16px auto 28px}
.ds-block{padding:20px 0;border-bottom:1px solid var(--border,#dce4e9)}
.ds-block h3{margin:0 0 14px}.ds-rich{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65}
.ds-properties{display:grid;grid-template-columns:minmax(150px,28%) 1fr;gap:14px 24px;margin:0}
.ds-properties dt{color:var(--muted,#607684);font-size:13px}.ds-properties dd{margin:0;min-width:0}
.ds-days{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr));gap:16px}
.ds-editor-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:20px 0 28px}
.ds-field,.ds-block-edit{background:var(--surface,#fff);border:1px solid var(--border,#dce4e9);border-radius:12px;padding:18px;min-width:0}
.ds-field details{margin-top:12px}.ds-field summary{cursor:pointer;color:var(--muted,#607684)}
.ds-field-options{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px}.ds-field-options .field{width:100%}
.ds-hidden{border-style:dashed;background:var(--bg,#f5f7f9)}.ds-block-edit{margin:16px 0}
.ds-save{position:sticky;bottom:12px;background:var(--surface,#fff);border:1px solid var(--border,#dce4e9);border-radius:12px;padding:14px;display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:24px;box-shadow:0 4px 20px #1232}
.ds-table{min-width:850px;width:100%}.ds-table td{max-width:300px;white-space:pre-wrap;overflow-wrap:anywhere}.ds-table th{white-space:nowrap}
.ds-col-grip{color:var(--muted);font-weight:normal;cursor:grab;user-select:none;touch-action:none}
.ds-table th[data-ds-col]{cursor:grab;user-select:none;touch-action:pan-x pan-y}
.ds-table .ds-col-grip{touch-action:pan-x pan-y}
.ds-table th[data-ds-col]:focus-visible{outline:2px solid var(--celeste);outline-offset:-2px}
.ds-col-dragging{opacity:.45}
.ds-table th.ds-col-before{box-shadow:inset 3px 0 var(--celeste)}.ds-table th.ds-col-after{box-shadow:inset -3px 0 var(--celeste)}
.ds-column-option.ds-col-before{box-shadow:inset 0 3px var(--celeste)}.ds-column-option.ds-col-after{box-shadow:inset 0 -3px var(--celeste)}
.ds-column-option .check{align-items:center;margin:0}.ds-column-option .row{flex-wrap:nowrap}
.ds-check{padding:5px 0;white-space:pre-wrap}.ds-booking .ds-block:last-child{border:0}
.ds-inline-cell{min-width:0}.ds-cell-trigger{display:block;width:100%;border:1px solid transparent;border-radius:4px;background:transparent;color:inherit;font:inherit;text-align:left;padding:3px 5px;cursor:text;white-space:inherit;overflow-wrap:anywhere}
.ds-table .ds-inline-cell{min-width:125px}.ds-table td:first-child .ds-inline-cell{min-width:190px}
.ds-cell-trigger:hover,.ds-cell-trigger:focus-visible{border-color:var(--line-strong);background:var(--surface-2)}.ds-cell-trigger:focus-visible{outline:2px solid var(--celeste);outline-offset:1px}
.ds-cell-form{min-width:170px;font-size:13px;font-weight:400}.ds-cell-form .field{margin:0 0 8px}.ds-cell-form .input{width:100%;min-width:0}.ds-cell-error{color:var(--danger)}
@media(max-width:680px){.ds-editor-fields{grid-template-columns:1fr}.ds-properties{grid-template-columns:1fr;gap:4px}.ds-properties dd{margin-bottom:14px}.ds-save .small{display:none}}

.ds-omitted{grid-column:1/-1;border:1px dashed var(--line);border-radius:10px;padding:16px}.ds-omitted>summary{cursor:pointer;color:var(--muted)}

/* Listini: voci del progetto e livelli leggibili nei modali stretti. */
.pr-voce, .tf-level { min-width: 0; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.pr-voce .field, .tf-level .field { min-width: 0; }
.tf-ga-price { display: block; overflow-wrap: anywhere; }
.tf-ga-context + .tf-ga-context { margin-top: 10px; }
@media (max-width: 420px) { #pr-form .form-row, #tf-att .form-row { grid-template-columns: minmax(0, 1fr); } }
/* Spese: preventivo (richieste) e consuntivo (registrazioni) in due riquadri ben distinti */
.ss-pannello { margin-top: 12px; }
.ss-pannello + .ss-pannello { margin-top: 28px; }
.ss-pannello > .card-body { padding-top: 4px; }
.ss-pannello.ss-preventivo { border-top: 3px solid var(--info, var(--line)); }
.ss-pannello.ss-consuntivo { border-top: 3px solid var(--ok, var(--line)); }

/* ---------- Componenti comuni di pagina (piano interfaccia, lotto A) ---------- */
/* Testata: titolo con informazioni a richiesta */
.page-title { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.page-head p { max-width: 80ch; }

/* Informazioni a richiesta: pulsante «i» e testo con tooltip */
.info-btn {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: help; vertical-align: middle;
}
.info-btn:hover, .info-btn[aria-describedby] { color: var(--link); background: var(--surface-3); }
.info-btn .ico { width: 16px; height: 16px; }
.has-tip { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
th .has-tip, .legend .has-tip, .badge.has-tip, .kpi .has-tip { text-decoration: none; }
:is(.badge, .sat, .codice, .tiny)[data-tip] { cursor: help; }
.has-tip > :disabled { pointer-events: none; } /* il passaggio del mouse arriva al contenitore, che mostra il motivo del blocco */
.tip {
  position: fixed; z-index: 120; top: 0; left: 0; max-width: min(320px, calc(100vw - 16px)); padding: var(--sp-2) 10px;
  border-radius: var(--radius-sm); background: var(--tip-bg); color: var(--tip-text);
  font-size: var(--fs-sm); line-height: 1.4; font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0;
  white-space: pre-line; overflow-wrap: anywhere; box-shadow: var(--shadow-lg); pointer-events: auto;
}
.tip[hidden] { display: none; }

/* Sezione con intestazione vera */
.section-head > :is(h2, h3) { margin: 0; }
.section-head .count { color: var(--muted); font-size: var(--fs-sm); }

/* Tabella o elenco in scheda, con titolo, conteggio e azioni */
.table-card { overflow: hidden; margin-bottom: var(--sp-4); }
.table-card:last-child { margin-bottom: 0; }
.table-card > .card-head { gap: var(--sp-2); }
.table-card > .card-head :is(h2, h3) { margin: 0; }
.table-card > .card-head .count { color: var(--muted); font-size: var(--fs-sm); }
.table-card > .card-sub { padding: var(--sp-2) var(--sp-4) 0; color: var(--muted); font-size: var(--fs-sm); }
.table-card > .list > .item:first-child { border-top: 0; }

/* Filtri: controlli in riga, etichetta sopra, «Azzera» come collegamento */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); margin-bottom: 14px; }
.filter-bar .field { margin: 0; min-width: 140px; }
/* Etichetta che avvolge il controllo: resta associata senza id e ha lo stesso aspetto di `.field > label`. */
label.field { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
label.field > :is(input, select, textarea) { font-size: var(--fs-md); font-weight: 400; color: var(--text); }
details > summary { cursor: pointer; }
.filter-bar .input { width: auto; min-width: 140px; }
.filter-bar .field .input { width: 100%; }
.filter-bar .filter-reset { align-self: center; }
.filter-bar .filter-count { align-self: center; color: var(--muted); font-size: var(--fs-sm); }
.filter-more { flex: 1 0 100%; }
.filter-more > summary { cursor: pointer; color: var(--link); font-size: var(--fs-sm); width: fit-content; }
.filter-more[open] > summary { margin-bottom: var(--sp-2); }
.filter-more > .filter-bar { margin-bottom: 0; }

/* Stato vuoto con icona, frase e azione */
.empty.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: 32px var(--sp-4); }
.empty-state .ico { width: 28px; height: 28px; color: var(--faint); }
.empty-state .empty-title { color: var(--text); font-weight: 600; }
.empty-state p { margin: 0; max-width: 60ch; }

/* Paginazione */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); color: var(--muted); }
.card > .pager { border-top: 1px solid var(--line); }

/* Colore di progetto adattato al tema: il valore salvato non cambia */
.project-colors { min-width: 0; margin: 0 0 var(--sp-4); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); }
.project-colors legend { font-weight: 600; padding-inline: var(--sp-1); }
.project-colors-options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.project-color-option { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: var(--sp-2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; background: var(--surface); color: var(--text); }
.project-color-option:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.project-color-option:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.project-color-swatch { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; font-weight: 700; }
.project-color-option input:not(:checked) + .project-color-swatch { font-size: 0; }
.project-color-custom { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }
.project-color-custom[hidden] { display: none; }
.project-color-custom .field { flex: 1 1 150px; min-width: 0; }
.project-color-custom input[type="color"] { width: 100%; min-height: 44px; padding: var(--sp-1); }
.project-color-custom p { flex-basis: 100%; margin: 0; }
.project-color-preview { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.project-color-preview [data-color-preview] { display: inline-block; padding: var(--sp-2) var(--sp-3); border: 1px solid currentColor; border-radius: 6px; }
.project-colors > p { margin-bottom: 0; }
[style*="--mini-project"] { --project-color: var(--mini-project); }
/* Fallback neutro per browser senza colori relativi; nomi dei progetti sempre visibili. */
:is([style*="--project-color"], [style*="--mini-project"]) { --project-color-vis: var(--text); }
/* Limiti di luminosità verificati anche sui fondi disponibilità del mini calendario. */
@supports (color: oklch(from #000 min(l, 0.55) c h)) {
  :is([style*="--project-color"], [style*="--mini-project"]) { --project-color-vis: oklch(from var(--project-color) min(l, 0.55) c h); }
  @media screen {
    :root[data-theme="dark"] :is([style*="--project-color"], [style*="--mini-project"]) { --project-color-vis: oklch(from var(--project-color) max(l, 0.76) c h); }
  }
}
:is(.proj-dot, .legend i)[style*="--project-color"] { background: var(--project-color-vis); }

/* Utilità al posto degli stili in linea: spaziatura sulla scala (4, 8, 12, 16 px), colore di stato, allineamento. */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.my-1 { margin-block: var(--sp-1); } .my-2 { margin-block: var(--sp-2); } .m-0 { margin: 0; }
.mr-2 { margin-right: var(--sp-2); } .mr-3 { margin-right: var(--sp-3); } .mr-auto { margin-right: auto; } .ml-auto { margin-left: auto; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-danger { color: var(--danger); } .c-link { color: var(--link); }
.d-block { display: block; } .w-full { width: 100%; } .flex-1 { flex: 1; min-width: 0; }
.items-start { align-items: flex-start; } .justify-end { justify-content: flex-end; }
.list-bordered { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.is-off { opacity: .6; }
.scroll-y { max-height: 50vh; overflow: auto; }
.link-plain { color: inherit; }
.capitalize { text-transform: capitalize; }
.fw-normal { font-weight: 400; }
.pb-0 { padding-bottom: 0; }
.fieldset-plain { border: 0; padding: 0; margin: 0; }
.list > .item.d-block { display: block; }
.input-num { width: 72px; text-align: right; }
.col-span-all { grid-column: 1 / -1; }
.list-compact { margin: var(--sp-1) 0 0; padding-left: 18px; }
.indent-check { margin-left: 26px; }
.legend i.sw-ok { background: var(--ok); }
.legend i.sw-warn { background: var(--warn); }
.legend i.sw-danger { background: var(--danger); }
.legend i.sw-open { background: var(--surface); border: 1px dashed var(--danger); }
.legend i.sw-disp { background: var(--disp); }
.legend i.sw-assenza { background: var(--assenza); }
.legend i.sw-link { background: var(--celeste); }
.legend i.sw-neutral { background: var(--line-strong); }
.card-progetto { border-left: 4px solid var(--project-color-vis, var(--project-color)); }
.senza-tariffa > td { background: var(--warn-50); }
.grid-auto { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.calendar-period { min-width: 140px; text-align: center; }
.load-column { min-width: 180px; }
.progress-column { min-width: 90px; }
.route-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.route-history-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.route-breadcrumb { min-width: 0; flex: 1; }
.route-breadcrumb ol { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); list-style: none; padding: 0; margin: 0; }
.route-breadcrumb li { overflow-wrap: anywhere; }
.route-breadcrumb li + li::before { content: '/'; color: var(--muted); margin-right: var(--sp-2); }
@media (pointer: coarse) { .route-navigation .btn, .route-breadcrumb a { min-height: 44px; display: inline-flex; align-items: center; } }
@media print { .route-navigation { display: none; } }

/* Selezione persone: ricerca e scelte conservate anche quando la lista è filtrata. */
.people-picker { min-width: 0; margin: 0 0 var(--sp-4); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); }
.people-picker legend { font-weight: 600; padding-inline: var(--sp-1); }
.people-picker-toolbar { display: flex; gap: var(--sp-2); align-items: center; }
.people-picker-search { flex: 1; min-width: 0; }
.people-picker-list { max-height: 14rem; overflow: auto; margin-top: var(--sp-2); }
.people-picker-row { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: var(--sp-2); cursor: pointer; }
.people-picker-row[hidden] { display: none; }
.people-picker-row:focus-within { outline: 2px solid var(--link); outline-offset: -2px; }
.people-picker-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.people-picker-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.planning-person-name { font-size: var(--fs-sm); }
.planning-person-state { font-size: var(--fs-xs); white-space: normal; overflow-wrap: anywhere; }

/* Intestazione evento compatta; sui display bassi lascia tutto lo spazio ai contenuti. */
.event-page-head { position: sticky; top: var(--topbar-h); z-index: 12; padding-block: var(--sp-2); background: var(--bg); border-bottom: 1px solid var(--line); }
.event-page-head .grow { min-width: 0; }
.event-page-head h1 { font-size: var(--fs-xl); overflow-wrap: anywhere; }
.event-page-head .row { gap: var(--sp-2); }
@media (max-width: 600px), (max-height: 550px) {
  .event-page-head { position: static; }
}
@media print { .event-page-head { position: static; } }
