/* SDT Velo — interfaccia. Colori di marca da /aspetto.css (Personalizzazione); qui i valori di riserva. */
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --primario: #8E68B7; --secondario: #FF647D;
  --brand-a: #BF5067; --brand-b: #8864AF; --primario-testo: #7A5A9D;
  --grad: linear-gradient(100deg, var(--secondario), var(--primario));
  --grad-testo: linear-gradient(100deg, var(--brand-a), var(--brand-b));
  --tinta: color-mix(in srgb, var(--primario) 9%, #fff);
  --tinta-2: color-mix(in srgb, var(--primario) 16%, #fff);

  --ink: #2A2335; --muted: #6B6479; --line: #E7E2EE; --line-2: #D6CEE1;
  --bg: #F7F5FA; --paper: #FFFFFF;
  --ok: #1D7349; --ok-bg: #E9F5EE; --warn: #845400; --warn-bg: #FFF5E1; --err: #AE2142; --err-bg: #FDECF0;

  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --r-s: 8px; --r-m: 14px; --r-l: 20px;
  --wrap: 1180px; --gutter: clamp(16px, 4vw, 32px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 16px/1.55 var(--font); color: var(--ink); background: var(--bg);
  font-feature-settings: "ss01", "tnum";
}
main { flex: 1; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
a { color: var(--primario-testo); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primario) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.ico { width: 18px; height: 18px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- testata ------------------------------------------------------------------------------ */
.brandbar { height: 4px; background: var(--grad); }
.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; min-height: 72px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 38px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; padding-left: 16px; border-left: 1px solid var(--line-2); min-width: 0; }
.brand-txt strong { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.brand-txt span { font-size: 13.5px; color: var(--muted); }
.utente { display: flex; align-items: center; gap: 6px; font-size: 14.5px; }
.utente .chi { display: flex; align-items: center; gap: 10px; margin-right: 6px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-testo); color: #fff; font-weight: 700; font-size: 14px; text-transform: uppercase; }

.tabs { background: var(--paper); border-bottom: 1px solid var(--line); }
.tabs .wrap { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 8px; padding-bottom: 8px; }
.tabs .wrap::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 15px; white-space: nowrap; }
.tab:hover { color: var(--ink); background: var(--bg); }
.tab.on { color: var(--primario-testo); background: var(--tinta); }
.tab.on .ico { color: var(--primario); }
.tabs .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 8px; flex: none; }

/* --- pagina ------------------------------------------------------------------------------- */
.page-head { padding: 32px 0 20px; }
.page-head h1 { margin: 0; font-size: clamp(26px, 3vw, 32px); line-height: 1.15; font-weight: 750; letter-spacing: -.015em; }
.page-head .lead { margin: 8px 0 0; color: var(--muted); max-width: 68ch; }
.page-head .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; color: var(--muted); font-size: 14.5px; }
.page-head .meta strong { color: var(--ink); font-weight: 600; }
h2 { font-size: 19px; line-height: 1.3; font-weight: 700; margin: 0 0 16px; letter-spacing: -.005em; }
h2 + .note { margin-top: -12px; }
.panel h2:not(:first-child) { margin-top: 32px; }
p { margin: 0 0 12px; }
.note { color: var(--muted); font-size: 14.5px; }
.small { font-size: 14px; }
.muted { color: var(--muted); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); padding: clamp(20px, 3vw, 32px); margin-bottom: 24px; }
.panel.stretto { max-width: 520px; margin-left: auto; margin-right: auto; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.cols.meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.aside { position: sticky; top: 16px; }
.aside .panel { background: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 960px) {
  .cols, .cols.meta { grid-template-columns: 1fr; }
  .aside { position: static; }
}
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* --- passi del flusso (sequenza reale: carica, rivedi, scarica, ripristina) --------------- */
.passi { list-style: none; display: flex; gap: 8px; margin: 0 0 4px; padding: 0; counter-reset: p; flex-wrap: wrap; }
.passi li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--muted); font-weight: 550; }
.passi li + li::before { content: ""; width: 28px; height: 2px; background: var(--line-2); border-radius: 2px; margin-right: 2px; }
.passi .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 2px solid var(--line-2); color: var(--muted); background: var(--paper); }
.passi .fatto .n { border-color: transparent; background: var(--tinta-2); color: var(--primario-testo); }
.passi .fatto + li::before, .passi .ora::before { background: color-mix(in srgb, var(--primario) 45%, var(--line-2)); }
.passi .ora { color: var(--ink); }
.passi .ora .n { border-color: transparent; background: var(--grad-testo); color: #fff; }
@media (max-width: 640px) { .passi li:not(.ora) .t { display: none; } .passi li + li::before { width: 14px; } }

/* --- moduli ------------------------------------------------------------------------------- */
label { display: block; margin: 0 0 18px; font-size: 14.5px; font-weight: 600; }
label .aiuto { display: block; font-weight: 400; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
input[type=text], input[type=password], input[type=url], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-s);
  font: 400 15.5px/1.4 var(--font); color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primario) 40%, var(--line-2)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 22%, transparent); }
input[type=checkbox] { accent-color: var(--primario); width: 18px; height: 18px; margin: 0; flex: none; }
input[type=color] { width: 52px; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: #fff; cursor: pointer; }
label.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; margin-bottom: 12px; cursor: pointer; }
label.check input { margin-top: 2px; }
label.check .aiuto { margin-top: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-weight: 700; font-size: 15px; margin-bottom: 12px; padding: 0; }
.oppure { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; }
.oppure::before, .oppure::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.drop { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 28px 20px; margin: 6px 0 4px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-m); background: var(--bg); font-weight: 400; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.sopra, .drop:focus-within { border-color: var(--primario); background: var(--tinta); }
.drop .ico { width: 30px; height: 30px; color: var(--primario); margin-bottom: 6px; }
.drop-t { font-weight: 600; font-size: 15.5px; }
.drop-t u { color: var(--primario-testo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.drop-s { color: var(--muted); font-size: 13.5px; }
.drop-f { display: none; margin-top: 8px; padding: 4px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-2); font-weight: 600; font-size: 14px; }
.drop.pieno .drop-f { display: inline-block; }
.drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* --- pulsanti ----------------------------------------------------------------------------- */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border: 1px solid transparent; border-radius: 999px; background: var(--grad-testo); color: #fff;
  font: 650 15.5px/1.2 var(--font); text-decoration: none; cursor: pointer; transition: filter .15s, box-shadow .15s; }
.btn:hover, button:hover { filter: brightness(1.06); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--brand-b) 70%, transparent); text-decoration: none; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.secondario, button.secondario { background: var(--paper); color: var(--ink); border-color: var(--line-2); }
.btn.secondario:hover, button.secondario:hover { border-color: var(--primario); color: var(--primario-testo); box-shadow: none; filter: none; }
.btn.piccolo, button.piccolo { min-height: 36px; padding: 6px 14px; font-size: 14.5px; }
button.link { background: none; border: 0; min-height: 0; padding: 0; color: var(--primario-testo); font-weight: 600; font-size: inherit; box-shadow: none; filter: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button.link:hover { text-decoration-thickness: 2px; }
button.link.pericolo { color: var(--err); }
button.esci { background: none; color: var(--muted); border: 0; padding: 8px 12px; min-height: 36px; font-weight: 550; font-size: 14.5px; }
button.esci:hover { color: var(--ink); background: var(--bg); box-shadow: none; filter: none; }
.utente a.esci { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 550; display: inline-flex; gap: 8px; align-items: center; }
.utente a.esci:hover { color: var(--ink); background: var(--bg); }
form.inline, .inline { display: inline-flex; margin: 0; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.actions .spazio { flex: 1; }
.actions.fissa { position: sticky; bottom: 0; z-index: 2; margin: 24px calc(-1 * clamp(20px, 3vw, 32px)) calc(-1 * clamp(20px, 3vw, 32px)); padding: 16px clamp(20px, 3vw, 32px);
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-m) var(--r-m); }
.actions .conta { color: var(--muted); font-size: 14.5px; }
.actions + .note { margin-top: 16px; }

/* --- avvisi ------------------------------------------------------------------------------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-s); margin: 0 0 20px; border: 1px solid; font-size: 15px; }
.alert .ico { margin-top: 2px; }
.alert > div > :last-child { margin-bottom: 0; }
.alert.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.alert.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert.err { background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 30%, transparent); color: var(--err); }
.alert strong { font-weight: 700; }

/* --- tabelle ------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; margin: 12px 0 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl th { font-weight: 600; color: var(--muted); font-size: 13.5px; border-bottom-color: var(--line-2); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--primario) 3.5%, transparent); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.azioni { text-align: right; white-space: nowrap; }
.tbl.compatta th, .tbl.compatta td { padding: 9px 12px; }
.tbl.compatta th:first-child, .tbl.compatta td:first-child { padding-left: 0; }
.tbl.compatta th:last-child, .tbl.compatta td:last-child { padding-right: 0; }
.table-wrap > .tbl { min-width: 640px; }
.tbl .cella-check { width: 36px; }
.tbl .vuota { color: var(--muted); padding: 20px 0; }
.ctx { color: var(--muted); font-size: 14px; max-width: 46ch; min-width: 24ch; }
.tbl code { white-space: nowrap; overflow-wrap: normal; }
.tbl td.small code { white-space: normal; overflow-wrap: anywhere; }  /* dettaglio JSON del registro */
code { font-family: var(--mono); font-size: .86em; background: var(--bg); border: 1px solid var(--line); padding: .08em .4em; border-radius: 6px; overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, var(--secondario) 22%, #fff); color: var(--ink); padding: 0 .15em; border-radius: 3px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.tag.attivo { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.tag.brand { background: var(--tinta); border-color: transparent; color: var(--primario-testo); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }

/* Le etichette pseudonimizzate: il «velo» sul dato, nello stile della pillola del marchio. */
.velo { display: inline-block; font: 650 .82em/1.5 var(--mono); color: #fff; background: var(--grad-testo); padding: 0 .6em; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; vertical-align: .05em; }
.velo.spenta { background: var(--paper); color: var(--muted); border: 1px dashed var(--line-2); }

pre.preview { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 20px 24px; max-height: 520px; overflow: auto; font: 400 15px/1.75 var(--font); max-width: none; }

/* --- dettagli (reimposta password) -------------------------------------------------------- */
details.apri { display: inline-block; text-align: left; }
details.apri summary { cursor: pointer; color: var(--primario-testo); font-weight: 600; list-style: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
details.apri summary::-webkit-details-marker { display: none; }
details.apri[open] summary { margin-bottom: 8px; }
details.apri form { display: flex; gap: 8px; align-items: center; }
details.apri input { margin: 0; min-width: 200px; padding: 7px 10px; font-size: 14.5px; }
.azioni-riga { display: inline-flex; gap: 16px; align-items: flex-start; justify-content: flex-end; flex-wrap: wrap; }

/* --- accesso ------------------------------------------------------------------------------ */
.login { min-height: calc(100vh - 4px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-intro { padding: clamp(32px, 6vw, 72px); display: flex; flex-direction: column; gap: 28px; justify-content: center; background: var(--tinta); border-right: 1px solid var(--line); }
.login-intro .logo { height: 46px; width: auto; max-width: 260px; object-fit: contain; align-self: flex-start; }
.login-intro h1 { font-size: clamp(34px, 4.4vw, 52px); line-height: 1.04; letter-spacing: -.025em; font-weight: 800; margin: 0; }
.login-intro .lead { color: var(--muted); font-size: 18px; margin: 10px 0 0; max-width: 34ch; }
.demo { margin: 0; padding: 24px 26px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); max-width: 520px; }
.demo p { font-size: 17px; line-height: 1.9; margin: 0; }
.demo figcaption { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.demo figcaption .ico { color: var(--primario); margin-top: 1px; }
.login-form { background: var(--paper); display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 72px); }
.login-form .box { width: 100%; max-width: 380px; margin: 0 auto; }
.login-form h2 { font-size: 24px; margin-bottom: 20px; }
.login-form button { width: 100%; margin-top: 4px; }
.login-form .note { margin-top: 20px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login-intro { border-right: 0; border-bottom: 1px solid var(--line); gap: 20px; }
  .login-intro .demo { display: none; }
}

/* --- personalizzazione -------------------------------------------------------------------- */
.colori { display: flex; gap: 24px; flex-wrap: wrap; }
.colori label { display: flex; align-items: center; gap: 12px; }
.colori label span { display: flex; flex-direction: column; }
.colori code { font-size: 13px; }
.anteprima { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r-s); background: var(--bg); border: 1px solid var(--line); margin: 4px 0 8px; }
.anteprima .barra { width: 100%; height: 4px; border-radius: 4px; background: var(--grad); }
.immagine { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.immagine:first-of-type { border-top: 0; padding-top: 0; }
.immagine .vista { height: 84px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px; }
.immagine .vista img { max-height: 56px; max-width: 100%; object-fit: contain; }
.immagine label { margin-bottom: 8px; }
.immagine input[type=file] { font: 400 14px var(--font); margin-top: 8px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: 600 14px var(--font); color: var(--ink); background: var(--paper); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 14px; margin-right: 12px; cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--primario); color: var(--primario-testo); }
@media (max-width: 640px) { .immagine { grid-template-columns: 1fr; } }

/* --- piede -------------------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); margin-top: 40px; background: var(--paper); }
.foot-in { display: flex; flex-wrap: wrap; gap: 6px 24px; padding-top: 18px; padding-bottom: 18px; color: var(--muted); font-size: 13.5px; }
.foot-in .stato { display: inline-flex; align-items: center; gap: 8px; }
.foot-in .stato::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.foot-in .stato.no::before { background: var(--warn); }
.foot-in .credito { margin-left: auto; }
@media (max-width: 640px) { .foot-in .credito { margin-left: 0; } .top-in { min-height: 0; } .brand-txt span { display: none; } }

/* --- piccoli aggiustamenti ---------------------------------------------------------------- */
.lbl { display: block; font-size: 14.5px; font-weight: 600; }
.actions.su { margin-top: 0; margin-bottom: 16px; }
label.check.centro { align-self: center; }
.page-head p.small { margin: 0 0 6px; }
.page-head .passi { margin-bottom: 18px; }
.panel-head { max-width: 520px; margin-left: auto; margin-right: auto; }
.panel.errore { text-align: center; margin-top: 48px; }
.panel.errore .ico { width: 36px; height: 36px; color: var(--err); }
.panel.errore h1 { font-size: 26px; margin: 8px 0; }
.foot-in .credito a { color: inherit; text-decoration-color: var(--line-2); }
.foot-in .credito a:hover { color: var(--primario-testo); text-decoration-color: currentColor; }
.login-form .credito-login { margin-top: 8px; }
.login-form .credito-login a { color: var(--muted); }
.login-form .credito-login a:hover { color: var(--primario-testo); }
