/* Layout: barra laterale scura fissa + area di lavoro su fondo sabbia; progetti come tessere colorate, dati su pannelli chiari */
:root {
  --bg: #ECE7DF; --surface: #FBF9F6; --surface-2: #F4F0EA; --ink: #17161C; --ink-2: #4F4C58; --muted: #85818E; --line: #DDD6CB;
  --side: #17161C; --side-ink: #EDEAF2; --side-muted: #8E8A99; --side-hi: #26252D;
  --accent: #EE6436; --accent-ink: #FFFFFF; --accent-soft: #FBDCCD;
  --tile-ink: #17161C;
  --t1: #BFD3F4; --t2: #FFD2B8; --t3: #BDEBD7; --t4: #F7E2A0; --t5: #F5CCDF;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s-neutral: #9A96A3;
  --good: #1E8A4C; --good-bg: #D9F0E1; --warn: #A86A00; --warn-bg: #FBEBC7; --crit: #C8352F; --crit-bg: #F9DAD7;
  --grid: #E6E0D6; --focus: #2a78d6;
  --f-display: "Bricolage Grotesque", "Arial Rounded MT Bold", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-tile: 24px; --r-panel: 20px; --r-ctl: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0D11; --surface: #19181E; --surface-2: #211F27; --ink: #F1EFF5; --ink-2: #BDB9C7; --muted: #8B8795; --line: #2E2C36;
    --side: #08080A; --side-ink: #EDEAF2; --side-muted: #807C8B; --side-hi: #1D1C22;
    --accent: #FF7A4D; --accent-ink: #17161C; --accent-soft: #3A2319;
    --t1: #86AEF2; --t2: #FF9E73; --t3: #63D3A8; --t4: #F2C94C; --t5: #EE93BD;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s-neutral: #6E6A78;
    --good: #5BD08A; --good-bg: #16301F; --warn: #F2B84B; --warn-bg: #33270F; --crit: #FF7B72; --crit-bg: #3A1716;
    --grid: #26242D; --focus: #86AEF2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0D11; --surface: #19181E; --surface-2: #211F27; --ink: #F1EFF5; --ink-2: #BDB9C7; --muted: #8B8795; --line: #2E2C36;
  --side: #08080A; --side-ink: #EDEAF2; --side-muted: #807C8B; --side-hi: #1D1C22;
  --accent: #FF7A4D; --accent-ink: #17161C; --accent-soft: #3A2319;
  --t1: #86AEF2; --t2: #FF9E73; --t3: #63D3A8; --t4: #F2C94C; --t5: #EE93BD;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s-neutral: #6E6A78;
  --good: #5BD08A; --good-bg: #16301F; --warn: #F2B84B; --warn-bg: #33270F; --crit: #FF7B72; --crit-bg: #3A1716;
  --grid: #26242D; --focus: #86AEF2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14.5px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand svg { flex: none; }
.brand b { font-family: var(--f-display); font-weight: 800; font-size: 17px; line-height: 1.05; letter-spacing: -0.01em; }
.brand small { display: block; font-family: var(--f-mono); font-size: 10.5px; color: var(--side-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--side-muted); font-weight: 500; font-size: 15px; }
.nav button:hover { color: var(--side-ink); background: var(--side-hi); }
.nav button[aria-current="page"] { color: var(--side-ink); background: var(--side-hi); font-weight: 650; }
.nav button:focus-visible { outline: 2px solid var(--focus); }
.nav .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .35; flex: none; }
.nav button[aria-current="page"] .dot { background: var(--accent); opacity: 1; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-label { font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted); padding: 0 4px; }
.scen { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--side-hi); border-radius: 12px; padding: 3px; gap: 2px; }
.scen button { all: unset; cursor: pointer; text-align: center; font-size: 12px; padding: 7px 2px; border-radius: 9px; color: var(--side-muted); font-weight: 600; }
.scen button[aria-pressed="true"] { background: var(--side-ink); color: var(--side); }
.scen button:focus-visible { outline: 2px solid var(--focus); }
.saved { font-size: 12px; color: var(--side-muted); padding: 0 4px; }

.main { padding-block: 26px 60px; padding-inline: clamp(16px, 3vw, 40px); min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.topline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pill.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(30px, 4.2vw, 50px); line-height: 1.02; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
h1 em { font-style: normal; color: var(--accent); }
h2 { font-family: var(--f-display); font-weight: 700; font-size: 21px; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h3 { font-family: var(--f-display); font-weight: 650; font-size: 16px; margin: 0; }
.sub { color: var(--ink-2); max-width: 68ch; margin: 6px 0 0; }
.eyebrow { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 10px 17px; border-radius: 999px; font-weight: 650; font-size: 14px; border: 1.5px solid var(--ink); color: var(--ink); background: transparent; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .88; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { border-color: var(--line); }
.btn.danger { border-color: var(--crit); color: var(--crit); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon-btn { all: unset; cursor: pointer; width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--crit); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); }

/* tessere KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { border-radius: var(--r-tile); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.kpi .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi .big { font-family: var(--f-display); font-weight: 700; font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; margin-top: auto; }
.kpi .note { font-size: 12.5px; color: var(--ink-2); }
.kpi.hot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.kpi.hot .lbl, .kpi.hot .note { color: inherit; opacity: .85; }
.kpi.inv { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.kpi.inv .lbl, .kpi.inv .note { color: inherit; opacity: .75; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; width: fit-content; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.neutral { background: var(--surface-2); color: var(--ink-2); }
.chip.onTile { background: rgba(255,255,255,.55); color: var(--tile-ink); }
.kpi.inv .chip { background: var(--bg); }

/* pannelli */
.grid2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.grid2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 18px 20px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel.dashed { border-style: dashed; background: transparent; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-h p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { all: unset; cursor: pointer; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { outline: 2px solid var(--focus); }

/* tessere progetto */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { border-radius: var(--r-tile); padding: 18px 20px 20px; color: var(--tile-ink); display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; min-height: 230px; cursor: pointer; border: 0; text-align: left; }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.tile.c1 { background: var(--t1); } .tile.c2 { background: var(--t2); } .tile.c3 { background: var(--t3); } .tile.c4 { background: var(--t4); } .tile.c5 { background: var(--t5); }
.tile.off { opacity: .55; }
.tile .t-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.tile h3 { font-family: var(--f-display); font-size: 25px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.05; }
.tile .t-sub { font-size: 13px; opacity: .8; margin-top: 3px; }
.tile .t-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: auto; position: relative; z-index: 1; }
.tile .t-nums span { display: block; font-size: 11.5px; font-weight: 600; opacity: .75; }
.tile .t-nums b { font-family: var(--f-display); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .glyph { position: absolute; right: -40px; top: 36px; opacity: .14; pointer-events: none; }
.tile.new { background: transparent; border: 2px dashed var(--line); color: var(--ink-2); align-items: flex-start; justify-content: center; }
.tile.new:hover { border-color: var(--ink-2); }
.tile.new h3 { color: var(--ink); }

/* striscia avvisi */
.ticker { background: var(--ink); color: var(--bg); border-radius: 18px; padding: 14px 18px; display: flex; gap: 14px; align-items: flex-start; }
.ticker .live { background: var(--t4); color: var(--tile-ink); font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 999px; flex: none; margin-top: 1px; }
.ticker ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13.5px; min-width: 0; }
.ticker li { display: flex; gap: 7px; min-width: 0; }
.ticker li::before { content: "✦"; color: var(--t2); flex: none; }
.ticker li.bad::before { color: var(--accent); }

/* tabelle */
.tbl-wrap { overflow-x: auto; margin-inline: -4px; }
table.t { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13.5px; }
table.t th, table.t td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t thead th { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1.5px solid var(--ink); position: sticky; top: 0; background: var(--surface); }
table.t td.l, table.t th.l { text-align: left; }
table.t tr.tot td { font-weight: 700; border-top: 1.5px solid var(--ink); }
table.t tr.sub td { font-weight: 650; background: var(--surface-2); }
table.t tr.muted td { color: var(--muted); font-size: 12.5px; }
table.t td.neg { color: var(--crit); }
table.t .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.t tr.sub .sticky { background: var(--surface-2); }
table.edit td { padding: 4px 4px; }
.bp table.t td:first-child { min-width: 210px; }

/* campi */
.in { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 8px; font-variant-numeric: tabular-nums; text-align: right; }
.in:hover { border-color: var(--muted); }
.in.l, textarea.in, select.in { text-align: left; }
.in.w-s { width: 78px; } .in.w-m { width: 108px; } .in.w-l { width: 190px; } .in.w-xl { width: 260px; }
textarea.in { resize: vertical; min-height: 64px; line-height: 1.4; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.inwrap { display: flex; align-items: center; gap: 6px; }
.inwrap .unit { font-size: 12.5px; color: var(--muted); flex: none; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--ink); }

/* tabs progetto */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); flex-wrap: wrap; }
.tabs button { all: unset; cursor: pointer; padding: 10px 14px; font-weight: 650; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--focus); }
.phead { border-radius: var(--r-tile); padding: 22px 24px; color: var(--tile-ink); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; position: relative; overflow: hidden; }
.phead h1 { color: var(--tile-ink); }
.phead .back { all: unset; cursor: pointer; font-size: 13px; font-weight: 650; opacity: .75; }
.phead .back:focus-visible { outline: 2px solid var(--tile-ink); }
.phead .pn { display: flex; gap: 22px; flex-wrap: wrap; position: relative; z-index: 1; }
.phead .pn span { display: block; font-size: 12px; font-weight: 600; opacity: .75; }
.phead .pn b { font-family: var(--f-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.phead .toggle input { accent-color: var(--tile-ink); }
.phead.c1 { background: var(--t1); } .phead.c2 { background: var(--t2); } .phead.c3 { background: var(--t3); } .phead.c4 { background: var(--t4); } .phead.c5 { background: var(--t5); }

/* grafici */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--f-body); font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--ink-2); stroke-width: 1; }
.chart .xh { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.chart.hover .xh { opacity: 1; }
.chart .lbl-strong { fill: var(--ink); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 3px; border-radius: 2px; vertical-align: 3px; width: 14px; }
.legend i.dash { height: 0; border-top: 2px dashed; background: none !important; vertical-align: 3px; width: 14px; border-radius: 0; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; min-width: 150px; box-shadow: 0 6px 24px rgba(0,0,0,.18); font-variant-numeric: tabular-nums; }
.tip b { display: block; margin-bottom: 4px; font-size: 12px; opacity: .8; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* varie */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--ink); font-size: 13.5px; }
.banner b { color: var(--warn); }
.banner.info { background: var(--surface-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.stat span { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stat b { font-family: var(--f-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat.good b { color: var(--good); } .stat.crit b { color: var(--crit); } .stat.warn b { color: var(--warn); }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.opt { border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.opt.sel { border-color: var(--ink); }
.opt .kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.opt .kv span { color: var(--ink-2); }
.opt .kv b { font-variant-numeric: tabular-nums; }
.opt .best { font-family: var(--f-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.verdict { display: flex; gap: 16px; align-items: center; border-radius: 18px; padding: 16px 18px; }
.verdict.good { background: var(--good-bg); } .verdict.warn { background: var(--warn-bg); } .verdict.crit { background: var(--crit-bg); }
.verdict .light { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: var(--surface); }
.verdict.good .light { background: var(--good); } .verdict.warn .light { background: var(--warn); } .verdict.crit .light { background: var(--crit); }
.verdict h3 { font-size: 19px; }
.verdict p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
ul.reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
ul.reasons li { display: flex; gap: 8px; align-items: baseline; }
ul.reasons li b.ok { color: var(--good); } ul.reasons li b.ko { color: var(--crit); } ul.reasons li b.mid { color: var(--warn); }

.canvas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-areas: "pr so uv va se" "pr me uv ca se" "co co co ri ri"; gap: 8px; }
.cv { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cv label { font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cv textarea { all: unset; font-size: 13px; line-height: 1.4; min-height: 70px; white-space: pre-wrap; word-break: break-word; width: 100%; box-sizing: border-box; field-sizing: content; }
.cv textarea:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
.cv.uv { background: var(--accent-soft); }
.cv.pr { grid-area: pr; } .cv.so { grid-area: so; } .cv.uv { grid-area: uv; } .cv.va { grid-area: va; } .cv.se { grid-area: se; }
.cv.me { grid-area: me; } .cv.ca { grid-area: ca; } .cv.co { grid-area: co; } .cv.ri { grid-area: ri; }

.fcard { border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.fcard .fhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cc { border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); min-width: 0; }
.cc .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cc h3 { font-size: 16px; }
.cc small { color: var(--muted); font-size: 12px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }
.cc .row { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.cc .row span { color: var(--ink-2); }
.cc .row b { font-variant-numeric: tabular-nums; }

dialog.modal { border: 0; border-radius: 24px; padding: 0; width: min(680px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); max-height: calc(100vh - 40px); }
dialog.modal::backdrop { background: rgba(10, 10, 14, .55); }
.modal-in { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.steps { display: flex; gap: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.tpls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tpl { all: unset; cursor: pointer; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tpl b { font-family: var(--f-display); font-size: 16px; }
.tpl span { font-size: 12.5px; color: var(--ink-2); }
.tpl[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.tpl:focus-visible { outline: 2px solid var(--focus); }
.muted { color: var(--muted); }
.neg { color: var(--crit); }
.small { font-size: 12.5px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline-confirm { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
code.k { font-family: var(--f-mono); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
pre.k { font-family: var(--f-mono); font-size: 12px; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 0; }
.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 13.5px; z-index: 60; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid2.even, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .canvas { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "pr se" "so uv" "me va" "ca ca" "co ri"; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: env(safe-area-inset-top, 0px); height: auto; z-index: 20; padding: 12px 16px; gap: 10px; flex-direction: column; }
  .brand small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .nav button { padding: 7px 11px; font-size: 13.5px; white-space: nowrap; }
  .nav .dot { display: none; }
  .side-foot { margin-top: 0; flex-direction: row; align-items: center; gap: 10px; }
  .side-foot .side-label, .saved { display: none; }
  .scen { flex: 1; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi { min-height: 0; }
  .tpls { grid-template-columns: minmax(0, 1fr); }
  .canvas { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pr" "se" "uv" "so" "me" "va" "ca" "co" "ri"; }
  .tile .t-nums b { font-size: 16px; }
}

/* fonte dei valori */
.in.dati { background: var(--good-bg); border-color: var(--good); }
.in.miss { border-color: var(--crit); border-style: dashed; }
.fonte { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); margin-right: 10px; white-space: nowrap; }
.fonte .sw { width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--line); background: var(--surface); display: inline-block; }
.fonte .sw.dati { background: var(--good-bg); border-color: var(--good); }
.todo { border-color: var(--warn); }
ul.todo-l { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ul.todo-l li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); }
ul.todo-l li.crit { background: var(--crit-bg); }
ul.todo-l li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
ul.todo-l li span { font-size: 12.5px; color: var(--ink-2); }

.chart-empty { border: 1.5px dashed var(--line); border-radius: 14px; padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.tile .t-nums b { font-size: clamp(15px, 1.35vw, 19px); white-space: nowrap; }

