/* ============================================================
   GENOEXOME — foglio di stile brand Altamedica
   Navy #0f2a4a · Oro #b8860b · Bianco. Tipografia di sistema.
   ============================================================ */

:root {
  --navy: #0f2a4a;
  --navy-2: #16385f;
  --navy-3: #1e4677;
  --gold: #b8860b;
  --gold-2: #9a6f08;
  --gold-soft: #f8f1dd;
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #1c2b3a;
  --muted: #5b6b7c;
  --line: #dde4ec;
  --ok: #15803d;
  --ok-soft: #d9f2e3;
  --warn: #b45309;
  --warn-soft: #fdf0dc;
  --err: #b91c1c;
  --err-soft: #fde4e4;
  --info: #1d4ed8;
  --info-soft: #e3ebfd;
  --shadow: 0 1px 2px rgba(15, 42, 74, .06), 0 4px 14px rgba(15, 42, 74, .08);
  --shadow-lg: 0 8px 30px rgba(15, 42, 74, .18);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

.hidden { display: none !important; }

a { color: var(--navy-3); }

button { font-family: var(--font); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------------- header ---------------- */

.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--gold);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .5px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 2.5px;
  font-weight: 700;
}

.brand .subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #cdd8e6;
}

.mainnav { display: flex; gap: 6px; flex-wrap: wrap; }

.mainnav a {
  color: #dce6f2;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
}

.mainnav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }

.mainnav a.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-color: var(--gold);
}

/* barra di navigazione del caso */
.casebar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 8px 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(15, 42, 74, .05);
}

.casebar .case-ref {
  font-weight: 700;
  color: var(--navy);
  font-family: var(--mono);
  font-size: 13px;
}

.casebar a {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}

.casebar a:hover { background: var(--bg); color: var(--navy); }

.casebar a.active {
  background: var(--gold-soft);
  color: var(--gold-2);
}

/* ---------------- layout ---------------- */

.view {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 26px 60px;
}

.view:focus { outline: none; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-head h2 {
  margin: 0;
  font-size: 19px;
  color: var(--navy);
}

.page-head .page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card > h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card > h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--gold);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 42px 20px;
}

.empty-state .big { font-size: 34px; margin-bottom: 8px; }

/* ---------------- bottoni ---------------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .12s, border-color .12s, transform .05s;
}

.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }

.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); }

.btn-danger { background: #fff; border-color: #efc4c4; color: var(--err); }
.btn-danger:hover { background: var(--err-soft); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--navy); }

.btn-lg { padding: 12px 22px; font-size: 14px; border-radius: 10px; }

.btn .spin { animation: gxspin 1s linear infinite; display: inline-block; }

/* ---------------- badge e chip ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}

.badge-grey { background: #eef1f5; color: #47586b; }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-green { background: var(--ok-soft); color: var(--ok); }
.badge-red { background: var(--err-soft); color: var(--err); }
.badge-navy { background: var(--navy); color: #fff; }
.badge-gold { background: var(--gold-soft); color: var(--gold-2); }

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge.pulsing .dot { animation: gxpulse 1.2s ease-in-out infinite; }

/* classi ACMG */
.acmg { color: #fff; }
.acmg-P { background: #7f1d1d; }
.acmg-LP { background: #c2410c; }
.acmg-VUS { background: #47586b; }
.acmg-LB { background: #d3f1de; color: #0b5c33; }
.acmg-B { background: #15803d; }
.acmg-NA { background: #eef1f5; color: #8695a6; }

/* stato revisione */
.rev-pending { background: #eef1f5; color: #47586b; }
.rev-accepted { background: var(--ok-soft); color: var(--ok); }
.rev-rejected { background: var(--err-soft); color: var(--err); }
.rev-reclass { background: #ece6fb; color: #5b21b6; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  color: var(--navy);
  border: 1px solid #ecdcb2;
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
  font-size: 12px;
  font-weight: 600;
}

.chip .chip-x {
  border: none;
  background: transparent;
  color: var(--gold-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
  line-height: 1;
}

.chip .chip-x:hover { background: rgba(184, 134, 11, .18); }

.chip-static { padding-right: 11px; }

/* ---------------- form ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.field > label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .2px;
}

.field .hint { font-size: 11.5px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"],
textarea, select {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  width: 100%;
}

textarea { resize: vertical; min-height: 74px; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, .15);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}

.switch-row:last-child { border-bottom: none; }

.switch-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--gold);
  cursor: pointer;
}

.switch-row .sw-label { font-weight: 600; }
.switch-row .sw-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------------- dropzone VCF ---------------- */

.dropzone {
  border: 2px dashed #b8c6d8;
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dropzone:hover, .dropzone:focus-visible { border-color: var(--gold); background: #fffdf5; }

.dropzone.dragover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-2);
}

.dropzone .dz-icon { font-size: 30px; margin-bottom: 6px; }
.dropzone .dz-main { font-weight: 700; color: var(--navy); font-size: 14px; }

.dropzone.has-file {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

/* ---------------- nuovo caso: una riga per persona (CIO 26/09/2026) ---------------- */

.riga-ruolo {
  border: 1px solid #dde4ee;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 10px 0;
  background: #fff;
}
.riga-ruolo .riga-testa { margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.riga-ruolo .riga-corpo { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.riga-ruolo .riga-campi { display: flex; flex-direction: column; gap: 8px; }
.riga-ruolo .scelta-file { padding: 10px 0; }
.dropzone.dz-riga { padding: 14px 12px; }
@media (max-width: 720px) {
  .riga-ruolo .riga-corpo { grid-template-columns: 1fr; }
}

/* ---------------- tabelle ---------------- */

.table-wrap { overflow-x: auto; }

table.gx {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.gx th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  background: #fbfcfe;
}

table.gx td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f6;
  vertical-align: middle;
}

table.gx tbody tr:hover { background: #f7f9fc; }

table.gx tbody tr.clickable { cursor: pointer; }

table.gx tbody tr.clickable:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

table.gx tr.row-excluded td { opacity: .55; }
table.gx tr.row-selected { background: var(--gold-soft) !important; }

.trunc {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.gene-cell { font-weight: 700; color: var(--navy); }

.stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; }
.stars .off { color: #d3dae3; }

/* barretta score fenotipo */
.scorebar {
  width: 74px;
  height: 8px;
  border-radius: 4px;
  background: #e8edf3;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.scorebar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d9b45c, var(--gold));
  border-radius: 4px;
}

/* ---- elenco delle candidate nella revisione (P9, segnalato dal CIO l'11/09/2026) ----
   Undici colonne a larghezza automatica superavano i 1188 px della scheda anche a 1920 px
   (la vista e' limitata a 1280): «Fenotipo» e «Revisione» finivano fuori schermo e si
   raggiungevano solo con lo scorrimento orizzontale. Qui ogni colonna ha una larghezza
   dichiarata (somma 100 %, presidiata da tests/unit/test_p9_p10_schermo_e_stampa.py): la
   tabella occupa la larghezza disponibile e nulla resta fuori. I testi lunghi vanno a capo
   nei punti naturali (<wbr> messo da review.js dopo «:», «_», «/») invece di essere
   troncati, e il testo intero resta nel titolo al passaggio del mouse. */
#rev-table table.gx { table-layout: fixed; }
#rev-table table.gx th,
#rev-table table.gx td { padding-left: 8px; padding-right: 8px; overflow-wrap: anywhere; }
#rev-table table.gx th { white-space: normal; }
/* ⚠️ Le larghezze sommano a 100: aggiungendo una colonna vanno ribilanciate tutte, altrimenti
   la tabella sborda. La colonna «Genotipo» (terzo livello, q12) è entrata il 13/09/2026 e ha
   preso spazio da HGVS, conseguenza e qualità, che erano le tre più larghe. */
#rev-table th.c-gene { width: 11%; }
#rev-table th.c-hgvs { width: 13%; }
#rev-table th.c-cons { width: 9%; }
#rev-table th.c-zig { width: 7%; }
#rev-table th.c-compat { width: 9%; }
#rev-table th.c-qual { width: 9%; }
#rev-table th.c-af { width: 7%; }
#rev-table th.c-clinvar { width: 8%; }
#rev-table th.c-acmg { width: 10%; }
#rev-table th.c-feno { width: 8%; }
#rev-table th.c-rev { width: 9%; }
/* Un badge piu' largo della cella va a capo dentro la cella invece di sbordare in quella
   accanto; la barretta del fenotipo si accorcia quanto basta per stare accanto al numero. */
#rev-table .badge { white-space: normal; line-height: 1.25; text-align: left; }
#rev-table .scorebar { width: 56px; }

/* tabella chiave/valore nel drawer */
table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }

table.kv th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  width: 42%;
  padding: 6px 8px 6px 0;
  vertical-align: top;
  border-bottom: 1px dashed #edf1f6;
}

table.kv td {
  padding: 6px 0;
  border-bottom: 1px dashed #edf1f6;
  word-break: break-word;
}

/* ---------------- timeline esecuzione ---------------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  display: flex;
  gap: 14px;
  padding: 0 0 4px;
  position: relative;
}

.tl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 26px;
}

.tl-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: #e8edf3;
  color: #8695a6;
  border: 2px solid #e8edf3;
  flex: 0 0 auto;
}

.tl-line { width: 2px; flex: 1 1 auto; background: var(--line); min-height: 16px; }

.timeline li:last-child .tl-line { display: none; }

.tl-dot.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.tl-dot.error { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.tl-dot.skipped { background: #eef1f5; color: #8695a6; }

.tl-dot.running {
  background: #fff;
  border-color: var(--gold);
  color: var(--gold);
}

.tl-dot.running::after {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  animation: gxspin .8s linear infinite;
}

.tl-body { padding: 3px 0 14px; min-width: 0; flex: 1; }

.tl-title { font-weight: 700; color: var(--navy); font-size: 13.5px; }
.tl-title .mono { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.tl-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tl-msg { font-size: 12.5px; margin-top: 3px; }
.tl-error { color: var(--err); font-size: 12.5px; margin-top: 4px; white-space: pre-wrap; }

/* imbuto filtri */
.funnel-row { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items: center; margin: 7px 0; }

.funnel-label { font-size: 12px; color: var(--muted); text-align: right; }

.funnel-bar-track { background: #eef1f5; border-radius: 6px; height: 22px; position: relative; }

.funnel-bar {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--navy-3), var(--navy));
  min-width: 6px;
}

.funnel-count {
  position: absolute;
  right: 8px;
  top: 0;
  line-height: 22px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--mono);
}

/* log espandibile */
details.runlog { margin-top: 10px; }

details.runlog summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  font-size: 13px;
}

details.runlog pre {
  background: var(--navy);
  color: #cdd8e6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11.5px;
  font-family: var(--mono);
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------- revisione ---------------- */

.sticky-review {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.sticky-review .quesito {
  font-size: 13px;
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-review .spacer { flex: 1; }

.counter-accepted {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.counter-accepted b { color: var(--gold); }

.filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filterbar select, .filterbar input[type="search"] { width: auto; min-width: 150px; }

.filterbar .toggle-escluse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

/* ---------------- drawer ---------------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 74, .35);
  z-index: 90;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 96vw);
  background: #fff;
  z-index: 100;
  box-shadow: -12px 0 40px rgba(15, 42, 74, .25);
  display: flex;
  flex-direction: column;
  animation: gxslidein .18s ease-out;
}

.drawer-head {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfe, #fff);
}

.drawer-head .dh-top { display: flex; align-items: flex-start; gap: 12px; }

.drawer-head h3 { margin: 0; font-size: 17px; color: var(--navy); }

.drawer-head .dh-sub { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }

.drawer-close {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 21px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}

.drawer-close:hover { background: var(--bg); color: var(--navy); }

.tabs { display: flex; gap: 2px; margin-top: 12px; }

.tabs button {
  border: none;
  background: transparent;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
}

.tabs button:hover { color: var(--navy); background: var(--bg); }

.tabs button.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 30px; }

.drawer-section h4 {
  margin: 18px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--gold-2);
}

.drawer-section h4:first-child { margin-top: 0; }

/* ---------------- qualità della chiamata (§1.2 del piano post-Mesoraca) ----------------
   Semaforo e parametri in evidenza: DP, GQ, frazione allelica, bilanciamento allelico.
   ⛔ Segnala e non esclude: nessuna variante viene tolta dall'analisi per questi valori.
   Colori dalle variabili di brand, nessuna libreria aggiunta.                          */

.qc-punto {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  border: 1px solid rgba(15, 42, 74, .18);
}

.qc-rosso   { background: var(--err); }
.qc-giallo  { background: var(--warn); }
.qc-verde   { background: var(--ok); }
.qc-assente { background: #cbd5e1; }

/* cella compatta in elenco: pallino + i due numeri che contano */
.qc-cella { display: flex; align-items: center; gap: 6px; }
.qc-cella .qc-valori { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* riquadro in testa alla scheda della variante */
.qc-riquadro {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fff;
}

.qc-riquadro.qc-b-rosso   { border-left-color: var(--err); background: var(--err-soft); }
.qc-riquadro.qc-b-giallo  { border-left-color: var(--warn); background: var(--warn-soft); }
.qc-riquadro.qc-b-verde   { border-left-color: var(--ok); }
.qc-riquadro.qc-b-assente { border-left-color: #cbd5e1; background: var(--bg); }

.qc-testata {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--navy);
  font-size: 13px;
}

.qc-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.qc-voce {
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

.qc-voce .qc-etichetta {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}

.qc-voce .qc-numero {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.qc-voce .qc-nota { display: block; font-size: 11px; color: var(--muted); }
.qc-voce.qc-manca .qc-numero { font-size: 12px; font-weight: 600; color: var(--muted); }

.qc-motivi { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; }
.qc-motivi li { margin-bottom: 3px; }
.qc-motivi .qc-soglia { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }

.qc-regola { margin-top: 8px; font-size: 12px; }
.qc-regola summary { cursor: pointer; color: var(--navy-3); }
.qc-regola ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }

/* criteri ACMG */
.crit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.crit-item[open] { box-shadow: var(--shadow); }

.crit-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
}

.crit-item summary::-webkit-details-marker { display: none; }

.crit-item summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  transition: transform .12s;
}

.crit-item[open] summary::after { transform: rotate(180deg); }

.crit-id {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
}

.crit-id.benign { background: var(--ok); }
.crit-id.notmet { background: #b6c2cf; }

.crit-body { padding: 4px 12px 12px; font-size: 13px; border-top: 1px dashed var(--line); }

/* ---- dati nuovi sulla scheda (v0.1.45 → v0.1.57): PM3 a punti, BP2 proposto, BA1 con
   eccezioni, ranking spiegato, consenso ai reperti secondari. Riquadri sobri nello stile
   navy/oro: il contenuto e' del server, qui si disegna soltanto. ---- */
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

.dato-box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0 0;
  font-size: 13px;
  background: #fff;
}
.dato-box.dato-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.dato-box.dato-info { border-left-color: var(--info); background: var(--info-soft); }
.dato-box.dato-pm3 { border-left-color: var(--gold-2); }
.dato-box table.kv { margin-top: 6px; }

.fattori-riga { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.fattore-cella {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  min-width: 92px;
}
.fattore-cella b { font-family: var(--mono); font-size: 14px; }

.sticky-review .riga-caso { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.sticky-review .sep-punto { color: var(--muted); }
.consenso-form { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: 6px; }
.consenso-form select { max-width: 460px; font-size: 12px; padding: 4px 6px; }

.badge-foglio { max-width: 220px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }

.crit-body .evrefs-details { margin-top: 8px; }
.crit-body .evrefs-details summary { cursor: pointer; font-size: 12px; color: var(--navy-3); }

.crit-body .evrefs {
  background: #f7f9fc;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.manual-flag { font-size: 10.5px; color: var(--gold-2); font-weight: 700; text-transform: uppercase; }

/* ---------------- bibliografia della variante (ordine del CIO del 12/09/2026) ----------
   Gli articoli TROVATI dalla pipeline (citazioni ClinVar, LitVar2/PubMed) nel tab Variante.
   Nessuna libreria, nessun colore nuovo: le variabili di brand e i badge gia' in uso.     */

.bibl-testa {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}

.bibl-motivo { margin: 4px 0 2px; }

.bibl-lista { list-style: none; margin: 6px 0 8px; padding: 0; }

.bibl-voce { border-top: 1px solid var(--line); padding: 8px 0; }
.bibl-voce:first-child { border-top: 0; padding-top: 4px; }

.bibl-titolo { font-size: 13px; line-height: 1.35; }

.bibl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  margin-top: 3px;
  color: var(--muted);
}

.bibl-pmid { color: var(--navy-3); text-decoration: none; border-bottom: 1px dotted currentColor; }
.bibl-pmid:hover { color: var(--navy); border-bottom-style: solid; }

/* la riga che, nel tab Suggerimento AI, dice che quei riferimenti il modello li RICORDA */
.bibl-avviso { margin: 0 0 8px; line-height: 1.4; }

/* riquadro suggerimento AI */
.ai-box {
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: #fffdf6;
  padding: 16px 18px;
}

.ai-box .ai-label {
  display: inline-block;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.ai-box h5 {
  margin: 14px 0 5px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--gold-2);
}

.ai-box h5:first-of-type { margin-top: 0; }

.ai-box p { margin: 0 0 6px; font-size: 13px; }

.ai-box ul { margin: 4px 0; padding-left: 18px; font-size: 13px; }

/* decisione */
.decision-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.dec-btn {
  flex: 1 1 140px;
  padding: 16px 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  transition: all .12s;
}

.dec-btn .dec-ico { display: block; font-size: 21px; margin-bottom: 5px; }

.dec-btn:hover { border-color: #b8c6d8; color: var(--navy); }

.dec-btn.sel-accept { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.dec-btn.sel-reject { border-color: var(--err); background: var(--err-soft); color: var(--err); }
.dec-btn.sel-reclass { border-color: #5b21b6; background: #ece6fb; color: #5b21b6; }

/* ---------------- referto ---------------- */

.referto-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* Stato della riscrittura del testo del referto (accanto a «Salva testi»). */
.referto-hint { font-size: 12px; color: var(--muted); line-height: 1.3; }
.referto-hint-warn { color: #9a6b00; font-weight: 600; }

.referto-frame-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.referto-frame-wrap iframe {
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 480px;
  border: none;
  display: block;
  background: #fff;
}

/* ---------------- avvisi ---------------- */

.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid transparent;
}

.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f2d9b0; }
.alert-error { background: var(--err-soft); color: var(--err); border-color: #f2bcbc; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #c4d4f7; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #b9e4c9; }

.alert .alert-ico { font-size: 16px; line-height: 1.2; }

/* ---------------- impostazioni ---------------- */

.bank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}

.bank-row:last-child { border-bottom: none; }

.bank-name { font-weight: 700; color: var(--navy); min-width: 160px; }
.bank-meta { color: var(--muted); font-size: 12px; }
.bank-row .spacer { flex: 1; }

.sys-badges { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- toast ---------------- */

.toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--gold);
  animation: gxtoastin .18s ease-out;
  word-break: break-word;
}

.toast-error { border-left-color: #ef7070; background: #5e1414; }
.toast-ok { border-left-color: #4ade80; }

/* ---------------- modale ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 74, .45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ⛔ Il modale NON deve superare lo schermo. Il modulo dei dati clinici è cresciuto con i campi
   di M-146 (diagnosi sospetta, proposte HPO) e su un portatile i pulsanti «Salva e ricalcola» e
   «Annulla» finivano SOTTO il bordo, irraggiungibili: l'overlay centra il modale e ne taglia le
   due estremità, e senza scorrimento non c'era modo di arrivarci. Segnalato dal CIO il 13/09/2026
   lavorando sul primo caso della validazione — «non mi permette di scendere in basso per salvare»
   — ed è la ragione per cui sesso ed età di quel caso non erano stati registrati.
   Il corpo scorre, la testata e i pulsanti restano fermi. */
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: min(460px, 94vw);
  padding: 22px 24px;
  animation: gxmodalin .16s ease-out;
  max-height: calc(100vh - 40px);   /* 40px = i 20px di padding dell'overlay, sopra e sotto */
  display: flex;
  flex-direction: column;
  min-height: 0;                    /* senza questo il figlio in overflow non si comprime */
}

.modal h3 { margin: 0 0 10px; color: var(--navy); font-size: 16px; flex: 0 0 auto; }
.modal .modal-body {
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 18px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  /* ⚠️ Un contenitore che scorre ritaglia i figli in posizione assoluta: la tendina di
     completamento degli HPO (`.hpo-list`) compare sotto al suo campo e, se non c'è spazio, si
     raggiunge scorrendo. Se dovesse risultare scomoda, la via è portare la tendina fuori dal
     modale (posizionamento sul viewport), non togliere lo scorrimento. */
}
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex: 0 0 auto; }

/* ---------------- autocomplete HPO ---------------- */

.hpo-wrap { position: relative; }

.hpo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  max-height: 280px;
  overflow-y: auto;
}

.hpo-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid #f2f5f9;
}

.hpo-item:last-child { border-bottom: none; }

.hpo-item .hpo-id { font-family: var(--mono); font-size: 11.5px; color: var(--gold-2); white-space: nowrap; }
.hpo-item .hpo-label { font-size: 13px; }
.hpo-item .hpo-syn { font-size: 11px; color: var(--muted); }

.hpo-item:hover, .hpo-item.active { background: var(--gold-soft); }

.hpo-status { padding: 9px 12px; color: var(--muted); font-size: 12.5px; }

.chips-box { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; min-height: 10px; }

/* ============================================================
   PIATTAFORMA MULTIUTENTE — accesso, shell, dashboard, utenti
   ============================================================ */

/* ---------------- shell ---------------- */

body.gx-locked { overflow: hidden; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.ico {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex: 0 0 auto;
  vertical-align: -2px;
}

.mainnav a { display: inline-flex; align-items: center; gap: 7px; }

/* ---------------- accesso ---------------- */

.login-root {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(900px 520px at 18% -10%, #24548c 0%, rgba(36, 84, 140, 0) 62%),
    linear-gradient(140deg, var(--navy) 0%, #0a1d34 100%);
}

.login-card {
  width: min(430px, 100%);
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 22px 64px rgba(0, 0, 0, .40);
  padding: 0 0 26px;
  overflow: hidden;
  animation: gxmodalin .18s ease-out;
}

.login-card .login-strip { height: 5px; background: linear-gradient(90deg, var(--gold), #e0bd63); }

.login-head { text-align: center; padding: 28px 30px 6px; }

.login-head .gx-word {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 7px;
  color: var(--navy);
  line-height: 1.1;
}

.login-head .gx-sub { color: var(--muted); font-size: 12.5px; margin-top: 7px; }

.login-body { padding: 18px 30px 0; }

.login-body .field { margin-bottom: 13px; }

.login-actions { padding: 6px 30px 0; }

.login-actions .btn { width: 100%; justify-content: center; }

.login-foot {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  padding: 16px 30px 0;
  line-height: 1.5;
}

.pw-wrap { position: relative; display: block; }

.pw-wrap input { padding-right: 46px; }

.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.pw-toggle:hover { background: var(--bg); color: var(--navy); }

.login-msg {
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.login-msg.err { background: var(--err-soft); color: var(--err); border-color: #f2bcbc; }
.login-msg.warn { background: var(--warn-soft); color: var(--warn); border-color: #f2d9b0; }
.login-msg.info { background: var(--info-soft); color: var(--info); border-color: #c4d4f7; }

/* ---------------- menu utente ---------------- */

.user-menu { position: relative; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .20);
  color: #fff;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  max-width: 260px;
}

.user-chip:hover { background: rgba(255, 255, 255, .18); }

.user-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .3px;
}

.user-chip .u-txt { min-width: 0; text-align: left; }
.user-chip .u-name { font-size: 13px; font-weight: 700; line-height: 1.15; }

.user-chip .u-role {
  font-size: 10.5px;
  color: #cdd8e6;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.user-chip .u-caret { font-size: 9px; color: #cdd8e6; }

.user-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}

.user-drop .ud-head {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.user-drop .ud-head .n { font-weight: 700; color: var(--navy); }
.user-drop .ud-head .u { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.user-drop button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.user-drop button:hover { background: var(--bg); color: var(--navy); }
/* Voce-collegamento del menu (Fonti di dati e licenze): stesso aspetto dei pulsanti. */
.user-drop a[role="menuitem"] {
  display: flex; align-items: center; gap: 9px; box-sizing: border-box; width: 100%;
  padding: 10px 15px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none;
}
.user-drop a[role="menuitem"]:hover { background: var(--bg); color: var(--navy); }
.user-drop button.danger { color: var(--err); border-top: 1px solid var(--line); }
.user-drop button.danger:hover { background: var(--err-soft); }

/* ---------------- ruoli ---------------- */

.role-admin { background: #ece6fb; color: #5b21b6; }
.role-responsabile { background: var(--gold-soft); color: var(--gold-2); }
.role-genetista { background: var(--info-soft); color: var(--info); }
.role-biologo { background: #dff0e8; color: #0f6b4f; }
.role-direzione { background: var(--navy); color: #fff; }
.role-na { background: #eef1f5; color: #47586b; }

/* ---------------- dashboard ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 17px;
  text-align: left;
  font-family: var(--font);
  position: relative;
  display: block;
  width: 100%;
  transition: border-color .12s, transform .08s, box-shadow .12s;
}

button.kpi { cursor: pointer; }

button.kpi:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.kpi .kpi-val {
  font-size: 27px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.05;
  letter-spacing: -.5px;
}

.kpi .kpi-val .unit { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 3px; }

.kpi .kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: .2px;
}

.kpi .kpi-foot { font-size: 11px; color: var(--gold-2); margin-top: 6px; font-weight: 600; }

.kpi .kpi-bar {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }

@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.card-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.card-head-row h3 { margin: 0; flex: 1; }

/* coda di lavoro personale */
.mycase {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--line);
  padding: 10px 6px;
  cursor: pointer;
  font-family: var(--font);
  border-radius: 6px;
}

.mycase:last-child { border-bottom: none; }
.mycase:hover { background: #f7f9fc; }

.mycase .mc-ref { font-family: var(--mono); font-weight: 700; color: var(--navy); font-size: 12.5px; }
.mycase .mc-q { color: var(--muted); font-size: 12px; }
.mycase .mc-main { min-width: 0; flex: 1; }
.mycase .mc-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* attività recente */
.feed { list-style: none; margin: 0; padding: 0; }

.feed li {
  display: flex;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  align-items: flex-start;
}

.feed li:last-child { border-bottom: none; }

.feed .f-ico {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.feed .f-main { flex: 1; min-width: 0; font-size: 12.5px; }
.feed .f-who { font-weight: 700; color: var(--navy); }
.feed .f-when { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* stato del sistema */
.sys-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}

.sys-row:last-child { border-bottom: none; }
.sys-row .s-name { font-weight: 700; color: var(--navy); min-width: 130px; font-size: 13px; }
.sys-row .s-meta { color: var(--muted); font-size: 12px; }
.sys-row .spacer { flex: 1; }

.meter {
  width: 130px;
  height: 8px;
  border-radius: 4px;
  background: #e8edf3;
  overflow: hidden;
}

.meter > i { display: block; height: 100%; background: linear-gradient(90deg, #8fb0d6, var(--navy-3)); }
.meter.warn > i { background: linear-gradient(90deg, #f0c98a, var(--warn)); }
.meter.err > i { background: linear-gradient(90deg, #efa0a0, var(--err)); }

/* grafici SVG generati a mano.
   Il viewBox scala con il contenitore: senza un tetto, su schermi larghi
   le etichette diventerebbero enormi. */
.chart { width: 100%; max-width: 620px; height: auto; display: block; }
.chart.wide { max-width: 820px; }
.chart text { font-family: var(--font); }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart .lbl { font-size: 11px; fill: var(--muted); }
.chart .val { font-size: 11px; fill: var(--navy); font-weight: 700; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------- amministrazione utenti ---------------- */

.user-inactive td { opacity: .55; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------- stati di caricamento ---------------- */

.skel {
  background: linear-gradient(90deg, #eef1f5 25%, #f7f9fc 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: gxskel 1.3s ease-in-out infinite;
  border-radius: 6px;
  height: 13px;
  margin: 9px 0;
}

.skel.w60 { width: 60%; }
.skel.w40 { width: 40%; }
.skel.tall { height: 30px; }

/* ---------------- responsive ---------------- */

@media (max-width: 1100px) {
  .topbar { padding: 12px 18px; }
  .view { padding: 18px 18px 50px; }
  .casebar { padding: 8px 18px; }
  .mainnav a { padding: 7px 10px; font-size: 12.5px; }
}

@media (max-width: 820px) {
  .topbar { gap: 10px; }
  .brand .subtitle { display: none; }
  .mainnav { order: 3; width: 100%; }
  .mainnav a { flex: 1; justify-content: center; }
  .user-chip .u-txt { display: none; }
  .kpi .kpi-val { font-size: 23px; }
  .funnel-row { grid-template-columns: 120px 1fr; }
}

/* ---------------- animazioni ---------------- */

@keyframes gxskel { to { background-position: -400% 0; } }

@keyframes gxspin { to { transform: rotate(360deg); } }

@keyframes gxpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

@keyframes gxslidein {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes gxtoastin {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes gxmodalin {
  from { transform: scale(.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------------- stampa ---------------- */

@media print {
  .topbar, .casebar, .toasts, .referto-toolbar, .filterbar, .sticky-review,
  .user-menu, .mainnav, .login-root { display: none !important; }
}

/* ⭐ Versione in esecuzione, nella testata (richiesta del CIO del 12/09/2026). Discreta ma
   sempre leggibile: serve a riferire ogni esito di prova alla versione che l'ha prodotto. */
.versione-app {
  font-size: 0.62em;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.75;
  margin-left: 0.45em;
  vertical-align: 0.35em;
  white-space: nowrap;
}

/* ⭐ Grafico delle frequenze con le soglie dei criteri (v0.1.123).
   ⛔ I colori vengono dalle variabili del progetto: il grafico deve invecchiare insieme al
   resto dell'interfaccia, non restare l'unico pezzo con la sua tavolozza. */
.freq-chart{ width:100%; height:auto; max-width:100%; display:block; overflow:visible;
  margin:2px 0 4px; }
.freq-chart .fx-ax{ stroke:var(--line); stroke-width:1; }
.freq-chart .fx-grid{ stroke:var(--line); stroke-width:1; opacity:.45; }
.freq-chart .fx-tick,
.freq-chart .fx-name{ fill:var(--muted); font-size:10px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
.freq-chart .fx-note{ fill:var(--muted); font-size:9.5px; }
.freq-chart .fx-bar{ fill:var(--navy); opacity:.82; }
.freq-chart .fx-bar.fx-pop{ fill:var(--gold); opacity:1; }
.freq-chart .fx-val{ fill:var(--ink); font-size:10.5px; font-weight:600;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
/* ⚠️ Tratteggio: una soglia non e' un dato misurato, e non deve sembrarlo. */
.freq-chart .fx-thr{ stroke-dasharray:5 4; stroke-width:1.5; }
.freq-chart .fx-thrlab{ font-size:10.5px; font-weight:700;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }

/* ---------------- PLATINUM (23/09/2026, rilievo del CIO: pannello integrato con il resto) ---------------- */

.platinum-parere { border-top: 3px solid var(--gold); }
.plat-testa { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.plat-testa h3 { margin: 0; font-size: 16px; color: var(--navy); letter-spacing: .4px; }
.plat-info { margin: 4px 0; }
.plat-avvio {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 10px 0 14px;
}
.plat-avvio .field { min-width: 200px; }
.plat-motivo { flex: 1 1 260px; margin: 0; }
.plat-esito { display: flex; flex-direction: column; gap: 12px; }
.plat-colonne { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.plat-col { margin-bottom: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.plat-col-titolo { margin: 0; font-size: 15px; color: var(--navy); }
.plat-riga { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; }
.plat-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.plat-sez { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.plat-sez > summary {
  cursor: pointer; padding: 8px 12px; font-weight: 600; font-size: 13px; color: var(--navy);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.plat-sez > summary::-webkit-details-marker { display: none; }
.plat-sez > summary::before { content: "▸"; color: var(--gold); transition: transform .12s; }
.plat-sez[open] > summary::before { transform: rotate(90deg); }
.plat-sez[open] > summary { border-bottom: 1px solid var(--line); }
.plat-sez-corpo { padding: 10px 12px; overflow-x: auto; }
.plat-prosa { white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; }
.plat-h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.plat-verbale { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.plat-verbale li { padding: 3px 0; border-bottom: 1px dashed #edf1f6; }
.plat-verbale .btn { padding: 2px 6px; text-align: left; white-space: normal; }
.plat-fonte { margin: 6px 0; }
.plat-grezzo {
  background: var(--navy); color: #cdd8e6; border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 11.5px; max-height: 260px; overflow: auto; white-space: pre-wrap;
}
.plat-azioni { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.plat-vuoto { padding: 18px; }
table.gx tr.plat-diverge td { background: var(--warn-soft); }
@media (max-width: 720px) { .plat-colonne { grid-template-columns: 1fr; } }
table.kv td .badge { margin-left: 6px; }
.plat-nota { color: var(--navy-3); font-style: italic; margin: 2px 0 2px 8px; font-size: 12.5px; }
/* ⭐ 23/09/2026: le decisioni di PLATINUM nella sua copia sigillata, dentro il verbale. */
.plat-decisione { margin: 2px 0 2px 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
/* Pagina PLATINUM (25/09/2026): elenco dei casi e collegamento discreto dalla revisione. */
.plat-filtri { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
table.gx.plat-elenco td { vertical-align: top; }
.plat-avvio-riga { white-space: nowrap; }
.plat-avvio-riga select { max-width: 150px; }
.plat-fase { margin: 0; color: var(--navy); }
.plat-collegamento { text-align: right; margin: 0 0 6px; }
@media (max-width: 720px) { .plat-avvio-riga { white-space: normal; } }
.plat-motivazione { flex-basis: 100%; font-size: 12.5px; color: var(--navy-2, #243447); white-space: pre-wrap; }
/* CIO 26/09/2026: «allarga la finestra di platinum in modo che siano visibili tutti i dati e non sia necessario
   scorrere lateralmente». La pagina PLATINUM (elenco e dettaglio) prende tutta la larghezza e le tabelle vanno a capo. */
.view.view-larga { max-width: none; padding-left: 18px; padding-right: 18px; }
.view.view-larga .table-wrap, .view.view-larga .plat-sez-corpo { overflow-x: visible; }
.view.view-larga table.gx { width: 100%; table-layout: auto; }
.view.view-larga table.gx td, .view.view-larga table.gx th { white-space: normal; overflow-wrap: anywhere; }
.view.view-larga .plat-avvio-riga { white-space: normal; }
/* Schermi piccoli: lo scorrimento laterale delle tabelle resta, come prima. */
@media (max-width: 1100px) { .view.view-larga .table-wrap { overflow-x: auto; } .view.view-larga table.gx td, .view.view-larga table.gx th { overflow-wrap: normal; } }

/* CIO 24/09/2026: il link alla dashboard di dialogo con la Genetica, sempre in vista nella testata. */
.link-dialogo { margin-left: auto; margin-right: 16px; padding: 6px 12px; border-radius: 6px; font-weight: 600;
  background: var(--oro, #c9a24a); color: var(--navy, #0b1f3a); text-decoration: none; white-space: nowrap; }
.link-dialogo:hover { filter: brightness(1.08); }
.link-dialogo.spento { background: transparent; color: inherit; opacity: .6; border: 1px dashed currentColor; cursor: help; }

/* P-111 (CIO 23/09/2026): il manuale d'uso integrato (js/manuale.js, testo in manuale/manuale.html). */
.man-pagina { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.man-lato { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.man-cerca span { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.man-cerca input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.man-indice-lista { list-style: none; margin: 8px 0 0; padding: 0; }
.man-indice-lista li { margin: 1px 0; }
.man-indice-lista a { display: block; padding: 3px 6px; border-radius: 5px; text-decoration: none; color: var(--ink); }
.man-indice-lista a:hover { background: var(--bg); }
.man-indice-lista a.attivo { background: var(--gold-soft); color: var(--navy); font-weight: 600; }
.man-indice-h2 > a { font-weight: 600; color: var(--navy); margin-top: 6px; }
.man-indice-h3 > a { padding-left: 16px; font-size: 13px; }
.man-testo { line-height: 1.6; max-width: 980px; }
.man-testo h2 { color: var(--navy); border-bottom: 2px solid var(--gold); padding-bottom: 4px; margin-top: 28px; scroll-margin-top: 12px; }
.man-testo h3 { color: var(--navy-2); margin-top: 20px; scroll-margin-top: 12px; }
.man-testo section:first-child h2 { margin-top: 0; }
.man-testo .ui { font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 5px; white-space: nowrap; }
.man-testo .nota, .man-testo .attenzione, .man-testo .errori { border-left: 4px solid var(--info);
  background: var(--info-soft); padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.man-testo .attenzione { border-left-color: var(--warn); background: var(--warn-soft); }
.man-testo .errori { border-left-color: var(--err); background: var(--err-soft); }
.man-testo table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.man-testo th, .man-testo td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.man-testo th { background: var(--bg); }
.man-testo ol.passi > li { margin-bottom: 6px; }
mark.man-trovato { background: #ffe58a; color: inherit; padding: 0 1px; border-radius: 2px; }
@media (max-width: 900px) {
  .man-pagina { grid-template-columns: 1fr; }
  .man-lato { position: static; max-height: none; }
}
@media print { .man-lato { display: none; } .man-pagina { display: block; } }
