/* Contanotti — stile del lavoro quotidiano. Pensato per il telefono; da 960px in su compare il menu laterale. */

/* ---------- struttura: barra in basso (telefono) o menu laterale (schermo largo) ---------- */
.d-wrap { min-height: 100vh; min-height: 100dvh; }
.d-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 0 4px env(safe-area-inset-bottom); }
.d-brand { display: none; }
.d-ni { position: relative; flex: 1 1 0; min-width: 0; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px 4px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; line-height: 1.1; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.d-ni .d-ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.d-ni[data-go="altro"] .d-ic { fill: currentColor; stroke: none; }
.d-nl { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.d-ni[aria-current="page"] { color: var(--spruce); font-weight: 600; }
.d-ni[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--spruce); }
.d-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; line-height: 20px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.d-badge.calm { background: var(--spruce); }
.d-ver { display: none; }
/* puntino «c'è una novità»: sull'icona Altro finché non apri la pagina Novità della versione in uso */
.d-dot { position: absolute; top: 9px; left: calc(50% + 9px); width: 11px; height: 11px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--card); }
.d-row-new { position: absolute; top: 14px; right: 16px; padding: 2px 9px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; font-weight: 600; }

.d-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px 112px; }
.d-top { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: 10px 16px; background: rgba(243, 245, 242, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.d-top-t { flex: 1; min-width: 0; font-family: var(--font-anthropic-serif); font-weight: 600; font-size: 20px; line-height: 1.1; color: var(--spruce); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-scope { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; }
.d-scope .dash-select { min-height: 40px; padding: 6px 30px 6px 12px; font-size: 15px; font-weight: 500; border-radius: 999px; background-color: var(--card); max-width: 54vw; }
body[data-scope="off"] .d-scope { display: none; }

@media (min-width: 960px) {
  .d-wrap { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .d-nav { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 22px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .d-brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 22px; }
  .d-brand .brand-mark { flex: none; display: block; }
  .d-brand b { display: block; font-family: var(--font-anthropic-serif); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -.01em; color: var(--spruce); }
  .d-brand > span { min-width: 0; }
  .d-brand small { display: block; margin-top: 5px; font-family: var(--font-anthropic-sans); font-weight: 500; font-size: 12.5px; line-height: 1.25; color: var(--ink-2); }
  .d-ver { display: block; margin-top: auto; padding: 10px 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 13.5px; text-align: left; color: var(--ink-2); cursor: pointer; }
  .d-ver:hover { background: var(--paper); color: var(--ink); }
  .d-dot { position: static; margin-left: auto; }
  .d-ni { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 8px 12px; border-radius: 10px; font-size: 16px; }
  .d-nl { text-align: left; }
  .d-ni:hover { background: var(--paper); }
  .d-ni[aria-current="page"] { background: var(--spruce-tint); }
  .d-ni[aria-current="page"]::before { display: none; }
  .d-badge { position: static; margin-left: auto; }
  .d-main { max-width: 1080px; padding: 0 40px 60px; margin: 0; }
  .d-top { margin: 0 -40px; padding: 14px 40px; }
  .d-top-t { display: none; }
  .d-scope { margin-left: auto; }
}

/* ---------- titoli e testo ---------- */
.d-h1 { margin: 20px 0 12px; font-family: var(--font-anthropic-serif); font-weight: 700; font-size: 32px; line-height: 1.05; letter-spacing: -.005em; color: var(--ink); }
.d-h2 { margin: 28px 0 10px; font-family: var(--font-anthropic-serif); font-weight: 600; font-size: 24px; line-height: 1.15; }
.d-h2-first { margin-top: 20px; font-size: 32px; font-weight: 700; line-height: 1.05; }
.d-h3 { margin: 28px 0 8px; font-size: 18px; font-weight: 600; line-height: 1.25; }
.d-lead { margin: 0 0 16px; font-size: 17px; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.d-take { margin: 0 0 16px; font-size: 18px; line-height: 1.5; max-width: 62ch; }
.d-take b { font-weight: 600; font-variant-numeric: tabular-nums; }
.d-note { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; max-width: 66ch; }
.d-note b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.d-back { display: inline-flex; align-items: center; min-height: 44px; margin: 8px 0 0 -8px; padding: 0 10px; border: 0; background: none; font: inherit; font-size: 16px; font-weight: 600; color: var(--spruce); cursor: pointer; }

/* ---------- segmenti dentro una pagina ---------- */
.d-seg { display: flex; gap: 6px; margin: 0 -16px 18px; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 16px; }
.d-seg::-webkit-scrollbar { display: none; }
.d-segb { flex: 0 0 auto; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 15.5px; font-weight: 500; cursor: pointer; white-space: nowrap; scroll-snap-align: start; }
.d-segb[aria-selected="true"] { background: var(--spruce); border-color: var(--spruce); color: #fff; font-weight: 600; }
@media (min-width: 960px) { .d-seg { margin: 0 0 18px; padding: 2px 0 6px; scroll-padding: 0; } }

/* ---------- comandi ---------- */
.d-controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.d-ctl { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); min-width: 0; flex: 1 1 200px; }
.d-ctl .dash-select { width: 100%; }
.d-controls-inline .d-ctl { flex: 0 1 auto; }

/* ---------- numeri in evidenza ---------- */
.d-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.d-tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.d-k { font-size: 14px; font-weight: 500; color: var(--ink-2); line-height: 1.25; }
.d-v { font-family: var(--font-anthropic-serif); font-weight: 600; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.d-s { font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.d-s b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.d-neg { color: var(--bad); }
.d-pos { color: var(--ok); }
.d-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 11px; line-height: 17px; font-weight: 500; color: var(--ink-2); vertical-align: 2px; background: var(--card); }
@media (min-width: 640px) { .d-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- rendimento: l'unico elemento scuro, così si riconosce subito ---------- */
.d-hero { margin: 0 0 18px; padding: 20px 18px 18px; border-radius: 18px; background: var(--spruce); color: #fff; }
.d-hero-k { margin: 0; font-size: 15px; font-weight: 500; color: rgba(255, 255, 255, .82); }
.d-hero-n { margin: 2px 0 0; font-family: var(--font-anthropic-serif); font-weight: 700; font-size: 68px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.d-hero-n small { font-size: 34px; font-weight: 600; margin-left: 2px; }
.d-hero-t { margin: 6px 0 14px; font-size: 18px; line-height: 1.35; font-weight: 500; }
.d-gauge { display: block; width: 100%; height: auto; margin: 0 0 12px; overflow: visible; }
.d-gauge text { font-family: var(--font-anthropic-sans); font-size: 12.5px; fill: rgba(255, 255, 255, .8); }
.d-gauge .g-val { fill: #fff; font-weight: 700; font-size: 13px; }
.d-hero-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.d-hero-part { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .12); }
.d-hero-part span { display: block; font-size: 13.5px; color: rgba(255, 255, 255, .82); }
.d-hero-part b { display: block; font-family: var(--font-anthropic-serif); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.d-hero-part i { display: block; font-style: normal; font-size: 13px; color: rgba(255, 255, 255, .8); line-height: 1.3; }
.d-hero-foot { margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: rgba(255, 255, 255, .78); }
.d-hero-foot b { color: #fff; font-weight: 600; }
.d-hero.d-hero-empty { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

/* ---------- cosa noto: osservazioni spiegate ---------- */
.d-ins { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.d-in { position: relative; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.d-in:last-child { border-bottom: 0; }
.d-in::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-2); }
.d-in-good::before { background: var(--ok); }
.d-in-warn::before { background: #d49a1c; }
.d-in-bad::before { background: var(--bad); }
.d-in-info::before { background: var(--spruce-2); }
.d-in-t { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.d-in-b { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink); max-width: 62ch; }
.d-in-b b { font-weight: 600; font-variant-numeric: tabular-nums; }
.d-in-w { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); max-width: 62ch; }
.d-in-go { margin: 8px 0 0; min-height: 44px; display: inline-flex; align-items: center; padding: 0; border: 0; background: none; font: inherit; font-size: 15.5px; font-weight: 600; color: var(--spruce); cursor: pointer; text-align: left; }
.d-in-more { display: block; width: 100%; min-height: 48px; border: 0; border-top: 1px solid var(--line); background: var(--card); font: inherit; font-size: 15px; font-weight: 600; color: var(--spruce); cursor: pointer; }

/* ---------- da fare ---------- */
.d-tasks { list-style: none; margin: 0 0 8px; padding: 0; }
.d-task { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 12px 14px 12px 8px; margin: 0 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.d-task-check { grid-row: 1 / span 3; align-self: start; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; padding: 0; }
.d-task-check span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; background: #fff; color: #fff; font-size: 16px; line-height: 1; font-weight: 700; }
.d-task-check:hover span { border-color: var(--spruce); }
.d-task.done .d-task-check span { background: var(--ok); border-color: var(--ok); }
.d-task.done .d-task-t { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.d-task-t { margin: 8px 0 0; font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.d-task-m { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.d-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; line-height: 20px; font-weight: 600; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.d-chip-bad { background: var(--bad-bg); color: var(--bad); border-color: #efc4bf; }
.d-chip-warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd3a3; }
.d-chip-ok { background: var(--ok-bg); color: var(--ok); border-color: #b9dcc7; }
.d-chip-new { background: var(--spruce-tint); color: var(--spruce); border-color: #bcd6cd; }
.d-task-b { margin: 6px 0 0; font-size: 15px; line-height: 1.5; max-width: 60ch; }
.d-task-b b { font-weight: 600; }
.d-task-n { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.d-task-act { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.d-task-note { width: 100%; min-height: 44px; margin: 4px 0 0; padding: 8px 12px; font: inherit; font-size: 16px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); resize: vertical; }
.d-addtask { display: grid; gap: 8px; margin: 0 0 16px; padding: 14px; background: var(--card); border: 1px dashed var(--line-2); border-radius: 14px; }
.d-addtask input { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; width: 100%; background: #fff; color: var(--ink); }
.d-empty { margin: 8px 0 16px; padding: 18px 16px; border: 1px dashed var(--line-2); border-radius: 14px; background: var(--card); color: var(--ink-2); font-size: 15.5px; }

/* ---------- voci di menu (Altro) ---------- */
.d-rows { display: flex; flex-direction: column; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.d-row { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 64px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.d-row:last-child { border-bottom: 0; }
.d-row:hover { background: var(--paper); }
.d-row-t { font-size: 17px; font-weight: 600; }
.d-row-s { font-size: 14px; color: var(--ink-2); }
.d-rows-acc .d-row { min-height: 60px; }

/* ---------- grafici ---------- */
.d-chart { position: relative; min-height: 200px; min-width: 0; margin: 0 0 6px; }
.d-chart svg { display: block; overflow: visible; }
.d-chart svg text { font-family: var(--font-anthropic-sans); font-size: 13px; fill: var(--ink-2); }
.d-chart svg text.tv { fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-chart svg text.tv, .d-chart svg text.halo { paint-order: stroke; stroke: var(--color-bg); stroke-width: 3px; stroke-linejoin: round; }
.d-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.d-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.d-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--cds-surface-popover); border: 1px solid var(--cds-border); box-shadow: var(--cds-shadow-popover); border-radius: 10px; padding: 8px 10px; font-size: 14px; line-height: 1.4; max-width: 280px; }
.d-tip .d-th { color: var(--ink); font-weight: 600; }
.d-card-chart { margin: 0 0 12px; padding: 12px 12px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }

/* ---------- tabelle ---------- */
.d-tbl-wrap { overflow-x: auto; margin: 8px 0; container-type: inline-size; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.d-tbl-scroll { max-height: 420px; overflow-y: auto; }
.d-tbl { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.d-tbl th, .d-tbl td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.d-tbl tr:last-child td { border-bottom: 0; }
.d-tbl th { color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; background: #fafbf9; }
.d-tbl th:first-child, .d-tbl td:first-child { text-align: left; }
.d-tbl .d-l { text-align: left; }
.d-tbl .d-wrapcell { white-space: normal; min-width: 120px; }
@container (max-width: 560px) {
  .d-stack thead { display: none; }
  .d-stack, .d-stack tbody, .d-stack tr, .d-stack td { display: block; width: auto; min-width: 0; }
  .d-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .d-stack tr:last-child { border-bottom: 0; }
  .d-stack td { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  .d-stack td:first-child { font-weight: 600; font-size: 16.5px; padding-bottom: 4px; }
  .d-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-2); }
}
.d-det { margin: 20px 0 0; font-size: 15px; color: var(--ink-2); line-height: 1.55; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.d-det summary { cursor: pointer; color: var(--ink); font-weight: 600; min-height: 48px; display: flex; align-items: center; }
.d-det[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.d-det p { margin: 8px 0; max-width: 64ch; }
.d-det p:last-child { margin-bottom: 14px; }
.d-foot { margin: 28px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; max-width: 70ch; }
.d-foot-ver { margin: 2px 0 0; padding-top: 0; border-top: 0; }
.d-foot-ver a { display: inline-block; padding: 10px 0; color: var(--spruce); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.d-sticky th:first-child, .d-sticky td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); white-space: nowrap; }
.d-sticky th:first-child { background: #fafbf9; }
.d-tbl:not(.d-stack) td:not(.d-wrapcell):not(:first-child) { white-space: nowrap; }
.d-tbl-scroll thead th { position: sticky; top: 0; z-index: 2; }
.d-tbl-scroll thead th:first-child { z-index: 3; }
.d-tbl-scroll.d-sticky { max-height: 460px; }
.pv-row-tot td { font-weight: 600; border-top: 2px solid var(--ink); }
.pv-rec { font-weight: 600; }
.pv-venduta, .pv-nd, .pv-ch { color: var(--ink-2); }
.pv-nd, .pv-ch { font-style: italic; }
@container (max-width: 560px) {
  .d-tbl:not(.d-stack) th, .d-tbl:not(.d-stack) td { padding-left: 8px; padding-right: 8px; }
  .d-abbr th[data-abbr] { font-size: 0; }
  .d-abbr th[data-abbr]::after { content: attr(data-abbr); font-size: 14px; }
}
.d-csv { display: flex; gap: 8px; justify-content: flex-end; margin: 6px 0 0; flex-wrap: wrap; }
.d-csv button { font: inherit; font-size: 14px; font-weight: 500; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; }
.d-csv button:hover { background: var(--spruce-tint); }

/* ---------- stima a 365 giorni ---------- */
.d-conf { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.d-conf i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.d-conf.alta i { background: var(--ok); }
.d-conf.media i { background: #d49a1c; }
.d-conf.bassa i { background: var(--bad); }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }

/* ---------- pulsanti ---------- */
.btn { font: inherit; font-size: 16px; font-weight: 500; min-height: 46px; padding: 8px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { background: var(--spruce-tint); }
.btn-primary { background: var(--spruce); color: #fff; border-color: var(--spruce); font-weight: 600; }
.btn-primary:hover { background: var(--spruce-2); }
.btn-primary[disabled] { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; }
.btn-link { border: 0; background: none; min-height: 44px; padding: 4px 10px; font-size: 15px; color: var(--spruce); font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-sm { min-height: 40px; padding: 4px 14px; font-size: 14.5px; border-radius: 10px; }
.btn-danger { color: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- pagina Dati ---------- */
.d-ds { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.d-ds li { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.d-ds li:last-child { border-bottom: 0; }
.d-ds-t { font-weight: 600; font-size: 16px; }
.d-ds-m { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.d-drop { display: grid; place-items: center; gap: 6px; padding: 26px 16px; margin: 0 0 12px; text-align: center; border: 2px dashed var(--line-2); border-radius: 16px; background: var(--card); cursor: pointer; }
.d-drop.over { border-color: var(--spruce); background: var(--spruce-tint); }
.d-drop b { font-size: 17px; }
.d-drop span { font-size: 14.5px; color: var(--ink-2); }
.d-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.d-steps { margin: 0 0 8px; padding-left: 22px; display: grid; gap: 6px; font-size: 16px; line-height: 1.5; max-width: 62ch; }
.d-box { margin: 10px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 15.5px; }
.d-box.warn { background: var(--warn-bg); border-color: #ecd3a3; }
.d-box.bad { background: var(--bad-bg); border-color: #efc4bf; }
.d-box.ok { background: var(--ok-bg); border-color: #b9dcc7; }
.d-box h4 { margin: 0 0 6px; font-size: 16.5px; }
.d-box ul { margin: 6px 0 0; padding-left: 20px; }
.d-box li { margin: 3px 0; }

/* ---------- amministrazione ---------- */
.adm-form { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 8px 0 4px; max-width: 520px; }
.adm-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.adm-form input, .adm-form select { font: inherit; font-size: 16px; color: var(--ink); width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
.adm-box { margin: 10px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 15.5px; }
.adm-box b { font-weight: 600; }
.adm-secret { display: inline-block; margin: 4px 0; padding: 6px 10px; border-radius: 8px; background: var(--paper); border: 1px dashed var(--line-2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; user-select: all; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.adm-pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--paper); border: 1px solid var(--line); }
.adm-pill.off { color: var(--bad); border-color: #efc4bf; background: var(--bad-bg); }
.adm-pill.on { color: var(--ok); border-color: #b9dcc7; background: var(--ok-bg); }
.adm-sub { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); word-break: break-all; }
.adm-msg { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-2); }
.adm-msg.err { color: var(--bad); }
.adm-tbl select { min-height: 44px; font-size: 15px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
@media (min-width: 760px) { .adm-form { grid-template-columns: 1fr 1fr 1fr; max-width: 860px; } .adm-form .full { grid-column: 1 / -1; } }

@media print {
  .d-nav, .d-top, .d-seg, .d-csv, .d-back, .d-addtask { display: none !important; }
  body { background: #fff; }
  .d-wrap { display: block; }
  .d-main { max-width: none; padding: 0; }
  .d-page { break-before: page; }
  .d-page:first-of-type { break-before: auto; }
  .d-tbl-scroll { max-height: none; overflow: visible; }
  .d-hero { color: #000; background: #fff; border: 1px solid #000; }
  .d-hero * { color: #000 !important; }
}

/* ---------- rifiniture ---------- */
.d-task > *:not(.d-task-check) { grid-column: 2; }
.pv-row-str td { font-weight: 600; background: #fafbf9; }
.pv-alta { color: var(--ok); font-weight: 600; }
.pv-media { color: var(--warn); font-weight: 600; }
.pv-bassa { color: var(--bad); font-weight: 600; }
.d-hero .d-note { color: rgba(255, 255, 255, .8); }
.d-hero-go { margin: 12px 0 0; min-height: 44px; padding: 0; border: 0; background: none; color: #fff; font: inherit; font-size: 16px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.d-ds select { margin-top: 6px; width: 100%; }
.d-ds-list li { align-items: start; }
.d-controls-inline { margin-bottom: 8px; }
.d-task-more { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; color: var(--ink-2); }
.d-task-more li { margin: 2px 0; }
.d-sum-strong { font-weight: 600; }
.d-gauge .g-big { font-family: var(--font-anthropic-serif); font-size: 58px; font-weight: 700; fill: #fff; letter-spacing: -.01em; }
.d-h1, .d-h2, .d-h3 { scroll-margin-top: 72px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.d-drop:focus-within { outline: 2px solid var(--spruce-2); outline-offset: 2px; }
.d-note-first { margin: 0 0 10px; }
.d-who { margin: -4px 0 14px; }
.d-ds-list .btn { margin-top: 8px; justify-self: start; }
.d-box ul ul { margin-top: 4px; color: var(--warn); }
.d-in-b b, .d-in-t b, .d-task-b b, .d-hero b, .d-note b, .d-take b, .d-s b { white-space: nowrap; }
@media (max-width: 959px) {
  .d-h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .d-ni { justify-content: flex-start; padding-top: 9px; }
  .d-page > .d-seg:first-child, .d-page > .d-h1 + .d-seg { margin-top: 12px; }
  .d-h2-first { margin-top: 18px; }
}
@media (max-width: 959px) { .d-main > .d-page { padding-top: 14px; } }
@container (max-width: 560px) { #tbl-stima-mesi th:nth-child(5), #tbl-stima-mesi td:nth-child(5) { display: none; } }
.d-task-d { margin: 4px 0 0; }
.d-task-d > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 6px; color: var(--spruce); font-weight: 600; font-size: 15px; list-style: none; }
.d-task-d > summary::-webkit-details-marker { display: none; }
.d-task-d > summary::after { content: "›"; font-size: 20px; line-height: 1; transition: transform .15s; }
.d-task-d[open] > summary::after { transform: rotate(90deg); }
.d-task-d > .d-task-n:first-of-type { margin-top: 2px; }

/* schermo largo: il quadrante resta di dimensioni ragionevoli e centrato */
@media (min-width: 700px) {
  .d-gauge { max-width: 400px; margin: 0 auto 12px; }
  .d-hero-t { text-align: center; }
}

/* ---------- Fatture: schede, elenco delle righe e finestra di classificazione ---------- */
.d-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .d-tiles.d-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.d-tiles-4 .d-v { font-size: 26px; }
.d-inp { font: inherit; font-size: 16px; min-height: 44px; width: 100%; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: inherit; min-width: 0; }
.d-inp:focus-visible { outline: 2px solid var(--spruce-2); outline-offset: 1px; }
.d-hint { font-size: 13.5px; font-weight: 400; color: var(--ink-2); line-height: 1.4; }
.d-ctl-wide { flex-basis: 100%; }
.d-ctl .d-hint { margin-top: -2px; }
.d-check, .d-radio { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; font-size: 15.5px; line-height: 1.35; cursor: pointer; }
.d-check input, .d-radio input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: var(--spruce); }
.d-check { margin: 4px 0 0; }

.d-fat-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.d-fat-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; min-width: 0; }
.d-fat-card .btn-row { margin-top: 2px; }
.d-fat-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.d-fat-h b { font-size: 16.5px; overflow-wrap: anywhere; margin-right: 2px; }
.d-fat-cond { margin: 0; font-size: 15.5px; overflow-wrap: anywhere; }
.d-fat-sub { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.d-fat-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.d-fat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-fat-sug { font: inherit; font-size: 14.5px; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid #bcd6cd; background: var(--spruce-tint); color: var(--spruce); cursor: pointer; text-align: left; line-height: 1.25; }
.d-fat-sug b { font-weight: 600; }
.d-fat-sug:hover { background: #d4e6df; }

.d-fat-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 8px; }
.d-fat-bar .d-note { margin: 0; }
.d-fat-lines { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.d-fat-lines li { border-bottom: 1px solid var(--line); }
.d-fat-lines li:last-child { border-bottom: 0; }
.d-fat-line { display: grid; gap: 4px; width: 100%; min-height: 64px; padding: 12px 16px; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.d-fat-line:hover { background: var(--spruce-tint); }
.d-fat-line:focus-visible { outline-offset: -3px; }
.d-fat-l1 { display: flex; align-items: baseline; gap: 4px 10px; min-width: 0; }
.d-fat-d { flex: 0 0 auto; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.d-fat-f { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-fat-v { flex: 0 0 auto; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.d-fat-l2 { font-size: 14.5px; line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

.d-fat-docs { margin: 4px 0 12px; padding-left: 18px; font-size: 14px; max-height: 260px; overflow: auto; }
.d-fat-docs li { margin: 3px 0; }

dialog.d-dlg { border: 0; padding: 0 16px max(20px, env(safe-area-inset-bottom)); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow: auto; margin: auto auto 0; border-radius: 18px 18px 0 0; background: var(--card); color: var(--ink); box-shadow: 0 -8px 30px rgba(23, 33, 31, .22); overscroll-behavior: contain; }
dialog.d-dlg::backdrop { background: rgba(23, 33, 31, .5); }
@media (min-width: 700px) { dialog.d-dlg { margin: auto; border-radius: 18px; padding-bottom: 24px; } }
.d-dlg-h { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -16px 8px; padding: 10px 8px 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.d-dlg-h h3 { margin: 0; font-family: var(--font-anthropic-serif); font-size: 21px; line-height: 1.15; color: var(--spruce); overflow-wrap: anywhere; }
.d-dlg-x { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; font: inherit; font-size: 28px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.d-dlg-x:hover { background: var(--paper); }
.d-fat-ctx { margin: 10px 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--paper); display: grid; gap: 6px; }
.d-fat-ctx > p { margin: 0; }
.d-fat-big { font-weight: 600; font-size: 16.5px; line-height: 1.3; overflow-wrap: anywhere; }
.d-fat-scope { margin: 0 0 12px; padding: 4px 14px 8px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.d-fat-scope legend { padding: 0 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.d-fat-words { margin: 4px 0 6px; display: grid; gap: 4px; }
.d-fat-form { display: grid; gap: 12px; margin: 0 0 12px; }
.d-fat-form .d-ctl { flex: none; }
.d-fat-form .d-ctl .dash-select { width: 100%; max-width: 100%; }
.d-fat-adv { margin: 0; display: block; }
.d-fat-adv .d-ctl { margin: 0 0 12px; }
.d-fat-adv > summary + .d-ctl { margin-top: 4px; }
.d-fat-mesi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.d-fat-mesi .d-ctl:last-child { grid-column: 1 / -1; }
.d-fat-more { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.d-dlg .adm-msg { margin: 0 0 10px; }
.d-dlg .btn-row { margin-top: 4px; }
@media (min-width: 640px) { .d-fat-line { grid-template-columns: minmax(0, 1fr); } }

.d-fat-filtri .d-ctl { flex: 1 1 150px; }
.d-fat-filtri .d-ctl-wide { flex-basis: 100%; }

/* ---------- Previsionale › Modifica piano (solo amministratori) ---------- */
.pn-sel { display: grid; gap: 6px; margin: 4px 0 8px; }
.pn-l { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.pn-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pn-pill { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 15.5px; cursor: pointer; }
.pn-pill:hover { background: var(--spruce-tint); }
.pn-pill[aria-pressed="true"] { background: var(--spruce); border-color: var(--spruce); color: #fff; font-weight: 600; }
.pn-pills-gg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pn-pill-gg { min-width: 0; padding: 8px 0; font-size: 14.5px; text-align: center; }
.pn-presets { display: flex; flex-wrap: wrap; gap: 0 4px; margin-top: 2px; }
.pn-preset { min-height: 40px; padding: 2px 8px; font-size: 14.5px; }
.pn-sec { padding: 0 16px; }
.pn-sec[open] { padding-bottom: 16px; }
.pn-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; }
.pn-full, .pn-prev, .pn-form > .adm-msg { grid-column: 1 / -1; }
.pn-form > .adm-msg { margin: 0; }
.pn-form > .adm-msg:empty { display: none; }
.pn-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pn-2 { display: flex; gap: 8px; }
.pn-2 .dash-select { flex: 1 1 0; min-width: 0; width: auto; }
.pn-2 .d-inp { flex: 0 1 38%; min-width: 0; text-align: right; }
.pn-prev { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--spruce-tint); font-size: 14.5px; line-height: 1.45; }
.pn-prev-no { background: var(--paper); color: var(--ink-2); }
.pn-vedi { min-height: 40px; padding: 0 6px; font-size: 14.5px; }
.pn-ctl { margin: 0 0 8px; max-width: 320px; }
.pn-num { text-align: right; padding: 8px 10px; }
.pn-day, .pn-mese, .pn-cr { display: grid; align-items: center; gap: 4px 10px; padding: 8px 0 8px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.pn-day:last-child, .pn-mese:last-child, .pn-cr:last-child { border-bottom: 0; }
.pn-day.pn-ch, .pn-mese.pn-ch, .pn-cr.pn-ch { border-left-color: var(--amber); background: #fffaf0; }
.pn-day { grid-template-columns: 74px minmax(0, 1fr) minmax(0, 1fr); }
.pn-day.pn-pa { color: var(--ink-2); }
.pn-day.pn-we .pn-dd b { color: var(--spruce); }
.pn-dd { display: flex; flex-direction: column; font-size: 15.5px; line-height: 1.2; }
.pn-tag { min-height: 15px; font-size: 12.5px; line-height: 1.2; color: var(--ink-2); }
.pn-tag-ch { color: var(--warn); font-weight: 600; }
.pn-tag-no { color: var(--bad); font-weight: 600; }
.pn-cam { grid-column: 2 / -1; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }
.pn-head { min-height: 0; padding-top: 0; padding-bottom: 4px; border-bottom: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: right; }
.pn-head span:first-child { text-align: left; }
.pn-mese { grid-template-columns: minmax(84px, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.pn-md { display: flex; flex-direction: column; font-size: 15.5px; line-height: 1.2; }
.pn-cal { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-size: 13.5px; color: var(--ink-2); }
.pn-usa { min-height: 40px; padding: 0 6px; font-size: 14px; }
.pn-tot { font-weight: 500; }
.pn-cr { grid-template-columns: minmax(90px, 1fr) auto; }
.pn-pc { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.pn-pc .d-inp { width: 92px; }
.pn-es { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-2); }
.pn-bar { position: sticky; bottom: calc(69px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 18px 0 0; padding: 10px 12px; border: 1.5px solid var(--spruce); border-radius: 14px; background: var(--card); box-shadow: 0 6px 18px rgba(23, 33, 31, .18); }
.pn-bar-t { flex: 1 1 200px; font-size: 14.5px; line-height: 1.35; }
.pn-bar-b { display: flex; gap: 8px; }
.pn-bar .btn { min-height: 44px; padding: 6px 14px; font-size: 15px; }
@media (min-width: 960px) { .pn-bar { bottom: 16px; } }
.d-segb.pn-dirty::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.pn-blocco h4 { margin: 14px 0 4px; font-size: 16.5px; }
.pn-blocco ul { margin: 0; padding-left: 20px; }
.pn-blocco li { margin: 3px 0; }
.pn-lista { margin: 0; padding: 0; list-style: none; }
.pn-lista li { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.4; }
.pn-lista li:last-child { border-bottom: 0; }
.pn-dlg .d-box { margin: 12px 0; }
.pn-dlg-b { margin-top: 10px; }
/* controlli che compaiono solo quando servono (per esempio il selettore dell'anno, se il piano ha più anni) */
.d-controls.pn-off { display: none; }
