/* noro-planning — fogli di stile dell'app.
   Base: assets/app.css della skill tasteskill (valori misurati su schermi di
   prodotto veri), con i token dello stile "Achromatic ledger" dealato per
   questo progetto e un fondo grigio-blu da carta a quadretti al posto del
   #f8f8f8 di serie: e' la faccia di quest'app.

   La regola dello stile: nella cornice non c'e' colore. L'azione principale
   e' quasi nera, i numeri sono in inchiostro, e la sola tinta (#1d5fbf) sta
   sul dato di oggi. */

/* ---------- token ---------- */
:root {
  --ground: #f1f3f6;          /* la faccia: carta a quadretti, 2% di saturazione */
  --surface: #ffffff;
  --raised: #eeeeee;
  --active: #e9eaec;          /* la pastiglia grigia della voce attiva */
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --faint: #6b6b6b;
  --accent: #141414;          /* in questo stile l'accento e' inchiostro */
  --primary: #141414;
  --primary-ink: #ffffff;
  --positive: #2e7d32;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eeeeee; --pill-neutral-ink: #3d3d3d;

  --chart-1: #141414;         /* la serie in inchiostro */
  --chart-2: #8a8a8a;         /* il confronto, in grigio */
  --chart-3: #1d5fbf;         /* l'unica tinta: il dato di oggi */
  --chart-muted: #c9ccd1;
  --chart-mark: var(--text);
  --chart-span: 0.06;
  --chart-track: #d7dade;
  --grid: #e3e5e9;
  --axis-ink: var(--muted);
  --ink: var(--text);

  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; /* taste-skill-ignore: solo id, sigle dei materiali e riquadri di JSON */
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 30px; --fs-body: 14px; --fs-small: 12px;

  --sidebar-width: 256px;
  --pad: 24px;
  --gap: 12px;
  --card-pad: 20px;
  --radius-card: 8px;
  --radius-control: 6px;
  --control-height: 36px;
  --row-height: 44px;
  --nav-row: 32px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Studiare la sera e' la norma, quindi il tema scuro c'e': grigi veri, niente
   blu notte, la quota di colore resta sotto il 3% e la tinta resta sul dato. */
:root[data-theme="dark"] {
  --ground: #000000;
  --surface: #111111;
  --raised: #1d1d1d;
  --active: #222222;
  --border: #1f1f1f;
  --rule: #191919;
  --control: #444444;
  --text: #ffffff;
  --muted: #b4b4b4;
  --faint: #949494;
  --accent: #ffffff;
  --primary: #ffffff;
  --primary-ink: #000000;
  --positive: #3fc07a;
  --negative: #e5566f;
  --warning: #e5a93b;
  --pill-positive-bg: #172a1d; --pill-positive-ink: #3fc07a;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2b2414; --pill-warning-ink: #e5a93b;
  --pill-neutral-bg: #222222; --pill-neutral-ink: #ffffff;
  --chart-1: #ffffff;
  --chart-2: #8a8a8a;
  --chart-3: #6ea8ff;
  --chart-muted: #4a4a4a;
  --chart-track: #3a3a3a;
  --grid: #2b2b2b;
  --chart-span: 0.12;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- guscio: barra laterale sul fondo della pagina, nessuna barra in alto ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; }
.sidebar {
  position: sticky; top: 0; height: 100svh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; }
.brand svg { width: 18px; height: 18px; flex: none; }
.brand b { font-weight: 500; letter-spacing: -0.01em; }
.brand span { color: var(--muted); }

/* il cambio di corso: l'ambito in cui si sta lavorando, in cima */
.scope { margin: 10px 0 4px; }
.scope select {
  width: 100%; height: 34px; padding: 0 28px 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-control);
  background: var(--raised) var(--chevron) right 8px center / 12px no-repeat;
  appearance: none; cursor: pointer; font-weight: 500;
}
.scope select:hover { border-color: var(--control); }
.scope .scope-note { margin: 6px 8px 0; font-size: var(--fs-small); color: var(--muted); }

.sidebar .group-label { margin: 22px 8px 6px; font-size: var(--fs-small); color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: var(--nav-row); padding: 0 8px; border-radius: 8px; color: var(--muted);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.nav-item svg { width: 16px; height: 16px; flex: none; stroke-width: 1.5; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.nav-item .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.nav-item[aria-current="page"] .count { color: var(--text); }
.sidebar .bottom { margin-top: auto; padding-top: 16px; }
.sidebar .bottom .btn { width: 100%; justify-content: flex-start; margin-bottom: 8px; }
.sync { padding: 8px; font-size: var(--fs-small); color: var(--muted); }
.sync[data-state="offline"] { color: var(--warning); }
.sync[data-state="guest"] { color: var(--text); font-weight: 500; }

.canvas { min-width: 0; padding: var(--pad) var(--pad) 64px; }
.canvas > * { max-width: 1180px; }

/* ---------- riga del titolo ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 6px; color: var(--muted); max-width: 68ch; }
.title-row .side { display: flex; align-items: center; gap: 8px; flex: none; }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.stamp { color: var(--muted); font-size: var(--fs-small); }

/* ---------- pannelli e griglia ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.grid + .grid { margin-top: var(--gap); }
.grid.top { align-items: start; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0;
}
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { font-size: var(--fs-section); line-height: 1.3; font-weight: 600; }
.panel h3 { font-size: var(--fs-body); line-height: 20px; font-weight: 500; }
.panel .meta { color: var(--muted); font-size: var(--fs-small); }
.panel.fill { display: flex; flex-direction: column; }
.panel.fill .foot { margin-top: auto; padding-top: 14px; }

.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.chart { position: relative; min-width: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: var(--fs-small); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.card-link {
  display: inline-flex; align-items: center; gap: 2px; padding: 0;
  border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; text-underline-offset: 3px;
}
.card-link::after {
  content: ""; width: 12px; height: 12px; flex: none; background: currentColor;
  -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat;
}
.card-link:hover { text-decoration: underline; }

/* ---------- righe ---------- */
/* Una griglia a colonna sola "auto" si allarga fino al max-content del figlio
   piu' lungo: un titolo senza a capo spinge il pulsante fuori dal pannello.
   minmax(0,1fr) tiene la colonna dentro il contenitore. */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; min-height: var(--row-height); padding: 10px 0; }
.row + .row { border-top: 1px solid var(--rule); border-radius: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { font-size: var(--fs-small); color: var(--muted); }
.row .n { font-variant-numeric: tabular-nums; text-align: right; flex: none; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- la striscia dei numeri: un contenitore diviso, nessuna piastrella ---------- */
.kpis {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
}
.kpi { padding: 14px var(--card-pad); }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 4px; font-size: 24px; line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
.kpi-value small { font-size: 0.58em; color: var(--muted); font-weight: 400; margin-left: 3px; }
.kpi .note { margin-top: 3px; font-size: var(--fs-small); color: var(--muted); }

/* ---------- il blocco "adesso": il piu' grande dello schermo ---------- */
.now { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.now .unit { color: var(--muted); }
.now .what { margin-top: 8px; font-size: 20px; line-height: 27px; font-weight: 500; letter-spacing: -0.01em; }
.now .minimal { margin-top: 14px; max-width: 56ch; }
.now .minimal b { font-weight: 500; }
.now .where { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.now .method { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--muted); max-width: 62ch; }
.now .clock { text-align: right; }
.now .clock .big { font-size: var(--fs-kpi); line-height: 1.1; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.now .clock .big small { font-size: 0.45em; color: var(--muted); font-weight: 400; margin-left: 3px; }
.now .clock .btn { margin-top: 14px; }
.ref { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; }
.ref:hover { text-decoration-color: currentColor; }

/* ---------- la riga dello scarto: l'elemento che ha solo quest'app ---------- */
.scarto { position: relative; min-width: 0; }

/* ---------- tabelle ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 36px; padding: 0 12px; text-align: left; font-weight: 400;
  font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: calc((var(--row-height) - 20px) / 2) 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[aria-selected="true"] td { background: var(--active); }
th.n, td.n { text-align: right; }
td .sub { display: block; font-size: var(--fs-small); color: var(--muted); }
.onphone { display: none; }
.truncate { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash { color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: var(--fs-small); font-weight: 500;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
  white-space: nowrap; flex: none;
}
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ---------- comandi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-height); padding: 0 14px;
  border-radius: var(--radius-control); border: 1px solid var(--control);
  background: var(--surface); font-weight: 500; cursor: pointer;
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #262626; }
:root[data-theme="dark"] .btn.primary:hover { background: #e4e4e4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--raised); }
.btn.small { height: 30px; padding: 0 10px; font-size: var(--fs-small); }
.btn.danger { color: var(--negative); border-color: var(--control); }
/* un comando spento resta leggibile e con il suo bordo: su un pannello
   grigio, senza bordo, spariva e sembrava un'etichetta */
.btn[disabled] { opacity: 1; color: var(--muted); background: var(--surface); border-color: var(--control); cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; stroke-width: 1.5; flex: none; }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.field label { font-weight: 500; }
.field .hint { color: var(--muted); font-size: 13px; }
.input, select.input {
  height: 40px; padding: 0 12px; border: 1px solid var(--control);
  border-radius: var(--radius-control); background: var(--surface); width: 100%;
}
textarea.input { height: auto; min-height: 180px; padding: 12px; line-height: 20px; resize: vertical; }
.input::placeholder { color: var(--muted); }
.input:focus-visible { outline-offset: 0; }

.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); }
.tabs button { position: relative; padding: 10px 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 2px; border-radius: 8px; background: var(--raised); }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; }

.switch {
  appearance: none; width: 32px; height: 20px; border-radius: 999px;
  background: var(--control); position: relative; cursor: pointer; flex: none;
  transition: background-color var(--t-ui) ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform var(--t-ui) var(--ease-out);
}
.switch:checked { background: var(--positive); }
.switch:checked::after { transform: translateX(12px); }

.empty {
  display: grid; place-items: center; min-height: 72px; padding: 16px;
  border: 1px dashed var(--control); border-radius: var(--radius-control);
  color: var(--muted); text-align: center;
}
.rows .empty, .grid > .empty, li > .empty { grid-column: 1 / -1; width: 100%; }
.skeleton { background: var(--raised); border-radius: 4px; }
.failed { color: var(--muted); }
.failed b { color: var(--text); font-weight: 500; }

/* ---------- impostazioni: due colonne ---------- */
.set-section { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 700px); gap: 32px; padding: 32px 0; }
.set-section + .set-section { border-top: 1px solid var(--border); }
.set-section:first-of-type { padding-top: 0; }
.set-head h2 { font-size: var(--fs-section); font-weight: 500; }
.set-head p { margin-top: 6px; color: var(--muted); }
.set-head .summary { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: var(--fs-small); color: var(--muted); }
.set-panel { background: var(--raised); border-radius: 16px; padding: 16px; }
:root[data-theme="dark"] .set-panel { background: var(--surface); }
.set-panel .field + .field { margin-top: 16px; }
/* dentro una coppia affiancata i due campi partono dalla stessa riga */
.set-panel .two .field + .field { margin-top: 0; }
.set-panel .actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; }
.set-panel .actions.apart { justify-content: space-between; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row .grow { flex: 1; }
.switch-row .t { font-weight: 500; }
.switch-row p { margin-top: 4px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* una striscia nuda di fatti, divisa da filetti verticali: niente
   piastrelle, niente icone (references/app-screens.md §9.4) */
.facts { display: flex; flex-wrap: wrap; row-gap: 14px; margin: 16px 0 20px; }
.facts > div { padding-right: 28px; margin-right: 28px; border-right: 1px solid var(--rule); min-width: 0; }
.facts > div:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.facts .k { color: var(--muted); font-size: var(--fs-small); }
.facts .v { margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- la mappa dei concetti ---------- */
.map { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.map svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.map svg:active { cursor: grabbing; }
.map .map-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.map .node { cursor: pointer; }
.map .node text { pointer-events: none; }
/* il pannello del concetto si allunga quanto la tela e scorre dentro di se': due
   colonne che finiscono allo stesso punto si leggono come un blocco solo */
.map-detail { min-height: 0; overflow: auto; }
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: var(--fs-small); color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- la sessione: copre tutto, resta solo questo ---------- */
.session {
  position: fixed; inset: 0; z-index: 40; background: var(--ground);
  display: grid; overflow: auto; padding: 24px;
}
/* le tre fasce stanno dentro il figlio, non dentro .session: la griglia va
   data a lui, altrimenti il contenuto si accumula in cima */
.session > div { display: grid; grid-template-rows: auto 1fr auto; gap: 24px; min-height: 100%; }
.session .top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.session .mid { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: start; gap: 18px; max-width: 42rem; margin: 0 auto; width: 100%; }
.session h1 { font-size: 26px; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; }
.session .timer { font-size: 40px; line-height: 1; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.session .timer[data-over="true"] { color: var(--muted); }
.session .minimal { max-width: 52ch; }
.session .method { color: var(--muted); max-width: 56ch; }
.session .bottom { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.session .park { display: flex; gap: 8px; width: 100%; max-width: 42rem; }
.session .park .input { height: 36px; }
.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale button {
  width: 38px; height: 38px; border: 1px solid var(--control); background: var(--surface);
  border-radius: var(--radius-control); cursor: pointer; font-variant-numeric: tabular-nums;
}
.scale button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.scale-ends { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--muted); max-width: 334px; }

/* ---------- il foglio: parcheggio, dettagli, conferme ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.32); display: grid; place-items: end center; }
.sheet {
  width: min(560px, 100%); background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 20px; box-shadow: 0 -8px 28px rgb(0 0 0 / 0.08); /* taste-skill-ignore: il foglio galleggia davvero */
}
@media (min-width: 861px) {
  .sheet-back { place-items: center; }
  .sheet { border-radius: var(--radius-card); }
}
.sheet h2 { font-size: var(--fs-section); font-weight: 600; margin-bottom: 12px; }
.sheet .actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 60; max-width: min(520px, calc(100% - 32px));
  background: var(--primary); color: var(--primary-ink);
  padding: 10px 14px; border-radius: var(--radius-control);
}

/* ---------- import: la differenza prima di scrivere ---------- */
.diff { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.diff .row { min-height: 36px; padding: 6px 0; }
.diff code { font-family: var(--mono); font-size: var(--fs-small); color: var(--muted); }
.drop { border: 1px dashed var(--control); border-radius: var(--radius-control); padding: 16px; text-align: center; color: var(--muted); }
.drop[data-over="true"] { border-color: var(--text); color: var(--text); }
pre.code {
  font-family: var(--mono); font-size: 13px; line-height: 19px;
  background: var(--raised); border-radius: var(--radius-control); padding: 12px;
  overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-word;
}

/* ---------- il resoconto: un foglio, non una schermata ----------
   .paper e' un documento, quindi e' chiaro sempre: i token qui sotto sono
   quelli di :root e vanno tenuti uguali a quelli. Non e' un vezzo. charts.js
   legge i token nel momento in cui disegna (web/charts.js, css()), e i custom
   properties si ereditano: senza questa dichiarazione un grafico disegnato a
   tema scuro, stampato, esce nero pieno. */
.paper {
  --surface: #ffffff;
  --raised: #f4f5f7;
  --border: #e6e6e6;
  --rule: #ececee;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #5e6166;
  --active: #f1f3f6;
  --chart-1: #141414;
  --chart-2: #8a8a8a;
  --chart-3: #1d5fbf;
  --chart-muted: #c9ccd1;
  --chart-mark: #141414;
  --chart-span: 0.06;
  --chart-track: #d7dade;
  --grid: #e3e5e9;
  --pill-neutral-bg: #eeeeee; --pill-neutral-ink: #3d3d3d;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;

  margin-top: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 40px;
  max-width: 820px;
}
.paper-head { padding-bottom: 20px; border-bottom: 1px solid var(--text); }
.paper-kicker { font-size: var(--fs-small); color: var(--muted); }
.paper h1 { margin-top: 6px; font-size: var(--fs-title); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.paper-goal { margin-top: 6px; color: var(--muted); max-width: 72ch; }
.paper-head .facts { margin: 18px 0 0; }
.paper-block { padding-top: 28px; }
.paper-block h2 { font-size: var(--fs-section); font-weight: 600; margin-bottom: 14px; }
.paper-block .kpis { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.paper-block .kpi:first-child { padding-left: 0; }
.paper-lead { max-width: 76ch; }
.paper-lead + .paper-lead { margin-top: 8px; }
.paper-note { color: var(--muted); max-width: 76ch; }
.paper-foot { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--muted); }

/* Si vede solo su carta: a schermo e' rumore, stampato e' il piede del
   documento. Il contrario di .no-print, che non si stampa. */
.print-only { display: none; }

/* ---------- barra in alto: solo sul telefono ---------- */
.topbar { display: none; }

/* la tabella degli step diventa un elenco: identita' e azione sulla prima
   riga, tipo, minuti e stato in grigio sulla seconda */
@media (max-width: 640px) {
  .steps thead { display: none; }
  .steps, .steps tbody, .steps tr, .steps td { display: block; }
  .steps tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 10px 0; }
  .steps tr + tr { border-top: 1px solid var(--rule); }
  .steps td { border: 0; padding: 0; }
  .steps td.meta { display: none; }
  .steps .onphone { display: block; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    display: flex; align-items: center; gap: 8px; height: 48px;
    padding: 0 16px; position: sticky; top: 0; z-index: 10;
    background: var(--ground); border-bottom: 1px solid var(--border);
  }
  .topbar .name { flex: 1; font-weight: 500; }
  .topbar .icon-btn { width: 36px; height: 36px; padding: 0; }
  .sidebar {
    position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30;
    background: var(--surface); transform: translateX(-100%);
    transition: transform var(--t-ui) var(--ease-out);
  }
  .sidebar.open { transform: none; }
  .canvas { padding: 16px 16px 48px; }
  .canvas > * { max-width: none; }
  .grid > * { grid-column: 1 / -1 !important; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .title-row { flex-wrap: wrap; align-items: flex-start; }
  /* su uno schermo stretto il filtro scende sotto il titolo della card
     invece di strozzarsi accanto */
  .panel > header { flex-wrap: wrap; }
  .panel > header .segmented { width: 100%; }
  .now { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .now .clock { text-align: left; display: flex; align-items: center; gap: 16px; }
  .now .clock .btn { margin-top: 0; }
  .set-section { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 24px 0; }
  .two { grid-template-columns: 1fr; }
  .session { padding: 16px; }
  .session .mid { justify-items: stretch; }
}
@media (max-width: 480px) {
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1; }
  .scale button { width: 32px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
/* ---------- la stampa, cioe' il PDF ----------
   Il bottone del Resoconto chiama window.print(): il PDF lo fa il browser,
   con "Salva come PDF". Qui si toglie tutto quello che e' comando e si
   impagina quello che resta. */
@page { size: A4; margin: 14mm; }
@media print {
  .sidebar, .topbar, .title-row .side, .btn, .no-print, .toast, .sheet-back { display: none !important; }
  .print-only { display: block; }
  .app { display: block; min-height: 0; }
  .canvas { padding: 0; }
  .canvas > * { max-width: none; }
  body { background: #fff; }
  .panel { border-color: #ccc; }

  /* il foglio non e' piu' una scheda su uno sfondo: e' la pagina */
  .paper { margin: 0; padding: 0; border: 0; border-radius: 0; max-width: none; }
  .paper-block { break-inside: avoid; padding-top: 22px; }
  .paper-block h2 { break-after: avoid; }
  .paper-block tr, .paper-block .row { break-inside: avoid; }
  .paper-block thead { display: table-header-group; }
  .paper-foot { position: static; }

  /* senza questo il browser "risparmia inchiostro": le barre dei grafici e
     la tinta sull'ultimo punto dello scarto sparirebbero */
  .chart, .scarto, .kpis, .facts, .pill, table { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
