/* Youvolution Survey — mockup statico. Palette e marchio presi da Demostene (Training Room) e Academy:
   blu notte, sfondo chiaro, logo Youvolution bianco e nome del prodotto scritto a mano.
   Training Room = corallo #ef5a3f, Academy = azzurro #4cc3f5, Survey = oro #f5b83d. */
:root {
  --bg: #f6f4ef;
  --paper: #ffffff;
  --ink: #141c38;
  --ink-2: #3b4566;
  --ink-3: #6a7290;
  --blue: #4a64a2;
  --blue-soft: #e8ecf6;
  --survey: #f5b83d;
  --survey-ink: #8a5a00;
  --line: rgba(74, 100, 162, 0.22);
  --line-2: rgba(74, 100, 162, 0.12);
  --navy: linear-gradient(170deg, #121a36 0%, #1a2348 60%, #24305e 100%);
  --warn-bg: #fff1dc;
  --warn: #9a4b00;
  --ok: #1f7a4d;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 'Geist', 'Inter', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Archivo Black', 'Geist', sans-serif; font-weight: 400; letter-spacing: 0; margin: 0; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--survey); outline-offset: 2px; }

/* ── Marchio: logo Youvolution + «Survey» a mano ───────────────────────── */
.brand { display: inline-flex; flex-direction: column; align-items: flex-start; text-decoration: none; }
.brand img { width: 210px; height: auto; display: block; }
.brand .sign { font-family: 'Nothing You Could Do', cursive; font-size: 30px; line-height: 1; color: var(--survey);
  margin: 4px 0 0 44px; transform: rotate(-4deg); transform-origin: left center; white-space: nowrap; }
.brand.small img { width: 150px; }
.brand.small .sign { font-size: 23px; margin-left: 32px; }

.label { text-transform: uppercase; font-weight: 600; letter-spacing: 0.1em; font-size: 12px; color: var(--ink-3); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--blue-soft); color: var(--blue); }
.chip.gold { background: #fdf0d3; color: var(--survey-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.ok { background: #e2f3ea; color: var(--ok); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px;
  padding: 13px 22px; font-weight: 600; background: var(--ink); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.gold { background: var(--survey); color: var(--ink); }
.btn.sm { padding: 7px 14px; font-size: 14px; }
.mock-note { font-size: 13px; color: var(--ink-3); }

/* ── Indice ────────────────────────────────────────────────────────────── */
.hero { background: var(--navy); color: #fff; padding: 40px 24px 56px; }
.hero-in { max-width: 960px; margin: 0 auto; }
.hero p { color: #c9d2ec; max-width: 620px; margin: 28px 0 0; font-size: 17px; }
.cards { max-width: 960px; margin: -28px auto 48px; padding: 0 24px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 26px; box-shadow: 0 8px 30px rgba(20, 28, 56, 0.08); }
.card h2 { font-size: 22px; margin: 10px 0 8px; color: var(--blue); }
.card p { color: var(--ink-2); margin: 0 0 18px; }

/* ── Pagina rispondente (mobile-first) ─────────────────────────────────── */
.r-top { background: var(--navy); padding: 18px 20px 22px; }
.r-top-in { max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.r-saved { color: #c9d2ec; font-size: 13px; margin-top: 6px; white-space: nowrap; }
.r-saved::before { content: '●'; color: #6fd19c; margin-right: 6px; }
.r-progress { max-width: 640px; margin: 0 auto; padding: 18px 20px 0; }
.r-bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.r-bar i { display: block; height: 100%; background: var(--survey); border-radius: 99px; transition: width 0.3s; }
.r-main { max-width: 640px; margin: 0 auto; padding: 22px 20px 120px; }
.screen { display: none; animation: fade 0.25s ease; }
.screen.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.r-main h1 { font-size: 28px; line-height: 1.15; color: var(--blue); margin: 6px 0 14px; }
.r-main h2 { font-size: 21px; line-height: 1.3; margin: 8px 0 20px; font-family: 'Geist', sans-serif; font-weight: 600; }
.lead { font-size: 17px; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.fact { background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.fact b { display: block; font-size: 20px; }
.privacy { background: var(--paper); border-left: 4px solid var(--survey); border-radius: 10px; padding: 14px 16px; margin: 18px 0; font-size: 15px; color: var(--ink-2); }
.privacy b { color: var(--ink); }
.scenario { background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; font-size: 16.5px; margin-bottom: 16px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px 16px; color: var(--ink); font-size: 16px; }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px; }
.opt[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt[aria-pressed='true'] .k { background: var(--ink); color: #fff; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale .opt { flex-direction: column; align-items: center; justify-content: center; padding: 14px 4px; font-size: 20px; font-weight: 700; }
.scale-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; }
.field select, .field input { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.r-nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(246, 244, 239, 0.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line-2); }
.r-nav-in { max-width: 640px; margin: 0 auto; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px; }
.r-nav .btn { flex: 1; }
.thanks { text-align: center; padding-top: 30px; }
.thanks .big { font-family: 'Nothing You Could Do', cursive; font-size: 46px; color: var(--survey-ink); transform: rotate(-3deg); display: inline-block; }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.a-wrap { display: flex; min-height: 100vh; }
.a-side { width: 260px; flex: none; background: var(--navy); color: #c9d2ec; padding: 22px 18px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.a-side .brand { padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.a-nav { display: grid; gap: 2px; }
.a-nav button { text-align: left; background: none; border: 0; color: #c9d2ec; padding: 9px 12px; border-radius: 8px; font-size: 15px; }
.a-nav button:hover { background: rgba(255, 255, 255, 0.06); }
.a-nav button.on { background: rgba(245, 184, 61, 0.16); color: #fff; box-shadow: inset 3px 0 0 var(--survey); }
.a-nav .sep { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 10px 0; }
.a-user { margin-top: auto; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.a-user .av { width: 34px; height: 34px; border-radius: 50%; background: var(--survey); color: var(--ink); display: grid; place-items: center; font-weight: 700; }
.a-main { flex: 1; min-width: 0; padding: 28px 34px 60px; }
.a-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.a-head h1 { font-size: 28px; color: var(--blue); margin-top: 4px; }
.crumbs { font-size: 14px; color: var(--ink-3); }
.panel { display: none; }
.panel.on { display: block; animation: fade 0.2s ease; }
.box { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px 22px; }
.box h3 { font-size: 17px; color: var(--blue); margin-bottom: 12px; }
.grid2 { display: grid; gap: 18px; grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.grid2 > * { min-width: 0; }
.grid3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.flag td { background: var(--warn-bg); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf8f3; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.tile { background: var(--paper); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; }
.tile b { display: block; font-size: 28px; font-family: 'Archivo Black', sans-serif; font-weight: 400; margin-top: 2px; }
.tile small { color: var(--ink-3); }

/* Costruttore */
.tree { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.tree .sec > .label { margin-bottom: 6px; display: block; }
.q { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; font-size: 14px; border: 1px solid transparent; cursor: pointer; }
.q:hover { background: #faf8f3; }
.q.on { background: var(--blue-soft); border-color: var(--line); }
.q code { font-size: 12px; color: var(--ink-3); width: 46px; flex: none; }
.q span:not(.typetag) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typetag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); flex: none; }
.typetag.sjt { background: #fdf0d3; color: var(--survey-ink); }
.ed-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; margin-bottom: 16px; }
.ed .field textarea { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; min-height: 96px; resize: vertical; color: var(--ink); }
.keyrow { display: grid; grid-template-columns: 30px 1fr 110px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.keyrow .k { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px; }
.keyrow input { font: inherit; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; width: 100%; }
.pts { display: flex; gap: 4px; }
.pts b { width: 20px; height: 20px; border-radius: 5px; background: var(--line-2); display: block; }
.pts b.f { background: var(--survey); }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.sw { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; flex: none; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.2s; }
.sw.on { background: var(--ink); }
.sw.on::after { left: 19px; }
.rules { display: grid; gap: 10px; }
.rule { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: #faf8f3; border-radius: 10px; font-size: 14.5px; }
.rule .ic { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; flex: none; }

/* Barre dei risultati (una sola serie: nessuna legenda, il titolo la nomina) */
.bars { display: grid; gap: 12px; }
.barrow { display: grid; grid-template-columns: 170px 1fr 44px; gap: 12px; align-items: center; font-size: 14.5px; }
.track { position: relative; height: 18px; border-left: 1px solid var(--line); }
.track .fill { position: absolute; left: 0; top: 2px; bottom: 2px; background: var(--blue); border-radius: 0 4px 4px 0; }
.track .tick { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.track:hover .fill { filter: brightness(1.15); }
.axis { display: grid; grid-template-columns: 170px 1fr 44px; gap: 12px; font-size: 12px; color: var(--ink-3); }
.axis div:nth-child(2) { display: flex; justify-content: space-between; }

/* Report scritto da Claude */
.report { max-width: 820px; }
.report .box + .box { margin-top: 16px; }
.report h2 { font-size: 24px; color: var(--ink); margin: 6px 0 4px; }
.report p { color: var(--ink-2); margin: 8px 0; }
.report ul { margin: 6px 0; padding-left: 20px; color: var(--ink-2); }
.report li { margin: 5px 0; }
.report blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--survey); background: #fdf8ec; color: var(--ink-2); font-style: italic; border-radius: 0 8px 8px 0; }

@media (max-width: 900px) {
  .a-wrap { flex-direction: column; }
  .a-side { width: auto; height: auto; position: static; }
  .a-main { padding: 22px 18px; }
  .grid2, .ed-row { grid-template-columns: 1fr; }
  .barrow, .axis { grid-template-columns: 110px 1fr 40px; }
}

/* ── App vera: aggiunte rispetto ai mockup ─────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 20px; }
.login form { background: var(--paper); border-radius: var(--radius); padding: 30px; width: min(380px, 100%); display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login .brand { background: var(--navy); border-radius: 12px; padding: 16px 18px 18px; margin-bottom: 6px; }
.err { color: #b3261e; font-size: 14px; min-height: 1.2em; margin: 0; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-3); font-weight: 600; font-size: 14.5px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--survey); }
.stack { display: grid; gap: 18px; }
.field input[type=file] { padding: 10px; }
.notice { padding: 12px 14px; border-radius: 10px; background: #faf8f3; border: 1px solid var(--line-2); font-size: 14.5px; color: var(--ink-2); }
.notice.warn { background: var(--warn-bg); border-color: #f1d3a6; color: var(--warn); }
.notice.ok { background: #e2f3ea; border-color: #bfe3cd; color: var(--ok); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pair { display: grid; gap: 3px; }
.pair .track { height: 14px; }
.track .fill.alt { background: #e0a526; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 16px; border-bottom: 1px solid var(--line); }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 12px; color: var(--ink-2); }
.cols .col span { width: 100%; max-width: 44px; background: var(--blue); border-radius: 4px 4px 0 0; min-height: 0; }
.cols-x { display: flex; gap: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.cols-x span { flex: 1; text-align: center; }
.item { padding: 14px 0; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.item:last-child { border-bottom: 0; }
.item .q-text { font-size: 14.5px; color: var(--ink-2); margin-top: 3px; }
.item .meta { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.dist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; align-items: end; height: 64px; }
.dist div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 11.5px; color: var(--ink-2); gap: 2px; }
.dist div span { width: 100%; background: var(--blue); border-radius: 3px 3px 0 0; }
.dist-x { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 11px; color: var(--ink-3); text-align: center; margin-top: 2px; }
.optrow { display: grid; grid-template-columns: 22px minmax(0, 1fr) 46px; gap: 8px; align-items: center; font-size: 13.5px; padding: 4px 0; }
.optrow .k { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; }
.optrow.best .k { background: var(--ink); color: #fff; }
.optrow .t { min-width: 0; }
.optrow .t small { display: block; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.optrow .bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.optrow .bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.optrow.best .bar i { background: var(--ink); }
.md h2 { font-family: 'Archivo Black', sans-serif; font-size: 19px; color: var(--blue); margin: 22px 0 6px; }
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 16px; margin: 16px 0 4px; font-family: 'Geist', sans-serif; font-weight: 700; }
.md p, .md li { color: var(--ink-2); }
.md ul, .md ol { padding-left: 20px; }
.md li { margin: 4px 0; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.small { font-size: 13px; color: var(--ink-3); }
.btn[disabled] { opacity: .5; cursor: default; }
@media print {
  .a-side, .tabs, .no-print, .a-head .row-actions { display: none !important; }
  .a-main { padding: 0; }
  .box { border: 0; padding: 0; }
}
@media (max-width: 900px) { .item { grid-template-columns: 1fr; } }
.field input, .field select, .field textarea { min-width: 0; width: 100%; box-sizing: border-box; }

/* ── Campi uniformi su tutti i browser (Safari disegna select e number a modo suo) ── */
.field input:not([type=checkbox]):not([type=file]), .field select {
  height: 46px; padding: 0 14px; font: inherit; color: var(--ink); background-color: var(--paper);
  border: 1.5px solid var(--line); border-radius: 10px; -webkit-appearance: none; appearance: none; line-height: normal;
}
.field select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234a64a2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input[type=number] { -moz-appearance: textfield; }
.field input[type=number]::-webkit-inner-spin-button, .field input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 100, 162, 0.15); }
.field label { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-row { align-items: end; }

/* ── Riquadro per caricare un file: clic o trascinamento ─────────────────── */
.drop { position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 2px dashed rgba(74, 100, 162, 0.35);
  border-radius: 14px; background: linear-gradient(180deg, #fbfaf7, #f6f4ef); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.drop:hover, .drop.over { border-color: var(--blue); background: #eef1f9; }
.drop.over { transform: scale(1.01); }
.drop.has { border-style: solid; border-color: #9cc9ae; background: #eef8f2; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop .ico { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line-2); box-shadow: 0 2px 8px rgba(20, 28, 56, .06); }
.drop .ico svg { width: 24px; height: 24px; stroke: var(--blue); }
.drop.has .ico svg { stroke: var(--ok); }
.drop .t { display: grid; gap: 2px; min-width: 0; }
.drop .t b { font-size: 15px; }
.drop .t span { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop:focus-within { outline: 3px solid var(--survey); outline-offset: 2px; }
.del { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; opacity: .45; transition: opacity .15s, background .15s; }
.del svg { width: 18px; height: 18px; stroke: #b3261e; }
tr:hover .del { opacity: 1; }
.del:hover, .del:focus-visible { background: #fbe9e7; opacity: 1; }

/* ── Finestra di conferma ────────────────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(18, 26, 54, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: m-in .16s ease; }
.modal-wrap.out { animation: m-out .16s ease forwards; }
.modal { width: min(460px, 100%); background: var(--paper); border-radius: 18px; padding: 26px 26px 22px; box-shadow: 0 30px 80px rgba(10, 14, 32, .45);
  border-top: 5px solid var(--blue); animation: m-pop .2s cubic-bezier(.2, .9, .3, 1.2); }
.modal.danger { border-top-color: #c2412b; }
.m-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-soft); margin-bottom: 14px; }
.m-ico svg { width: 26px; height: 26px; stroke: var(--blue); }
.modal.danger .m-ico { background: #fbe9e7; }
.modal.danger .m-ico svg { stroke: #c2412b; }
.modal h2 { font-family: 'Archivo Black', sans-serif; font-weight: 400; font-size: 21px; line-height: 1.25; color: var(--ink); margin: 0 0 8px; overflow-wrap: anywhere; }
.m-body { color: var(--ink-2); font-size: 15px; }
.m-facts { margin: 14px 0 0; padding: 12px 14px 12px 32px; background: #faf8f3; border: 1px solid var(--line-2); border-radius: 10px; font-size: 14px; color: var(--ink-2); }
.m-facts li { margin: 3px 0; }
.modal.danger .m-facts { background: #fdf4f2; border-color: #f3d3cc; }
.m-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn.danger { background: #c2412b; color: #fff; }
.btn.danger:hover { background: #a8341f; }
@keyframes m-in { from { opacity: 0; } }
@keyframes m-out { to { opacity: 0; } }
@keyframes m-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .modal-wrap, .modal, .modal-wrap.out { animation: none; } }

/* ── Barra laterale: voci principali con icona ───────────────────────────── */
.nav-main { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #c9d2ec; text-decoration: none; font-size: 15.5px; font-weight: 500; }
.nav-main svg { width: 20px; height: 20px; stroke: currentColor; flex: none; opacity: .85; }
.nav-main:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-main.on { background: rgba(245, 184, 61, 0.16); color: #fff; box-shadow: inset 3px 0 0 var(--survey); }
.nav-main.on svg { stroke: var(--survey); opacity: 1; }

/* ── Ricerca nell'elenco ─────────────────────────────────────────────────── */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; margin-bottom: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #faf8f3; cursor: text; }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 100, 162, 0.15); background: var(--paper); }
.search svg { width: 18px; height: 18px; stroke: var(--ink-3); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15.5px; color: var(--ink); -webkit-appearance: none; appearance: none; }
.search .small { white-space: nowrap; }
tr[hidden] { display: none; }

/* ── Schede trascinabili nella barra laterale ────────────────────────────── */
.tablink { display: block; text-decoration: none; border-radius: 8px; cursor: grab; }
.tablink:active { cursor: grabbing; }
.tablink.dragging { opacity: .45; }
.tablink.drop-before { box-shadow: inset 0 2px 0 var(--survey); }
.tablink.drop-after { box-shadow: inset 0 -2px 0 var(--survey); }
.tablink button { pointer-events: none; }

/* ── Due colori per le schede: preparazione del survey e analisi dei dati ── */
.tablink.cat-crea { --acc: #4fd1b5; }
.tablink.cat-analisi { --acc: var(--survey); }
.tablink button { position: relative; padding-left: 28px !important; }
.tablink button::before { content: ''; position: absolute; left: 12px; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); transform: translateY(-50%); opacity: .8; }
.tablink button.on { background: color-mix(in srgb, var(--acc) 16%, transparent); box-shadow: inset 3px 0 0 var(--acc); }
.tablink.drop-before { box-shadow: inset 0 2px 0 var(--acc); }
.tablink.drop-after { box-shadow: inset 0 -2px 0 var(--acc); }

/* ── Pattern: segnali, panorama divergente, correlazioni, profili ───────── */
:root { --lowc: #d9734a; --midc: #c9cdd6; --highc: #4a64a2; }
.findings { display: grid; gap: 8px; }
.finding { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-size: 14.5px; color: var(--ink-2); }
.fi { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.fi.ok { background: #e2f3ea; color: var(--ok); }
.fi.warn { background: var(--warn-bg); color: var(--warn); }
.fi.gold { background: #fdf0d3; color: var(--survey-ink); }
.diverge { display: grid; gap: 7px; }
.drow { display: grid; grid-template-columns: minmax(0, 34%) 1fr 64px; gap: 14px; align-items: center; font-size: 13.5px; }
.dlabel { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dtrack { display: grid; grid-template-columns: 1fr 1fr; height: 22px; border-left: 0; position: relative; }
.dtrack::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); opacity: .5; }
.dhalf { display: flex; height: 100%; }
.dhalf.left { justify-content: flex-end; }
.seg { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; }
.seg.low { background: var(--lowc); border-radius: 4px 0 0 4px; }
.seg.mid { background: var(--midc); }
.seg.high { background: var(--highc); border-radius: 0 4px 4px 0; }
.dmean { font-weight: 700; }
.dmean small { font-weight: 400; color: var(--ink-3); }
table.heat { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
table.heat th { font: 600 11px 'Geist', sans-serif; color: var(--ink-3); padding: 2px 4px; border: 0; text-transform: none; letter-spacing: 0; white-space: nowrap; }
td.hc { width: 34px; height: 30px; text-align: center; border-radius: 5px; border: 0; padding: 0; background: #f3f1ec; font-variant-numeric: tabular-nums; cursor: default; }
td.hc.diag { background: repeating-linear-gradient(45deg, #ece9e2, #ece9e2 3px, #f6f4ef 3px, #f6f4ef 6px); }
.profiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.profile { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; background: #faf8f3; }
.profile .pt { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pshare { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.pshare span { display: block; height: 100%; background: var(--survey); }
.plab { margin: 8px 0 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.pitem { font-size: 13px; color: var(--ink-2); margin: 3px 0; }
.pitem .up { color: var(--ok); font-weight: 700; margin-right: 4px; }
.pitem .down { color: var(--warn); font-weight: 700; margin-right: 4px; }
@media (max-width: 900px) { .drow { grid-template-columns: 1fr; } }

/* ── Utente in fondo alla barra: apre le preferenze ─────────────────────── */
.a-user { justify-content: space-between; }
.me-link { display: flex; gap: 10px; align-items: center; text-decoration: none; color: #c9d2ec; padding: 6px 8px; margin: -6px -8px; border-radius: 10px; min-width: 0; flex: 1; }
.me-link:hover, .me-link.on { background: rgba(255, 255, 255, 0.07); color: #fff; }
.me-link > div { min-width: 0; font-size: 14px; line-height: 1.3; }
.me-link #me-name { display: inline-block; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.logout { color: #8a93b4; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.logout:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.logout svg { width: 18px; height: 18px; stroke: currentColor; }
.lbox { background: var(--paper); border-radius: var(--radius); padding: 30px; width: min(380px, 100%); display: grid; gap: 14px; }

/* Preferenze: riquadro «Invita una persona», campi e bottone sulla stessa linea e alti uguali */
.inv-form { grid-template-columns: 1.4fr 1fr 180px auto; align-items: end; margin-bottom: 0; }
.inv-form .field { margin-bottom: 0; }
.inv-form .btn { height: 46px; padding: 0 26px; }
@media (max-width: 760px) { .inv-form { grid-template-columns: 1fr; } .inv-form .btn { width: 100%; } }
