/* Cantiere Arona 4 — basato sul design system "Monforte Documenti"
   navy #243746 (logotipo) · rosso #D7282F (simbolo) · Source Sans 3 / Source Code Pro */

:root {
  --navy: #243746;
  --red: #D7282F;
  --ink: #1F2A33;
  --muted: #5F6B76;
  --rule: #C9CED3;
  --row-rule: #DDE1E5;

  /* Fondo caldo: il concept chiede calore, non il bianco anonimo del corporate office */
  --paper: #F7F4EF;
  --surface: #FFFFFF;
  --surface-2: #EFEBE4;
  --note-bg: #F2F4F6;
  --on-navy: #FFFFFF;

  --st-da-avviare: #8A949D;
  --st-in-progettazione: #C98A1B;
  --st-in-corso: #D7282F;
  --st-completato: #3F7D5C;

  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --mono: "Source Code Pro", Menlo, Consolas, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #A9C1D6;
    --ink: #E8E4DD;
    --muted: #A4ACB4;
    --rule: #3A4652;
    --row-rule: #2E3842;
    --paper: #151C22;
    --surface: #1C252D;
    --surface-2: #222D36;
    --note-bg: #222D36;
    --on-navy: #151C22;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .88em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--row-rule);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  min-height: 68px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { height: 26px; width: auto; }
.brand span {
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border-left: 1px solid var(--rule); padding-left: 14px;
}
@media (prefers-color-scheme: dark) { .brand img { filter: brightness(0) invert(.88); } }

.site-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; font-weight: 600; font-size: 15px; color: var(--navy);
  padding: 8px 12px; border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--red); }

@media (max-width: 720px) {
  .site-header .wrap { padding-top: 10px; padding-bottom: 4px; gap: 6px; }
  .site-nav { margin-left: -12px; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}

/* ---------- Tipografia di pagina ---------- */
.kicker {
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--red); margin-bottom: 14px; display: block;
}
@media (prefers-color-scheme: dark) { .kicker { color: #F0767B; } }

.page-head { padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); }
.page-head h1 { font-size: clamp(36px, 6vw, 68px); font-weight: 700; letter-spacing: -.01em; max-width: 16ch; }
.page-head .lead { font-size: clamp(18px, 2vw, 21px); color: var(--muted); max-width: 60ch; margin-top: 18px; }
.page-head::after {
  content: ""; display: block; width: 64px; height: 3px; background: var(--red); margin-top: 32px;
}

.section { padding: clamp(32px, 5vw, 56px) 0; }
.section + .section { border-top: 1px solid var(--row-rule); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-title h2 { font-size: clamp(24px, 3vw, 32px); }
.section-title a { font-weight: 600; color: var(--navy); }

/* ---------- Il faro (criterio fondamentale) ---------- */
.faro {
  background: #243746; color: #FFFFFF;
  padding: clamp(24px, 4vw, 44px); border-radius: var(--radius);
  display: grid; gap: 14px; position: relative;
}
.faro::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--red);
}
.faro .kicker { color: inherit; opacity: .75; margin: 0; }
.faro blockquote { margin: 0; font-size: clamp(20px, 2.6vw, 28px); font-weight: 600; line-height: 1.3; max-width: 46ch; }
.faro p { margin: 0; opacity: .85; max-width: 62ch; }
.faro a { font-weight: 600; }

/* ---------- Griglie e card ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--row-rule); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit;
}
a.card { transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--navy); transform: translateY(-2px); }
.card h3 { font-size: 20px; }
.card p { color: var(--muted); font-size: 15.5px; margin: 0; }
.card .card-foot { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chapter-n { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--red); }
@media (prefers-color-scheme: dark) { .chapter-n { color: #F0767B; } }

/* ---------- Etichette ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border: 1px solid var(--rule); border-radius: 999px; color: var(--navy);
  background: var(--surface); text-decoration: none; white-space: nowrap;
}
.status { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; color: var(--ink); }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--st, var(--muted)); }
.status[data-stato="da-avviare"] { --st: var(--st-da-avviare); }
.status[data-stato="in-progettazione"] { --st: var(--st-in-progettazione); }
.status[data-stato="in-corso"] { --st: var(--st-in-corso); }
.status[data-stato="completato"] { --st: var(--st-completato); }

/* ---------- Numeri cantiere ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--row-rule); border: 1px solid var(--row-rule); }
.stat { background: var(--surface); padding: 20px; }
.stat b { display: block; font-size: 40px; line-height: 1; color: var(--navy); font-weight: 700; }
.stat span { font-size: 14px; color: var(--muted); }

/* ---------- Filtri ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filters button {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--navy);
}
.filters button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }

/* ---------- Premessa (testo lungo) ---------- */
.prose { max-width: 70ch; }
.prose h2 { font-size: clamp(24px, 3vw, 30px); margin: 2.2em 0 .6em; }
.prose h2 .chapter-n { display: block; margin-bottom: 6px; }
.prose h3 { font-size: 20px; margin: 1.6em 0 .4em; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin: .2em 0; }
.prose .question {
  border-left: 3px solid var(--red); padding: 4px 0 4px 16px; margin: 1em 0 1.4em;
  font-weight: 600; color: var(--navy); font-size: 18px;
}
.prose .big { font-size: clamp(20px, 2.4vw, 24px); color: var(--navy); font-weight: 600; line-height: 1.35; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 15px; }
.toc a { display: block; padding: 5px 0; text-decoration: none; color: var(--muted); }
.toc a:hover { color: var(--navy); }
.with-toc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; }
@media (max-width: 900px) { .with-toc { grid-template-columns: 1fr; } .toc { display: none; } }

.principles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.principle { background: var(--surface); border-top: 3px solid var(--navy); padding: 20px; }
.principle .chapter-n { font-size: 13px; }
.principle h3 { font-size: 22px; margin: 4px 0 6px; }
.principle p { color: var(--muted); font-size: 15.5px; }
.principle .q { color: var(--navy); font-weight: 600; font-size: 15.5px; margin: 0; }

.modes { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dettaglio capitolo ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--row-rule); padding: 22px; border-radius: var(--radius); }
.panel + .panel { margin-top: 16px; }
.panel h3 { font-size: 18px; margin-bottom: 12px; }
.empty {
  border: 1px dashed var(--rule); padding: 18px; color: var(--muted); font-size: 15px; border-radius: var(--radius);
}
.check { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.check li { display: grid; gap: 2px; }
.check b { color: var(--navy); }
.check span { color: var(--muted); font-size: 15px; }

table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { background: var(--navy); color: var(--on-navy); text-align: left; padding: 8px 10px; font-weight: 600; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--row-rule); }
table.data td:first-child { font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* ---------- Planimetrie ---------- */
.plan { background: #FFFFFF; border: 1px solid var(--row-rule); padding: 8px; }
.plan img { width: 100%; height: auto; }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.meta { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- Avanzamento ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--red); border-radius: inherit; }
.progress-label { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--navy); min-width: 3.2em; text-align: right; }
.progress-lg { margin-bottom: 16px; }
.progress-lg .progress { height: 10px; }
.progress-lg .progress-label { font-size: 20px; }

/* ---------- Sovrapposizione planimetrie ---------- */
/* La tavola ha un margine sopra: l'interrato, una volta allineato, sporge oltre il piano terra */
.overlay-stage { position: relative; aspect-ratio: 3780 / 3150; overflow: hidden; background: #FFFFFF; touch-action: pan-y; outline: none; }
.overlay-inner { position: absolute; left: 0; right: 0; bottom: 0; height: 80%; }
.overlay-stage img { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: multiply; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.overlay-stage.is-editing { cursor: grab; touch-action: none; box-shadow: inset 0 0 0 2px var(--red); }
.overlay-stage.is-editing:active { cursor: grabbing; }
.align-bar { background: var(--note-bg); border: 1px solid var(--row-rule); padding: 14px 16px; margin-bottom: 12px; border-radius: var(--radius); }
.align-bar[hidden] { display: none; }
.align-bar p { margin: 0 0 10px; font-size: 15px; }
.align-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.align-spacer { flex: 1; }
.overlay-control { margin-top: 16px; }
.overlay-control input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none; height: 6px; border-radius: 999px; margin: 10px 0;
  background: linear-gradient(to right, var(--navy) 0 var(--v, 50%), var(--rule) var(--v, 50%) 100%); cursor: pointer;
}
.overlay-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--red); box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.overlay-control input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--red);
}
.overlay-labels { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--navy); }
.overlay-labels span:nth-child(2) { text-align: center; }
.calibra { margin-top: 20px; border-top: 1px solid var(--row-rule); padding-top: 12px; }
.calibra summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.calibra .meta { margin-top: 8px; max-width: 70ch; }
.calibra-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 12px; }
.calibra-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.calibra-grid input, .calibra-grid button {
  font: inherit; font-size: 15px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); width: 130px;
}
.calibra-grid button { width: auto; cursor: pointer; font-weight: 600; color: var(--navy); }

/* ---------- Pulsanti e campi ---------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--surface); color: var(--navy); white-space: nowrap;
}
.btn:hover { border-color: var(--navy); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: #243746; border-color: #243746; color: #FFFFFF; }
.btn-primary:hover { background: #1A2935; border-color: #1A2935; }
.btn-small { font-size: 13.5px; padding: 5px 10px; }
.btn-danger { color: #A61E24; }
.btn-danger:hover { border-color: #A61E24; }
@media (prefers-color-scheme: dark) {
  .btn-primary { background: #A9C1D6; border-color: #A9C1D6; color: #151C22; }
  .btn-primary:hover { background: #C3D5E4; border-color: #C3D5E4; }
  .btn-danger { color: #F0767B; }
}

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 14px; font-weight: 600; color: var(--navy); }
.field input, .field select, .field textarea, .chat-form textarea, .qa-reply textarea {
  font: inherit; font-size: 16px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: -1px; border-color: var(--navy); }
.form-error { color: #A61E24; background: #FBEDEC; padding: 8px 12px; font-size: 14.5px; margin: 0 0 14px; border-radius: var(--radius); }
.form-error[hidden] { display: none; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 960px; display: grid; grid-template-columns: 1fr 380px; gap: 48px; align-items: center; }
.login-brand h1 { font-size: clamp(34px, 5vw, 54px); max-width: 12ch; }
.login-brand::after { content: ""; display: block; width: 64px; height: 3px; background: var(--red); margin-top: 28px; }
@media (prefers-color-scheme: dark) { .login-brand img { filter: brightness(0) invert(.88); } }
.login-card { background: var(--surface); border: 1px solid var(--row-rule); padding: 28px; border-radius: var(--radius); }
.login-card h2 { font-size: 24px; margin-bottom: 20px; }
.login-card .btn { width: 100%; padding: 12px; font-size: 16px; margin-bottom: 14px; }
@media (max-width: 760px) { .login { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Utente nell'header ---------- */
.user-menu { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--row-rule); }
.user-name { text-decoration: none; display: grid; font-size: 14px; font-weight: 600; color: var(--navy); line-height: 1.2; text-align: right; }
.user-name small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
@media (max-width: 1240px) { .user-name { display: none; } .user-menu { padding-left: 0; border-left: 0; } }
.site-header .wrap { flex-wrap: nowrap; }
.site-nav { flex-wrap: nowrap; }
.site-nav a { white-space: nowrap; }
@media (max-width: 1000px) { .site-header .wrap { flex-wrap: wrap; } .site-nav { order: 3; width: 100%; margin-left: -12px; overflow-x: auto; } .user-menu { margin-left: auto; } }

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #FFFFFF; font-size: 12px; font-weight: 700;
}
.badge[hidden] { display: none; }

/* ---------- Tab amministrazione ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--row-rule); margin-bottom: 24px; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 16px; color: var(--muted); background: none; border: 0;
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  display: inline-flex; gap: 8px; align-items: center;
}
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--red); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
table.data td.mono { font-weight: 400; }

.welcome { border: 0; padding: 28px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border-radius: var(--radius); }
.welcome::backdrop { background: rgba(21, 28, 34, .55); }
.welcome h3 { font-size: 22px; margin-bottom: 6px; }
.welcome textarea { width: 100%; margin: 14px 0; font: inherit; font-size: 15px; padding: 12px; border: 1px solid var(--rule); background: var(--note-bg); color: var(--ink); border-radius: var(--radius); resize: vertical; }
.welcome-actions { display: flex; gap: 10px; }

/* ---------- Domande e risposte ---------- */
.qa-list { display: grid; gap: 14px; max-width: 820px; }
.qa { background: var(--surface); border: 1px solid var(--row-rule); padding: 16px; border-radius: var(--radius); display: grid; gap: 8px; }
.qa-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.qa-head b { color: var(--navy); }
.qa-head span, .qa-head time { color: var(--muted); font-size: 13px; }
.qa-head time { margin-left: auto; }
.qa-page { font-size: 13px; font-weight: 600; color: var(--navy); }
.qa-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-answer { border-left: 3px solid var(--red); background: var(--note-bg); padding: 10px 12px; display: grid; gap: 4px; }
.qa-reply { display: grid; gap: 8px; justify-items: end; }
.qa-reply textarea { font-size: 15px; }

/* ---------- Chat contestuale ---------- */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; border: 0;
  background: #243746; color: #FFFFFF; box-shadow: 0 4px 16px rgba(21, 28, 34, .28);
}
.chat-fab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.chat-fab[aria-expanded="true"] { opacity: 0; pointer-events: none; }
.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 31;
  width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 100px));
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 12px 40px rgba(21, 28, 34, .3);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; background: #243746; color: #FFFFFF; }
.chat-head .meta { color: rgba(255,255,255,.75); display: block; font-size: 13px; }
.chat-close { background: none; border: 0; color: inherit; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 12px; align-content: start; }
.chat-list .qa { padding: 12px; }
.chat-form { border-top: 1px solid var(--row-rule); padding: 12px; background: var(--surface); display: grid; gap: 8px; }
.chat-form textarea { font-size: 15px; resize: none; }
.chat-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-form-foot .meta { font-size: 12.5px; }
@media (max-width: 560px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 85vh; border-radius: 6px 6px 0 0; }
  .chat-fab { right: 16px; bottom: 16px; }
}

/* ---------- Gestionale: elementi comuni ---------- */
.wrap-wide { max-width: 1400px; }
.r { text-align: right; }
th.r { text-align: right; }
.note-box { background: var(--note-bg); border-left: 3px solid var(--navy); padding: 12px 16px; margin: 0 0 20px; font-size: 15.5px; max-width: 900px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: #A61E24; }
.ref-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; background: var(--navy); color: var(--on-navy); vertical-align: 1px; }
.save-state { font-size: 12.5px; color: var(--muted); margin-left: 6px; }
.save-state.ok { color: var(--st-completato); }
.save-state.err { color: #A61E24; }
.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover b { text-decoration: underline; }
.delta { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.delta.up { color: #A61E24; }
.delta.down { color: var(--st-completato); }
@media (prefers-color-scheme: dark) { .delta.up { color: #F0767B; } .delta.down { color: #7BC59C; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; border-bottom: 1px solid var(--row-rule); padding-bottom: 8px; position: sticky; top: 68px; background: var(--paper); z-index: 5; }
.toolbar select { font: inherit; font-size: 14.5px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 260px; }

/* ---------- Capitolato e computo ---------- */
.chapter-block { padding: 28px 0; border-top: 1px solid var(--row-rule); scroll-margin-top: 130px; }
.chapter-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chapter-head h2 { font-size: clamp(22px, 2.6vw, 28px); }
.chapter-head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spec-list { display: grid; gap: 10px; }
.spec-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; background: var(--surface); border: 1px solid var(--row-rule); padding: 14px 16px; border-radius: var(--radius); }
.spec-item h3 { font-size: 17px; margin-bottom: 4px; }
.spec-item p { margin: 0 0 4px; font-size: 15.5px; }
.spec-code { font-size: 13px; color: var(--muted); padding-top: 3px; }
.alt-block { border: 1px dashed var(--rule); padding: 10px; display: grid; gap: 8px; border-radius: var(--radius); }
.alt-head { font-weight: 700; color: var(--navy); font-size: 14px; }
@media (max-width: 640px) { .spec-item { grid-template-columns: 1fr; gap: 4px; } }

table.computo td, table.computo th { vertical-align: middle; }
table.data td.r { font-variant-numeric: tabular-nums; }
.alt-head-row td { background: var(--note-bg); font-weight: 700; font-size: 13px; color: var(--navy); letter-spacing: .02em; }
.alt-row td:first-child { padding-left: 18px; }
.muted-row td { color: var(--muted); }
.total-row td { font-weight: 700; border-top: 2px solid var(--navy); background: var(--surface); }
.total-row small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.price-input { font: inherit; font-size: 15px; width: 120px; text-align: right; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.note-input { font: inherit; font-size: 14px; width: 160px; padding: 6px 8px; border: 1px solid var(--row-rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); }

/* ---------- Economia ---------- */
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--note-bg); }
.drill { margin-top: 20px; }
.drill-table th { white-space: nowrap; }
.price-cell small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.price-cell.is-min { background: rgba(63, 125, 92, .12); }
.combo h3 { font-size: 19px; }
.combo-best { border-color: var(--navy); border-width: 2px; }
.combo-list { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13.5px; display: grid; gap: 3px; }
.combo-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--row-rule); padding: 3px 0; }
.combo-list b { color: var(--navy); text-align: right; }

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lightbox::backdrop { background: rgba(21, 28, 34, .6); }
.lightbox-inner { padding: clamp(20px, 4vw, 32px); display: grid; gap: 12px; }
.lightbox h2 { font-size: clamp(22px, 3vw, 28px); }
.lightbox-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-top: 6px; }
.lightbox-actions .meta { margin-right: auto; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; }
.cap-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--row-rule); border-radius: var(--radius); cursor: pointer; }
.cap-option:has(input:checked) { border-color: var(--navy); background: var(--note-bg); }
.cap-option input { margin-top: 4px; width: 18px; height: 18px; accent-color: #243746; }
.cap-option b { display: block; color: var(--navy); font-size: 15px; }
.cap-option small { color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 20px; margin: 8px 0 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.works { padding-left: 1.1em; margin: 0; display: grid; gap: 6px; }

/* ---------- Moduli ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.alt-fieldset, .work-row { border: 1px solid var(--row-rule); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
.alt-fieldset legend, .work-row legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.profile-form { display: grid; gap: 16px; max-width: 900px; }
.profile-form .panel + .panel { margin-top: 0; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Foto ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { margin: 0; display: grid; gap: 6px; }
.photo-open { padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); }
.photo-open img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photo-open:hover img { transform: scale(1.03); }
.photo figcaption { font-size: 13.5px; line-height: 1.35; }
.photo-tools { display: block; margin-top: 2px; font-size: 12.5px; }
.caption-form { display: flex; gap: 6px; }
.caption-form input { font: inherit; font-size: 14px; flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.upload-btn { cursor: pointer; }
.dropzone { border: 2px dashed var(--navy); padding: 24px; text-align: center; font-weight: 600; color: var(--navy); margin-bottom: 12px; border-radius: var(--radius); }
.dropzone[hidden] { display: none; }
#upload-status { margin-bottom: 12px; }
.photo-viewer { border: 0; padding: 0; background: #0E1317; max-width: 96vw; max-height: 94vh; border-radius: 4px; }
.photo-viewer::backdrop { background: rgba(0,0,0,.85); }
.photo-viewer img { max-width: 96vw; max-height: calc(94vh - 56px); display: block; margin: 0 auto; }
.pv-bar { display: flex; gap: 10px; align-items: center; padding: 10px 12px; color: #FFFFFF; font-size: 14px; }
.pv-bar > span { flex: 1; text-align: center; }
.pv-bar .meta { color: rgba(255,255,255,.65); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 56px; padding: 28px 0 40px; font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer b { color: var(--navy); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.photo-grid > .empty { grid-column: 1 / -1; }

/* Tempi dichiarati nel computo */
.date-input, .days-input { font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.date-input { width: 140px; }
.days-input { width: 64px; text-align: right; }
.end-hint { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.th-sub { font-weight: 400; font-size: 12px; opacity: .75; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 15px; }

/* Cronoprogramma */
.stat b.stat-date { font-size: 30px; }
.g-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 22px 0 12px; font-size: 14px; }
.g-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.g-key { display: inline-block; width: 22px; height: 10px; border-radius: 2px; }
.g-key.g-plan { background: var(--navy); opacity: .35; }
.g-key.fill { background: var(--navy); }
.g-key.decl { background: transparent; border: 2px solid var(--red); height: 8px; }
.g-key.late { background: repeating-linear-gradient(45deg, var(--red) 0 3px, transparent 3px 6px); border: 2px solid var(--red); height: 8px; }
.g-key.today { width: 2px; height: 16px; background: var(--red); }
.gantt { min-width: 940px; border: 1px solid var(--row-rule); background: var(--surface); border-radius: var(--radius); }
.g-row { display: grid; grid-template-columns: 300px 1fr; border-bottom: 1px solid var(--row-rule); }
.g-group > .g-row:last-child, .g-group:last-child > .g-row:last-child { border-bottom-color: var(--rule); }
.g-label { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--row-rule); min-width: 0; }
.g-label .meta { font-size: 13px; }
.g-name { font-weight: 600; color: var(--navy); text-decoration: none; }
.g-name:hover { text-decoration: underline; }
.g-name .mono { color: var(--red); font-size: 13px; }
.g-label .link-btn { font-size: 13px; align-self: flex-start; }
.g-sub .g-label { padding-left: 26px; }
.g-company { font-size: 14px; font-weight: 600; color: var(--ink); }
.g-flag { font-size: 12px; color: var(--muted); }
.g-flag.late { color: #A61E24; font-weight: 600; }
.g-track { position: relative; min-height: 44px;
  background: repeating-linear-gradient(90deg, transparent 0 calc(var(--week) * 5 / 7), var(--surface-2) calc(var(--week) * 5 / 7) var(--week)); }
.g-head .g-track { min-height: 46px; background: none; }
.g-months span, .g-weeks span { position: absolute; white-space: nowrap; font-size: 12px; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--row-rule); }
.g-months span { top: 4px; font-weight: 600; color: var(--navy); text-transform: capitalize; font-size: 13px; border-left-color: var(--rule); }
.g-weeks span { top: 24px; height: 22px; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--red); z-index: 2; }
.g-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 16px; border-radius: 3px; min-width: 4px; overflow: hidden; }
.g-plan { background: color-mix(in srgb, var(--navy) 30%, transparent); }
.g-plan[data-stato="in-corso"] { box-shadow: inset 0 0 0 2px var(--navy); }
.g-plan[data-stato="completato"] { background: color-mix(in srgb, var(--st-completato) 45%, transparent); }
.g-fill { display: block; height: 100%; background: var(--navy); }
.g-bar.decl { height: 10px; border: 2px solid var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.g-bar.decl.late { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--red) 55%, transparent) 0 3px, transparent 3px 6px); }
@media (max-width: 720px) { .g-row { grid-template-columns: 200px 1fr; } }
.g-actions { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

/* Impersonificazione */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; }
.impersonate-bar { background: var(--red); color: #fff; font-size: 15px; }
.impersonate-bar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.impersonate-bar span { flex: 1; min-width: 200px; }
.impersonate-bar b { color: #fff; }
.impersonate-bar .btn { background: #fff; color: #A61E24; border-color: #fff; }

/* Vista 3D dei livelli */
.l3d { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 0; border-radius: var(--radius); overflow: hidden;
  background: #0B121A; color: #DCE6EF; border: 1px solid #1E2C38; }
.l3d-stage { position: relative; height: clamp(420px, 68vh, 720px); perspective: 1700px; perspective-origin: 50% 35%; overflow: hidden;
  cursor: grab; touch-action: pan-y; outline: none; user-select: none;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(79,195,247,.10), transparent 60%),
    linear-gradient(rgba(120,160,190,.06) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(120,160,190,.06) 1px, transparent 1px) 0 0 / 40px 40px,
    #0B121A; }
.l3d-stage:focus-visible { box-shadow: inset 0 0 0 2px #4FC3F7; }
.l3d-stage.dragging { cursor: grabbing; }
.l3d-rig { position: absolute; left: 50%; top: 52%; transform-style: preserve-3d; transform-origin: 50% 50%; }
.l3d-level { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform-style: preserve-3d; transition: opacity .25s; pointer-events: none; }
.l3d-level canvas { width: 100%; height: 100%; display: block; }
.l3d-level.dim { opacity: .18; }
.l3d-hint { position: absolute; left: 16px; bottom: 12px; margin: 0; font-size: 13px; color: #8FA5B8; transition: opacity .6s; pointer-events: none; }
.l3d-hint.gone { opacity: 0; }
.l3d-side { border-left: 1px solid #1E2C38; padding: 18px; display: flex; flex-direction: column; gap: 16px; background: #0E1720; }
.l3d-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.l3d-legend button { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; font: inherit; color: inherit;
  background: transparent; border: 1px solid #1E2C38; border-radius: var(--radius); padding: 8px 10px; cursor: pointer; }
.l3d-legend button:hover { border-color: var(--c); }
.l3d-legend button[aria-pressed="false"] { opacity: .4; }
.l3d-legend i { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 2px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.l3d-legend b { display: block; color: #fff; font-size: 15px; }
.l3d-legend small { display: block; color: #8FA5B8; font-size: 12.5px; line-height: 1.35; }
.l3d-range { display: grid; gap: 6px; font-size: 13px; color: #8FA5B8; }
.l3d-range input { accent-color: #4FC3F7; }
.l3d-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.l3d .btn { background: transparent; color: #DCE6EF; border-color: #2B3D4C; }
.l3d .btn:hover { border-color: #4FC3F7; }
.l3d-note { color: #8FA5B8 !important; font-size: 12.5px; margin: 0; }
@media (max-width: 820px) {
  .l3d { grid-template-columns: 1fr; }
  .l3d-side { border-left: 0; border-top: 1px solid #1E2C38; }
}
/* Editor dei contorni */
.l3d-editor { width: min(1100px, calc(100vw - 24px)); }
.l3d-ed-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.l3d-ed-tabs button { display: inline-flex; gap: 8px; align-items: center; font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
.l3d-ed-tabs button[aria-selected="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); font-weight: 600; }
.l3d-ed-tabs i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.l3d-ed-board { position: relative; background: #fff; border: 1px solid var(--row-rule); }
.l3d-ed-board img { display: block; width: 100%; height: auto; user-select: none; }
.l3d-ed-board svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.l3d-ed-board polygon { fill: color-mix(in srgb, var(--c) 18%, transparent); stroke: var(--c); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.l3d-ed-board polygon.other { fill: color-mix(in srgb, var(--c) 8%, transparent); stroke-dasharray: 6 4; opacity: .7; pointer-events: none; }
.l3d-ed-board .vtx { fill: #fff; stroke: var(--c); stroke-width: 3; cursor: move; vector-effect: non-scaling-stroke; }
.l3d-ed-board .vtx:hover { fill: var(--c); }
/* Scale nella vista 3D */
.l3d-stair, .l3d-landing { position: absolute; left: 0; top: 0; transform-origin: 0 50%; pointer-events: none;
  border-top: 1.5px solid rgba(230,241,255,.9); border-bottom: 1.5px solid rgba(230,241,255,.9); box-sizing: border-box;
  box-shadow: 0 0 14px rgba(230,241,255,.35); }
.l3d-stair { background-image: linear-gradient(90deg, rgba(230,241,255,.95) 0 2px, rgba(230,241,255,.16) 2px 100%); }
.l3d-landing { transform-origin: 0 0; border: 1.5px solid rgba(230,241,255,.9); background: rgba(230,241,255,.14); }
.l3d-ed-board .stair-line { stroke: rgba(36,55,70,.45); stroke-linecap: butt; }
.l3d-ed-board .vtx.hi { fill: var(--red); }
/* Campo da sistemare nella scheda azienda */
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 25%, transparent); }
.field-msg { color: var(--red); font-size: 13px; font-weight: 600; }

/* Notifiche */
.notif-btn { position: relative; background: none; border: 1px solid var(--rule); border-radius: var(--radius); color: var(--navy); padding: 5px 7px; cursor: pointer; display: inline-flex; }
.notif-btn:hover { border-color: var(--navy); }
.notif-count { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notif-count[hidden] { display: none; }
.notif-panel { position: absolute; z-index: 80; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 14px 16px; }
.notif-panel h3 { font-size: 17px; margin-bottom: 8px; }
.notif-panel ul { list-style: none; margin: 0; padding: 0; display: grid; }
.notif-panel li { padding: 9px 0; border-top: 1px solid var(--row-rule); font-size: 14.5px; display: grid; gap: 2px; }
.notif-panel li.new { font-weight: 600; }
.notif-panel li.new::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: inline-block; margin-right: 6px; }
.notif-panel time { font-size: 12px; color: var(--muted); font-weight: 400; }
.notif-panel a { color: var(--ink); }

/* Candidature e gara */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.contract-forms { margin-top: 16px; }
.contract-forms h3 { font-size: 18px; }
.cand-stato { display: inline-block; vertical-align: middle; margin-left: 8px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.cand-stato[data-tono="warn"] { background: color-mix(in srgb, var(--st-in-progettazione) 22%, transparent); }
.cand-stato[data-tono="ok"] { background: color-mix(in srgb, var(--st-completato) 22%, transparent); }
.cand-stato[data-tono="win"] { background: var(--navy); color: var(--on-navy, #fff); }
.cand-stato[data-tono="off"] { opacity: .7; }
.cand-banner { background: var(--surface); border: 1px solid var(--row-rule); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 8px; display: grid; gap: 8px; }
.cand-banner p { margin: 0; }
.cand-links a { font-weight: 600; }
.doc-exp[data-st="scaduto"] { color: #A61E24; font-weight: 600; }
.doc-exp[data-st="in-scadenza"] { color: var(--st-in-progettazione); font-weight: 600; }
.ok-box { border-left-color: var(--st-completato); }
.stars { color: var(--st-in-progettazione); letter-spacing: 1px; white-space: nowrap; }
.visits { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.visits > li { background: var(--surface); border: 1px solid var(--row-rule); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.visits ul { flex-basis: 100%; list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.cand-table select, [data-tender] select, [data-tender] input { font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 230px; }
.docs-table td { vertical-align: top; }
.doc-upload { margin-top: 14px; }
.faq { margin-bottom: 14px; }
.print-chapter { margin-top: 28px; break-inside: avoid-page; }
.print-chapter h2 { font-size: 22px; margin-bottom: 4px; }
.print-total { font-size: 20px; margin-top: 24px; }
@media print {
  .site-header, .site-footer, .chat, .chat-fab, .notif-panel, .impersonate-bar, .no-print, .page-head .lead, .page-head::after { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .page-head { padding: 0 0 12px; }
  table.data { font-size: 11pt; }
}

/* Header con più voci: si compatta prima di andare a capo */
.brand span, .user-name { white-space: nowrap; }
@media (max-width: 1500px) { .brand span { display: none; } .site-header .wrap { gap: 16px; } }
@media (max-width: 1380px) { .user-name { display: none; } .user-menu { padding-left: 0; border-left: 0; } .site-nav a { padding: 8px 9px; } }
@media (max-width: 1180px) { .site-header .wrap { flex-wrap: wrap; } .site-nav { order: 3; width: 100%; margin-left: -12px; overflow-x: auto; } .user-menu { margin-left: auto; } }

/* Foto nel cronoprogramma */
.g-photo { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 26px; height: 26px; padding: 0; border-radius: 50%; overflow: visible;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--navy), 0 2px 6px rgba(0,0,0,.3); background: var(--surface-2); cursor: zoom-in; z-index: 3; }
.g-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.g-photo b { position: absolute; top: -8px; right: -9px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 16px; text-align: center; }
.g-photo:hover, .g-photo:focus-visible { transform: translate(-50%, -50%) scale(1.6); z-index: 4; }
.g-row .g-track .g-photo { top: auto; bottom: -2px; transform: translate(-50%, 0); }
.g-row .g-track .g-photo:hover { transform: translate(-50%, 0) scale(1.6); }
.g-photos-row .g-track .g-photo { top: 50%; bottom: auto; transform: translate(-50%, -50%); }
.g-photos-row .g-track .g-photo:hover { transform: translate(-50%, -50%) scale(1.6); }
.g-photos-row { background: color-mix(in srgb, var(--navy) 5%, transparent); }
.g-key.photo { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); box-shadow: 0 0 0 1.5px var(--navy); }
#crono-photo figure { margin: 0; }
#crono-photo figcaption { color: #fff; text-align: center; padding: 10px 56px 14px; font-size: 14px; }
#crono-photo figcaption .meta { color: rgba(255,255,255,.7); }
#crono-photo figcaption a { color: #fff; }
.pv-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.pv-btn:disabled { opacity: .25; cursor: default; }
.pv-prev { left: 10px; } .pv-next { right: 10px; }
.pv-close { top: 10px; right: 10px; transform: none; font-size: 24px; }

/* Avvisi, conferme, accessibilità, gara nel computo, cose da fare */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); color: var(--navy); padding: 8px 14px; border: 2px solid var(--red); font-weight: 600; }
.skip-link:focus { left: 12px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.toast { background: #A61E24; color: #fff; padding: 12px 16px; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: 15px; }
.toast.ok { background: var(--st-completato); }
.confirm-dialog { width: min(520px, calc(100vw - 24px)); }
.confirm-text { margin: 0; }
.btn-danger-solid { background: #A61E24; border-color: #A61E24; color: #fff; }
.scheda-btn { display: none; }
@media (max-width: 1380px) { .scheda-btn { display: inline-flex; } }
.gara-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 14px; margin: 0 0 10px; border: 1px solid var(--row-rule); border-left: 4px solid var(--red); border-radius: var(--radius); background: var(--surface); font-size: 14.5px; }
.gara-bar > span:first-child { flex: 1; min-width: 200px; }
.gara-bar.closed { border-left-color: var(--muted); }
.chapter-block.is-closed input:disabled { opacity: .6; cursor: not-allowed; }
.price-input { width: 110px; text-align: right; }
td .save-state { display: block; font-size: 12px; min-height: 1em; }
.todo { margin: 0 0 28px; border-left: 4px solid var(--red); }
.todo h2 { font-size: 22px; margin-bottom: 10px; }
.todo ul, .todo ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.todo ol { list-style: none; padding-left: 0; }
.todo li.done a { color: var(--st-completato); }
.todo a { font-weight: 600; text-decoration: none; color: var(--navy); }
.todo a:hover { text-decoration: underline; }
@media (max-width: 720px) {
  /* Computo delle imprese: ogni voce diventa una scheda */
  table.computo, table.computo tbody, table.computo tr, table.computo td { display: block; width: 100%; }
  table.computo thead { display: none; }
  table.computo tr { border-bottom: 1px solid var(--rule); padding: 8px 0; }
  table.computo td { border: 0; padding: 3px 0; text-align: left !important; }
  table.computo .price-input, table.computo .date-input, table.computo .note-input { width: 100%; }
}
