@font-face {
  font-family: "Dazzle Unicase";
  src: url("fonts/DazzleUnicase-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Dazzle Unicase";
  src: url("fonts/DazzleUnicase-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neulis Neue";
  src: url("fonts/NeulisNeue-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Design system — Mentor brand, un solo accento.
   Palette ufficiale: arancio #FF6F3C · blu #032586 · giallo #FFD700
   · nero #1D1D1B · bianco freddo #F5FCFC.
   Regola: superfici neutre, hairline, ombre morbide; l'arancio
   solo per l'azione primaria, verde = successo, rosso = pericolo.
   ============================================================ */
:root {
  --bg: #f4f8fa;
  --card: #ffffff;
  --ink: #0b2461;
  --ink-strong: #032586;
  --muted: #64708c;
  --faint: #939db4;
  --accent: #ff6f3c;
  --accent-hover: #f25a24;
  --accent-soft: #fff1ea;
  --yellow: #ffd700;
  --warn: #9a7400;
  --warn-soft: #fdf7dd;
  --ok: #178a5b;
  --ok-soft: #e9f7f0;
  --bad: #d0453a;
  --bad-soft: #fdefed;
  --hairline: rgba(11, 36, 97, .10);
  --hairline-soft: rgba(11, 36, 97, .06);
  --fill: rgba(11, 36, 97, .05);
  --fill-hover: rgba(11, 36, 97, .09);
  --shadow-1: 0 1px 2px rgba(11, 36, 97, .05);
  --shadow-2: 0 1px 2px rgba(11, 36, 97, .04), 0 10px 30px rgba(11, 36, 97, .06);
  --shadow-3: 0 2px 6px rgba(11, 36, 97, .06), 0 18px 44px rgba(11, 36, 97, .10);
  --maxw: 1400px;
  --radius: 18px;
  --radius-s: 12px;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  font-family: "Neulis Neue", -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

::selection { background: rgba(255, 111, 60, .22); }

/* ---------- navigation ---------- */
/* Solo l'header (figlio diretto di body): un selettore nudo `nav` renderebbe
   sticky/z-index 20 anche i nav interni alle pagine (es. .v2-presets, che
   finiva sopra i dropdown del menù). */
body > nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--hairline-soft);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

nav .nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.4em;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: .2em;
  flex-wrap: nowrap;
}

nav .logo {
  display: inline-flex;
  align-items: center;
  gap: .7em;
  text-decoration: none;
  color: var(--ink-strong);
  margin-right: .9em;
  flex: 0 0 auto;
  white-space: nowrap;
}

nav .logo-mentor { height: 24px; width: auto; display: block; }

nav .logo-divider {
  width: 1px;
  height: 18px;
  background: var(--hairline);
}

nav .logo-wundt {
  font-family: "Dazzle Unicase", "Neulis Neue", sans-serif;
  font-weight: 700;
  letter-spacing: .01em;
  font-size: 1em;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  padding: .45em .8em;
  border-radius: 999px;
  flex: 0 0 auto;
  font-weight: 650;
  font-size: .85em;
  transition: background .18s var(--ease);
}

nav a:hover, nav a.active { background: var(--fill); }

nav .nav-menu { position: relative; flex: 0 0 auto; }

nav .nav-menu summary {
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  padding: .45em .8em;
  border-radius: 999px;
  font-weight: 650;
  font-size: .85em;
  white-space: nowrap;
  transition: background .18s var(--ease);
}

nav .nav-menu summary::-webkit-details-marker { display: none; }
nav .nav-menu summary:after { content: "▾"; margin-left: .35em; font-size: .7em; opacity: .55; }
nav .nav-menu[open] summary,
nav .nav-menu summary:hover { background: var(--fill); }

nav .nav-menu-content {
  position: absolute;
  top: calc(100% + .5em);
  left: 0;
  min-width: 210px;
  display: grid;
  gap: 2px;
  padding: .45em;
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
}

nav .nav-menu-content a,
nav .nav-menu-content button {
  width: 100%;
  text-align: left;
  border-radius: 9px;
  padding: .55em .7em;
  font-size: .86em;
  font-weight: 600;
}

nav .nav-menu-content button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}

nav .nav-menu-content button:hover { background: var(--fill); }

/* Sul desktop il wrapper è trasparente al layout; sotto gli 800px diventa il
   drawer aperto dall'hamburger. */
.nav-links { display: contents; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s var(--ease);
}
.nav-toggle:hover { background: var(--fill-hover); }

nav .right {
  margin-left: auto;
  display: flex;
  gap: .6em;
  align-items: center;
  flex: 0 0 auto;
}

nav .user-chip {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .35em .8em;
  border-radius: 999px;
  background: var(--fill);
  font-size: .8em;
  font-weight: 650;
  color: var(--muted);
}

nav .btn { padding: .42em .85em; font-size: .8em; box-shadow: none; }

/* La ricerca è l'elemento comprimibile del nav: quando le voci sono tante,
   si stringe lei invece di spingere il chip utente ed "Esci" fuori schermo. */
.nav-search { flex: 0 1 auto; min-width: 0; }
.nav-search input[type=search] {
  min-height: 34px;
  padding: .3em .95em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--fill);
  font-size: .85em;
  width: clamp(96px, 13vw, 180px);
  max-width: 100%;
  transition: width .25s var(--ease), background .18s var(--ease);
}
.nav-search input[type=search]:hover { background: var(--fill-hover); }
.nav-search input[type=search]:focus {
  width: 230px;
  background: #fff;
  border-color: var(--hairline);
  outline: none;
  box-shadow: var(--shadow-2);
}

/* ---------- layout & typography ---------- */
main {
  max-width: var(--maxw);
  margin: 1.8em auto;
  padding: 0 1.4em 3.5em;
}

h1 {
  font-family: "Dazzle Unicase", "Neulis Neue", sans-serif;
  font-size: clamp(1.5rem, 1.2rem + .9vw, 2.05rem);
  line-height: 1.12;
  margin: .1em 0 .75em;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: lowercase;
  color: var(--ink-strong);
}

h2 {
  font-size: .82em;
  margin: 1.6em 0 .6em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}

a { color: var(--ink); font-weight: 650; }

.muted { color: var(--muted); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 1.15em;
}

.page-head h1 { margin: 0; }
.page-head .lede {
  margin: .4em 0 0;
  color: var(--muted);
  max-width: 46rem;
  font-size: .95em;
}

.head-side { display: grid; gap: .55em; justify-items: end; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  padding: 1.15em 1.3em;
  margin-bottom: 1.1em;
  box-shadow: var(--shadow-2);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .9em;
}

.stat { text-align: left; padding: 1.05em 1.2em; }

.stat .n {
  font-family: "Dazzle Unicase", "Neulis Neue", sans-serif;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat .l {
  color: var(--muted);
  font-size: .82em;
  margin-top: .4em;
  font-weight: 600;
}

.stat .stat-link { text-decoration: none; display: block; }
.stat .stat-link:hover .n { color: var(--accent); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  color: var(--faint);
  font-size: .7em;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  padding: .7em .6em;
  border-bottom: 1px solid var(--hairline);
}

td {
  padding: .75em .6em;
  border-bottom: 1px solid var(--hairline-soft);
  vertical-align: top;
}

tr:hover td { background: rgba(11, 36, 97, .022); }
tr:last-child td { border-bottom: none; }

/* ---------- pills (stati) ---------- */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: .76em;
  font-weight: 650;
  background: var(--fill);
  color: var(--muted);
  white-space: nowrap;
}

.pill.new,
.pill.test,
.pill.active { background: var(--accent-soft); color: #c14e20; }

.pill.ok,
.pill.live,
.pill.completed,
.pill.client_acquired { background: var(--ok-soft); color: var(--ok); }

.pill.error,
.pill.failed,
.pill.rejected,
.pill.stopped,
.pill.lost,
.pill.client_lost { background: var(--bad-soft); color: var(--bad); }

.pill.unassigned { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--hairline); }

/* Dormiente: né vivo né perso. Blu inchiostro tenue, mai rosso: non è un
   fallimento, è un lead che le automazioni stanno ancora lavorando. */
.pill.dormant { background: rgba(3, 37, 134, .08); color: var(--ink-strong); }

/* Olimpia (agente AI): stesso blu tenue dei dormienti, con la scritta
   in evidenza — la segreteria deve riconoscerlo prima di scrivere. */
.pill.olimpia { background: rgba(3, 37, 134, .08); color: var(--ink-strong); font-weight: 700; }
.olimpia-strip { margin-top: 1em; }

.pill.idle {
  background: transparent;
  color: var(--faint);
  box-shadow: inset 0 0 0 1px var(--hairline);
  text-decoration: line-through;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: .62em 1.2em;
  border-radius: 999px;
  cursor: pointer;
  font-size: .9em;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.15;
  font-family: inherit;
  box-shadow: var(--shadow-1);
  transition: background .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease);
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.97); }
/* Focus visibile da tastiera, sul raggio del controllo (mai outline browser) */
.btn:focus-visible,
a:focus-visible,
summary:focus-visible,
[type=checkbox]:focus-visible,
[type=radio]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(3, 37, 134, .16);
}

.btn.secondary {
  background: var(--fill);
  color: var(--ink);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--fill-hover); }

.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #b83a30; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.btn.ghost:hover { background: var(--fill); }

.btn.full { width: 100%; padding: .72em 1em; margin-top: 1em; text-align: center; }

button:disabled { opacity: .45; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- form controls ---------- */
input[type=text],
input[type=password],
input[type=date],
input[type=number],
input[type=email],
select,
textarea {
  min-width: 0;
  max-width: 100%;
  padding: .6em .8em;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-s);
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

input[type=text],
input[type=password],
input[type=date],
input[type=number],
input[type=email],
select { min-height: 42px; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.1em;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364708c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9em center;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink-strong);
  box-shadow: 0 0 0 3.5px rgba(3, 37, 134, .12);
}

textarea {
  display: block;
  width: 100%;
  min-height: 82px;
  resize: vertical;
  margin: .4em 0 1em;
}

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1em; }
.messages li {
  padding: .7em 1.1em;
  border-radius: var(--radius-s);
  margin-bottom: .55em;
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  box-shadow: var(--shadow-1);
  font-size: .92em;
  font-weight: 600;
}
.messages li.success { color: var(--ok); }
.messages li.error { color: var(--bad); }

details summary { cursor: pointer; color: var(--ink); }

pre {
  background: var(--bg);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-s);
  padding: .8em 1em;
  overflow-x: auto;
  font-size: .85em;
  white-space: pre-wrap;
}

code {
  background: var(--fill);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: .88em;
}

/* ---------- segmented controls (chips/tabs) ---------- */
.filter-chips,
.phase-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--fill);
  border-radius: 999px;
  margin: .85em 0 .2em;
}

.phase-tabs { margin: 0 0 1.15em; }

.filter-chips a,
.phase-tabs a {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .42em .95em;
  border-radius: 999px;
  text-decoration: none;
  font-size: .85em;
  font-weight: 650;
  color: var(--muted);
  transition: color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}

.filter-chips a:hover,
.phase-tabs a:hover { color: var(--ink); }

.filter-chips a.active,
.phase-tabs a.active {
  background: #fff;
  color: var(--ink-strong);
  box-shadow: 0 1px 3px rgba(11, 36, 97, .14);
}

.filter-chips a .count,
.phase-tabs a .count {
  font-size: .82em;
  font-weight: 700;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.filter-chips a.active .count,
.phase-tabs a.active .count { color: var(--accent); }

.chips-label { display: none; }

/* ---------- lead list ---------- */
.filter-card { padding-bottom: 1em; }

.toolbar-form {
  display: flex;
  gap: .6em;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-form label { color: var(--muted); font-weight: 650; font-size: .9em; }

.clear-filters {
  font-size: .85em;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
  padding: .45em .8em;
  border-radius: 999px;
}
.clear-filters:hover { background: var(--fill); color: var(--ink); }

.table-card { padding: .5em 1em 1em; }
.table-scroll { overflow-x: auto; }
.lead-table { min-width: 860px; }
.lead-table th { padding: .8em .55em; white-space: nowrap; }
.lead-table td { padding: .62em .55em; vertical-align: middle; }
.lead-table a { text-decoration: none; }
.lead-table a:hover strong { color: var(--accent); }
.col-check { width: 30px; }
.col-actions { width: 130px; }
.contact-cell { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.lead-name { display: flex; flex-direction: column; gap: .12em; }
.lead-name strong { font-size: 1em; }
.lead-meta { font-size: .8em; color: var(--faint); font-weight: 500; }

.materia-tag {
  display: inline-block;
  max-width: 100%;
  background: var(--fill);
  color: var(--ink);
  border-radius: 7px;
  padding: 2px 8px;
  font-size: .82em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: .3em;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.ra {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--fill);
  text-decoration: none;
  font-size: .9em;
  transition: background .15s var(--ease);
}
.ra:hover { background: var(--fill-hover); }
.ra.open {
  padding: 0 .85em;
  font-size: .8em;
  font-weight: 700;
  color: var(--ink);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
  margin-top: 1em;
}

.pagination { display: flex; align-items: center; gap: .65em; margin-left: auto; }
.pagination a {
  text-decoration: none;
  font-size: .86em;
  font-weight: 700;
  padding: .48em 1em;
  border-radius: 999px;
  color: var(--ink);
  background: var(--fill);
  transition: background .15s var(--ease);
}
.pagination a:hover { background: var(--fill-hover); }
.page-info { color: var(--muted); font-size: .85em; font-weight: 600; font-variant-numeric: tabular-nums; }

.client-check { width: 18px; height: 18px; accent-color: var(--ok); }

/* ---------- statistiche ---------- */
.lead-stats-table td { vertical-align: middle; }
.lead-stats-bar {
  display: flex;
  width: 180px;
  max-width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill);
}
.lead-stats-bar span { display: block; min-width: 0; }
.lead-stats-bar .new, .legend-dot.new { background: var(--yellow); }
.lead-stats-bar .other, .legend-dot.other { background: var(--accent); }
.lead-stats-bar .acquired, .legend-dot.acquired { background: var(--ok); }

.legend-row {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .88em;
  margin-top: -.3em;
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: .35em;
}

.operator-stats-table td { font-variant-numeric: tabular-nums; }
.operator-stats-table td.metric-best { background: var(--ok-soft); color: var(--ok); }
.operator-stats-table td.metric-worst { background: var(--bad-soft); color: var(--bad); }
/* Traduzione "in soldoni" sotto le intestazioni delle statistiche operatrici */
.operator-stats-table .th-plain {
  display: block;
  margin-top: .3em;
  font-weight: 500;
  font-size: .95em;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--muted);
}
.operator-stats-table td.focus-cell { font-size: .85em; white-space: nowrap; }
/* Le 3 card semaforo sopra la tabella: sfondo tenue nel colore dello stato */
.traffic-cards { margin-bottom: 1.1em; }
.traffic-card .traffic-title {
  font-weight: 700;
  font-size: .85em;
  color: var(--ink-strong);
  margin-bottom: .5em;
}
.traffic-ok { background: var(--ok-soft); }
.traffic-ok .n { color: var(--ok); }
.traffic-warn { background: var(--warn-soft); }
.traffic-warn .n { color: var(--warn); }
.traffic-bad { background: var(--bad-soft); }
.traffic-bad .n { color: var(--bad); }
.traffic-na .n { color: var(--muted); }
.activity-bar {
  width: 130px;
  max-width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--fill);
  overflow: hidden;
}
.activity-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink-strong);
  opacity: .75;
}
.totals-row td {
  border-top: 1px solid var(--hairline);
  background: rgba(11, 36, 97, .025);
}

/* ---------- shift board ---------- */
.today-stats {
  font-size: .84em;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
  padding: .42em 1em;
  box-shadow: var(--shadow-1);
  font-variant-numeric: tabular-nums;
}
.today-stats strong { color: var(--ink-strong); }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1em;
  align-items: start;
}

.queue {
  background: var(--fill);
  border-radius: var(--radius);
  padding: .8em;
  display: grid;
  gap: .7em;
}

.queue > header { padding: .15em .35em 0; }

.queue > header h2,
.followup-strip > header h2 {
  margin: 0;
  color: var(--ink-strong);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5em;
}

.queue > header h2 a,
.followup-strip > header h2 a {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}
.queue > header h2 a:hover,
.followup-strip > header h2 a:hover { color: var(--accent); }

.queue > header h2 .count,
.followup-strip > header h2 .count {
  display: inline-flex;
  min-width: 1.5em;
  justify-content: center;
  padding: .1em .5em;
  border-radius: 999px;
  background: rgba(11, 36, 97, .09);
  color: var(--ink);
  font-size: .76em;
  font-variant-numeric: tabular-nums;
}

.queue > header p { margin: .25em 0 0; font-size: .8em; }

.queue-card {
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: 14px;
  padding: .95em 1.05em;
  display: grid;
  gap: .6em;
  box-shadow: var(--shadow-1);
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}

.queue-card:hover {
  box-shadow: var(--shadow-3);
  transform: translateY(-1px);
}

.queue-card.stale { box-shadow: inset 3px 0 0 var(--bad), var(--shadow-1); }
.queue-card.stale:hover { box-shadow: inset 3px 0 0 var(--bad), var(--shadow-3); }

.qc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5em;
}

.qc-name {
  font-weight: 700;
  text-decoration: none;
  font-size: 1.08em;
  line-height: 1.25;
  color: var(--ink-strong);
}
.qc-name:hover { color: var(--accent); }

.stale-badge {
  flex: 0 0 auto;
  font-size: .72em;
  font-weight: 700;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: 999px;
  padding: 2px 9px;
}

.qc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .25em .6em;
  font-size: .86em;
  color: var(--muted);
  font-weight: 500;
}
.qc-meta span:not(:last-child):after { content: "·"; margin-left: .6em; opacity: .45; }

.qc-callback {
  font-size: .86em;
  background: var(--fill);
  border-radius: 9px;
  padding: .45em .75em;
  box-shadow: inset 2px 0 0 var(--yellow);
}

.qc-sub {
  display: flex;
  align-items: center;
  gap: .5em;
  flex-wrap: wrap;
}
.qc-sub .lead-meta { margin-left: auto; font-size: .78em; }

.qc-ad {
  font-size: .76em;
  color: var(--faint);
  background: var(--fill);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.take-btn {
  border: 0;
  background: var(--fill);
  color: var(--ink);
  border-radius: 999px;
  padding: .34em .85em;
  font: inherit;
  font-size: .78em;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.take-btn:hover { background: var(--fill-hover); }

.quick-actions { display: flex; gap: .4em; flex-wrap: wrap; }
.quick-actions a {
  font-size: .84em;
  font-weight: 650;
  padding: .45em .9em;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink);
  text-decoration: none;
  transition: background .15s var(--ease);
}
.quick-actions a:hover { background: var(--fill-hover); }

.qa-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .45em;
}
.qa-buttons form { display: contents; }

/* Le azioni rapide compaiono su decine di card insieme: qualunque colore,
   ripetuto per sei bottoni, diventa un muro e niente spicca più. Bottoni
   quieti neutri (stile "gray button" di macOS); il colore resta solo dove
   è semantico: verde = chiusura positiva, rosso = pericolo. */
.btn.qa {
  width: 100%;
  padding: .62em .8em;
  font-size: .88em;
  box-shadow: none;
  border-radius: var(--radius-s);
  text-align: center;
  background: var(--fill);
  color: var(--ink);
  font-weight: 600;
}
.btn.qa:hover { background: var(--fill-hover); }
.btn.qa.ok { background: var(--ok); color: #fff; box-shadow: none; }
.btn.qa.ok:hover { background: #106e47; }
.btn.qa.danger { background: var(--bad); color: #fff; box-shadow: none; }
.btn.qa.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.btn.qa.ghost:hover { background: var(--fill); }

.qa-lost { grid-column: 1 / -1; }
.qa-lost summary {
  font-size: .84em;
  color: var(--muted);
  padding: .4em 0;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.qa-lost summary::-webkit-details-marker { display: none; }
.qa-lost summary:before { content: "✕ "; font-size: .9em; }
.qa-lost summary:hover { color: var(--ink); }
.qa-lost form { display: flex; gap: .4em; margin-top: .4em; flex-wrap: wrap; }
.qa-lost input[type=text] { flex: 1; min-width: 140px; min-height: 40px; }

.queue-empty {
  margin: 0;
  padding: 1.5em 1em;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius-s);
  color: var(--faint);
  font-size: .9em;
  text-align: center;
  background: transparent;
}

.see-all {
  text-decoration: none;
  font-size: .88em;
  text-align: center;
  padding: .55em;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 650;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.see-all:hover { background: rgba(11, 36, 97, .07); color: var(--ink); }

/* ---------- chiamate di oggi ---------- */
/* Appuntamenti con orario: vivono sopra le code perché non possono aspettare
   il giro normale. Blu inchiostro, non arancio: è un'agenda, non un allarme. */
.calls-today {
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  box-shadow: inset 4px 0 0 var(--ink-strong), var(--shadow-2);
  padding: 1em 1.15em;
  margin-bottom: 1.1em;
}
.calls-today > header h2 { margin: 0; }
.calls-today > header p { margin: .25em 0 .6em; font-size: .82em; }
.calls-list { list-style: none; margin: 0; padding: 0; }
.call-row {
  display: flex;
  align-items: center;
  gap: .8em;
  padding: .5em 0;
  border-top: 1px solid var(--hairline-soft);
}
.call-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05em;
  color: var(--ink-strong);
  min-width: 3.2em;
}
.call-row.missed .call-time { color: var(--bad); }
.call-lead { flex: 1; min-width: 0; }
.call-lead a { text-decoration: none; font-weight: 700; }
.call-lead a:hover { color: var(--accent); }
.call-late {
  margin-left: .6em;
  font-size: .76em;
  font-weight: 700;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: 999px;
  padding: 2px 9px;
}
.call-tel {
  font-size: .84em;
  font-weight: 650;
  padding: .4em .9em;
  border-radius: 999px;
  background: var(--fill);
  text-decoration: none;
  transition: background .15s var(--ease);
}
.call-tel:hover { background: var(--fill-hover); }

/* ultima azione sulla card: chi arriva dopo sa da dove ripartire */
.qc-last {
  font-size: .8em;
  color: var(--muted);
  border-top: 1px dashed var(--hairline);
  padding-top: .5em;
  display: flex;
  justify-content: space-between;
  gap: .6em;
  flex-wrap: wrap;
}
.qc-last .qc-last-who { color: var(--faint); white-space: nowrap; }

.qc-recontacts {
  font-size: .82em;
  color: var(--muted);
  background: var(--fill);
  border-radius: 9px;
  padding: .45em .75em;
  box-shadow: inset 2px 0 0 var(--ink-strong);
}

/* follow-up strip */
.followup-strip {
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  box-shadow: inset 4px 0 0 var(--yellow), var(--shadow-2);
  padding: 1em 1.15em;
  margin-bottom: 1.1em;
}
.followup-strip > header p { margin: .25em 0 .85em; font-size: .82em; }
.followup-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: .8em;
}
.followup-cards .queue-card { background: var(--bg); border-color: transparent; }

/* focused single-phase view */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: .9em;
  align-items: start;
}

/* card tools (nota / richiama) */
.qc-tools {
  display: flex;
  gap: .5em;
  flex-wrap: wrap;
  border-top: 1px solid var(--hairline-soft);
  padding-top: .55em;
  margin-top: .1em;
}
.qc-tools details { flex: 1; min-width: 0; }
.qc-tools summary {
  font-size: .82em;
  color: var(--muted);
  font-weight: 650;
  padding: .32em .6em;
  border-radius: 999px;
  text-align: center;
  list-style: none;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.qc-tools summary::-webkit-details-marker { display: none; }
.qc-tools summary:hover,
.qc-tools details[open] summary { background: var(--fill); color: var(--ink); }
.qc-tools summary:before { content: "＋ "; font-weight: 800; }
.qc-tools form {
  display: flex;
  gap: .4em;
  margin-top: .55em;
  flex-wrap: wrap;
  align-items: center;
}
.qc-tools input[type=text] { flex: 1; min-width: 150px; min-height: 40px; font-size: .92em; }
.qc-tools input[type=datetime-local] { min-height: 40px; font-size: .88em; }
.snooze-form { flex-direction: column; align-items: stretch; }
.snooze-choices, .snooze-custom { display: flex; gap: .4em; flex-wrap: wrap; }

.quick-bar { display: grid; gap: .7em; padding: .9em 1.1em; }
.quick-bar .qc-tools { border-top: 0; padding-top: 0; }

/* ---------- lead detail ---------- */
.lead-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 1.4em;
}
.lead-hero h1 { font-size: 2em; margin: .25em 0 .1em; }
.lead-hero p { margin: .2em 0; }
.back-link { text-decoration: none; font-size: .9em; }

.stage-badge {
  padding: .5em 1em;
  border-radius: 99px;
  font-weight: 700;
  background: var(--fill);
  color: var(--ink);
}
.stage-badge.new { background: var(--accent-soft); color: #c14e20; }
.stage-badge.client_acquired { background: var(--ok-soft); color: var(--ok); }
.stage-badge.client_lost { background: var(--bad-soft); color: var(--bad); }
.stage-badge.dormant { background: rgba(3, 37, 134, .08); color: var(--ink-strong); }

.lead-hero-band {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #032586 0%, #0a37a8 100%);
  color: #fff;
  padding: 1.5em 1.7em 1.35em;
  margin-bottom: 1.1em;
  box-shadow: var(--shadow-3);
}
.hero-mark {
  position: absolute;
  right: -30px;
  top: -38px;
  width: 190px;
  opacity: .1;
  transform: rotate(12deg);
  pointer-events: none;
}
.hero-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
}
.lead-hero-band .back-link { color: rgba(255, 255, 255, .65); text-decoration: none; font-size: .86em; }
.lead-hero-band .back-link:hover { color: #fff; }
.lead-hero-band h1 { color: #fff; margin: .15em 0 .4em; font-size: clamp(1.55rem, 1.25rem + 1vw, 2.2rem); }

.hero-chips { display: flex; flex-wrap: wrap; gap: .45em; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .34em .85em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  font-size: .83em;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s var(--ease);
}
a.hero-chip:hover { background: rgba(255, 255, 255, .26); }
.hero-chip.soft { background: rgba(255, 255, 255, .07); color: rgba(255, 255, 255, .8); }
.hero-chip.warn { background: var(--yellow); color: var(--ink-strong); }

.stage-badge.hero-stage {
  font-size: .95em;
  background: rgba(255, 255, 255, .95);
  color: var(--ink-strong);
  box-shadow: var(--shadow-2);
}

.stage-track {
  position: relative;
  list-style: none;
  display: flex;
  gap: 0;
  margin: 1.4em 0 0;
  padding: 0;
}
.stage-track li {
  flex: 1;
  position: relative;
  text-align: center;
  font-size: .78em;
  font-weight: 650;
  color: rgba(255, 255, 255, .45);
  padding-top: 21px;
}
.stage-track li .dot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  z-index: 1;
}
.stage-track li:not(:first-child):before {
  content: "";
  position: absolute;
  top: 5px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, .16);
}
.stage-track li.done { color: rgba(255, 255, 255, .9); }
.stage-track li.done .dot { background: #fff; }
.stage-track li.done:not(:first-child):before,
.stage-track li.current:not(:first-child):before { background: rgba(255, 255, 255, .85); }
.stage-track li.current { color: #fff; }
.stage-track li.current .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 111, 60, .35);
}
.stage-track.lost li.current .dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(208, 69, 58, .35); }
.stage-track.lost li.current { color: #ffc9c1; }

.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: 1.2em;
  align-items: start;
}

.main-col { min-width: 0; }

.lead-card { padding: 1.3em 1.4em; }
.lead-card h2,
.activity-section h2 {
  margin: 0 0 1em;
  color: var(--ink-strong);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.08em;
  font-weight: 700;
}

.notes-card, .activity-card { border-left: 0; }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.contact-grid a { font-size: 1.04em; text-decoration: none; }

.field-label, .reason-label {
  display: block;
  color: var(--muted);
  font-size: .8em;
  font-weight: 650;
  margin-bottom: .35em;
}
.reason-label { margin-top: 1.1em; color: var(--ink); }

.note-box {
  margin-top: 1.2em;
  background: var(--bg);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-s);
  padding: .85em 1.05em;
  box-shadow: inset 3px 0 0 var(--yellow);
}
.notes-card .note-box { margin-top: 0; }
.notes-card h2 { margin-bottom: .6em; }

.friendly-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1em;
}
.friendly-field > label { display: block; font-weight: 600; margin-bottom: .35em; }
.friendly-field input:not([type=checkbox]),
.friendly-field select { width: 100%; }

.form-actions {
  display: flex;
  align-items: center;
  gap: .85em;
  flex-wrap: wrap;
  margin-top: 1em;
}
.form-actions .muted { min-width: 0; }
.lead-layout aside .friendly-fields { grid-template-columns: 1fr; }
.lead-layout aside .friendly-field + .btn.full,
.lead-layout aside .friendly-fields + .btn.full,
.lead-layout aside .stage-options + .reason-label,
.lead-layout aside .automation-options + .reason-label { margin-top: 1em; }

.choice-list { display: flex; flex-wrap: wrap; gap: .6em 1em; padding: .5em 0; }

.stage-options { display: grid; gap: .45em; }
/* Nella colonna principale (larga) le fasi stanno su più colonne:
   13 righe impilate erano il grosso dello spreco verticale della scheda. */
.main-col .stage-options {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.stage-option {
  display: flex;
  align-items: center;
  gap: .65em;
  border: 1px solid var(--hairline-soft);
  padding: .7em .8em;
  border-radius: var(--radius-s);
  cursor: pointer;
  background: #fff;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.stage-option:hover { background: var(--bg); }
.stage-option.current { border-color: var(--ink-strong); background: var(--bg); }
.stage-option input { margin: 0; accent-color: var(--ink-strong); }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.stage-dot.new { background: var(--accent); }
.stage-dot.client_acquired { background: var(--ok); }
.stage-dot.client_lost { background: var(--bad); }
.stage-dot.dormant { background: var(--ink-strong); }

/* opt-out: la scelta più delicata del pannello, spiegata sul posto */
.optout-row {
  display: flex;
  gap: .7em;
  align-items: flex-start;
  margin: .9em 0 .2em;
  padding: .8em .9em;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-s);
  font-size: .9em;
  cursor: pointer;
}
.optout-row input[type=checkbox] { margin-top: .25em; width: 16px; height: 16px; accent-color: var(--bad); }
.optout-row .muted { font-size: .92em; }

.field-hint { margin: .35em 0 0; font-size: .8em; color: var(--faint); }

.hero-chip.optout { background: var(--bad-soft); color: var(--bad); font-weight: 700; }

.automation-options { display: grid; gap: .55em; }
.automation-option {
  display: flex;
  align-items: center;
  gap: .7em;
  padding: .8em .9em;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-s);
  cursor: pointer;
  background: #fff;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.automation-option:hover { border-color: var(--ink-strong); background: var(--bg); }
.automation-option input { margin: 0; }
.automation-option span { font-weight: 600; }

/* timeline */
.activity-section { margin-top: 2em; max-width: 850px; }
.activity-section > p { margin-top: -.6em; }

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
}
.activity-head h2 { margin: 0; display: flex; align-items: center; gap: .5em; }
.activity-head h2 .count {
  display: inline-flex;
  min-width: 1.6em;
  justify-content: center;
  padding: .08em .5em;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  font-size: .72em;
  font-variant-numeric: tabular-nums;
}

.tl-filters { display: inline-flex; gap: 2px; flex-wrap: wrap; padding: 3px; background: var(--fill); border-radius: 999px; }
.tl-filter {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .8em;
  font-weight: 650;
  padding: .35em .85em;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.tl-filter:hover { color: var(--ink); }
.tl-filter.active { background: #fff; color: var(--ink-strong); box-shadow: 0 1px 3px rgba(11, 36, 97, .14); }

.timeline { position: relative; margin-top: 1.2em; }
.timeline:before {
  content: "";
  position: absolute;
  left: 16px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--hairline);
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: .85em;
  margin-bottom: .8em;
}
.timeline-marker {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin-top: .8em;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: #fff;
  font-size: 14px;
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline-marker:before { content: "•"; color: var(--muted); }
.tl-note .timeline-marker:before { content: "📝"; }
.tl-snoozed .timeline-marker:before { content: "⏰"; }
.tl-call .timeline-marker:before { content: "📞"; }
.tl-status_change .timeline-marker:before,
.tl-system_status_change .timeline-marker:before { content: "🔁"; }
.tl-assigned .timeline-marker:before { content: "👤"; }
.tl-email_event .timeline-marker:before { content: "✉️"; }
.tl-automation_started .timeline-marker:before,
.tl-automation_stopped .timeline-marker:before { content: "⚙️"; }
.tl-imported .timeline-marker:before { content: "📥"; }
.tl-interest_changed .timeline-marker:before { content: "⭐"; }
.tl-details_updated .timeline-marker:before { content: "✏️"; }

.timeline-content {
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-s);
  padding: .85em 1.1em;
  box-shadow: var(--shadow-1);
}
.tl-note .timeline-content { box-shadow: inset 3px 0 0 var(--yellow), var(--shadow-1); }
.tl-call .timeline-content { box-shadow: inset 3px 0 0 var(--ok), var(--shadow-1); }
/* Messaggi WhatsApp scritti DA NOI dall'app (echo Coexistence): accento a
   destra, verde WhatsApp, per distinguerli a colpo d'occhio dai ricevuti. */
.tl-wa_outbound .timeline-marker:before { content: "📤"; }
.tl-wa_outbound .timeline-content { box-shadow: inset -3px 0 0 var(--ok), var(--shadow-1); }
.tl-outbound-body { background: #e7f8ef; }
.tl-estimated { font-style: italic; font-weight: 400; color: var(--faint); }

.timeline-heading { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; }
.timeline-heading strong { font-size: .95em; }
.tl-meta { display: inline-flex; align-items: center; gap: .6em; flex: 0 0 auto; }
.tl-actor {
  font-size: .76em;
  font-weight: 650;
  color: var(--muted);
  background: var(--fill);
  border-radius: 999px;
  padding: 2px 9px;
}
.timeline-heading time { color: var(--faint); font-size: .8em; white-space: nowrap; }
.timeline-content p { margin: .55em 0 0; }
.timeline-content blockquote {
  margin: .6em 0 0;
  padding: .6em .9em;
  border-left: 2px solid var(--hairline);
  background: var(--bg);
  color: var(--muted);
  border-radius: 0 8px 8px 0;
}
.tl-note-body {
  margin-top: .55em;
  padding: .65em .9em;
  background: var(--bg);
  border-radius: 8px;
  white-space: normal;
}
.stage-change { display: flex; align-items: center; gap: .4em; flex-wrap: wrap; }

.empty-state {
  margin-left: 2.2em;
  padding: 1.2em;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius-s);
  color: var(--faint);
}

.contact-display { display: grid; gap: .35em; }
.contact-line {
  display: flex;
  align-items: baseline;
  gap: .7em;
  padding: .42em 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.contact-line:last-child { border-bottom: 0; }
.contact-line a { text-decoration: none; word-break: break-all; }
.cl-label {
  flex: 0 0 74px;
  color: var(--faint);
  font-size: .76em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.edit-toggle { margin-top: .8em; }
.edit-toggle > summary {
  font-size: .84em;
  font-weight: 650;
  color: var(--muted);
  padding: .45em .8em;
  background: var(--fill);
  border-radius: 999px;
  text-align: center;
  list-style: none;
  transition: background .15s var(--ease);
}
.edit-toggle > summary::-webkit-details-marker { display: none; }
.edit-toggle > summary:before { content: "✏️ "; }
.edit-toggle[open] > summary,
.edit-toggle > summary:hover { background: var(--fill-hover); color: var(--ink); }
.edit-toggle form { margin-top: .9em; }

.var-pills { display: flex; flex-wrap: wrap; gap: .45em; }
.var-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg);
  border-radius: 10px;
  padding: .45em .8em;
  font-weight: 600;
  font-size: .9em;
}
.var-pill .vp-label {
  font-size: .7em;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
}
.attribution-pills .var-pill { overflow-wrap: anywhere; }
.attribution-origin {
  display: flex;
  flex-direction: column;
  gap: .2em;
  margin: .8em 0 0;
  overflow-wrap: anywhere;
}
.attribution-origin .vp-label {
  color: var(--faint);
  font-size: .7em;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.technical-section { margin: 1.2em 0; color: var(--muted); }
.technical-section > summary { display: inline-block; }
.technical-section > .card { margin-top: .7em; color: var(--ink); }

.run-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  padding: .7em 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.run-row:last-child { border-bottom: 0; }
.run-row form { display: flex; gap: .5em; }

/* ---------- login ---------- */
.auth-page { background: var(--bg); }
.auth-page main {
  max-width: 980px;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 2em 1.4em;
}
.login-shell {
  width: min(100%, 900px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 400px;
  gap: 2em;
  align-items: center;
}
.login-brand .brand-lockup {
  display: flex;
  align-items: center;
  gap: .85em;
  margin-bottom: 1.1em;
}
.login-brand .brand-lockup img { height: 34px; width: auto; }
.login-brand .brand-lockup .logo-divider {
  width: 1px;
  height: 22px;
  background: var(--hairline);
}
.login-brand .brand-lockup .logo-wundt {
  font-family: "Dazzle Unicase", "Neulis Neue", sans-serif;
  font-weight: 700;
  font-size: 1.3em;
  color: var(--ink-strong);
}
.login-brand h1 {
  margin: 0 0 .45em;
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}
.login-brand p {
  max-width: 34rem;
  margin: .35em 0 1.2em;
  color: var(--muted);
  font-size: 1.05em;
}
.subject-chips { display: flex; flex-wrap: wrap; gap: .5em; }
.subject-chips span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .35em .9em;
  font-weight: 650;
  font-size: .9em;
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  box-shadow: var(--shadow-1);
}
.login-card { width: 100%; margin: 0; padding: 1.6em; box-shadow: var(--shadow-3); }
.login-card h2 {
  margin: .1em 0 1em;
  color: var(--ink-strong);
  text-transform: none;
  font-size: 1.15em;
  letter-spacing: 0;
}
.login-card label {
  display: block;
  font-size: .84em;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: .35em;
}
.login-card input { width: 100%; }
.login-card .btn { width: 100%; padding: .78em 1em; }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  /* Prima che il nav ammucchi la zona destra: via il chip col nome (il menu
     resta), la ricerca si stringe al minimo. */
  nav .user-chip { display: none; }
  .nav-search input[type=search] { width: 110px; }
}
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .lead-layout { grid-template-columns: 1fr; }
  .stage-track li { font-size: .66em; }
  .hero-mark { display: none; }
  .activity-head { flex-direction: column; align-items: flex-start; }
  .friendly-fields,
  .contact-grid { grid-template-columns: 1fr; }
  .lead-hero { align-items: flex-start; }
  .card { overflow-x: auto; }
  nav .nav-inner { min-height: 56px; }
  nav .logo-mentor { height: 21px; }
  nav .user-chip { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; }
  nav.open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: .6em .9em 1em;
    background: var(--card);
    border-bottom: 1px solid var(--hairline-soft);
    box-shadow: var(--shadow-3);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
  }
  nav.open .nav-links > a,
  nav.open .nav-links .nav-menu summary {
    padding: .7em .8em;
    font-size: .95em;
    border-radius: 10px;
  }
  nav.open .nav-links .nav-menu[open] summary { background: var(--fill); }
  nav.open .nav-links .nav-menu-content {
    position: static;
    min-width: 0;
    padding: .15em 0 .4em .9em;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .run-row,
  .timeline-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .login-shell { grid-template-columns: 1fr; gap: 1.2em; }
}

@media (max-width: 640px) {
  .board { grid-template-columns: 1fr; }
  .nav-search { display: none; }
  .head-side { justify-items: start; }
  .focus-grid { grid-template-columns: 1fr; }
}

/* ---------- performance panel ---------- */
.perf-filters { flex-wrap: wrap; }
.perf-filters .perf-range {
  margin-left: auto;
  font-size: .88em;
  font-variant-numeric: tabular-nums;
}
.perf-hint { margin: .7em 0 0; font-size: .84em; }

.perf-kpis { margin: 1em 0; }
.perf-kpis .stat .l .muted { font-weight: 500; }
.perf-good { color: var(--ok); }
.perf-bad { color: var(--bad); }

.notice-line {
  margin: 0 0 1em;
  padding: .7em 1em;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: .88em;
}

/* The legend explains the page, it does not warn about it: quieter than the
   accent-tinted notices it sits next to. */
.perf-legend {
  background: var(--hairline-soft);
  color: var(--muted);
}
.perf-legend strong { color: var(--ink); }

.chart-card { margin-bottom: 1em; }
.chart-head h2 {
  margin: 0 0 .2em;
  font-size: 1.05em;
  color: var(--ink-strong);
}
.chart-head p { margin: 0 0 1em; font-size: .87em; line-height: 1.5; }

.chart-legend {
  display: flex;
  gap: 1.1em;
  flex-wrap: wrap;
  margin-bottom: .6em;
  color: var(--muted);
  font-size: .86em;
}
.chart-legend span { display: inline-flex; align-items: center; }

.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart .grid { stroke: var(--hairline-soft); stroke-width: 1; }
.chart .grid.axis { stroke: var(--hairline); }
.chart .tick {
  fill: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .tick[dx] { text-anchor: end; }
.chart .col-hit { fill: transparent; }
.chart .col:hover .col-hit { fill: var(--hairline-soft); }
.chart .col path { transition: opacity .12s var(--ease); }
.chart .col:hover path { opacity: .78; }

.chart .rate-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 2px surface ring so overlapping dots stay separable */
.chart .rate-dot {
  fill: var(--accent);
  stroke: var(--card);
  stroke-width: 2;
}
.chart .rate-dot:hover { r: 6; }

.chart-empty {
  margin: 0;
  padding: 2.2em 0;
  text-align: center;
  color: var(--muted);
}

.perf-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1em;
  align-items: start;
}
.perf-table-scroll { max-height: 320px; overflow: auto; }
.perf-table { min-width: 520px; font-size: .9em; }
.perf-table td { font-variant-numeric: tabular-nums; }

.funnel { display: grid; gap: .55em; }
.funnel-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 92px;
  align-items: center;
  gap: .8em;
}
.funnel-label { font-size: .88em; color: var(--ink); font-weight: 600; }
.funnel-track {
  height: 22px;
  border-radius: 6px;
  background: var(--fill);
  overflow: hidden;
}
.funnel-track span {
  display: block;
  height: 100%;
  border-radius: 0 6px 6px 0;
  min-width: 2px;
}
.funnel-value {
  text-align: right;
  font-size: .88em;
  font-variant-numeric: tabular-nums;
}

.perf-operators .sparkline { fill: var(--ink-strong); display: block; }
.perf-tag { font-size: .8em; }
.perf-badge {
  display: inline-block;
  margin-left: .35em;
  padding: .12em .5em;
  border-radius: 999px;
  font-size: .72em;
  font-weight: 700;
  white-space: nowrap;
}
.perf-badge.work { background: var(--accent-soft); color: var(--accent-hover); }
.perf-badge.close { background: var(--ok-soft); color: var(--ok); }
.perf-empty-row { padding: 1.6em; text-align: center; }
.perf-note { margin: .9em 0 0; font-size: .85em; line-height: 1.55; }
.perf-footer { margin: 1.2em 0 0; font-size: .88em; }

@media (max-width: 900px) {
  .perf-split { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 120px minmax(0, 1fr) 84px; }
  .perf-filters .perf-range { margin-left: 0; }
}

/* ---------- performance: value labels, details, untracked marker ---------- */
.chart .value { font-variant-numeric: tabular-nums; }
.chart .col:hover .value { fill: var(--accent-hover); }

.perf-details { margin-top: 1.1em; }
.perf-details > summary {
  cursor: pointer;
  padding: .55em .85em;
  border-radius: var(--radius-s);
  background: var(--fill);
  color: var(--ink);
  font-size: .88em;
  font-weight: 650;
  list-style: none;
}
.perf-details > summary::-webkit-details-marker { display: none; }
.perf-details > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.perf-details[open] > summary::before { content: "▾ "; }
.perf-details > summary:hover { background: var(--fill-hover); }
.perf-details .table-scroll { margin-top: .8em; }

.perf-untracked {
  border-bottom: 1px dotted var(--faint);
  cursor: help;
  font-style: italic;
}

.chart-warning {
  margin: -.4em 0 1em;
  padding: .65em .9em;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: .85em;
  line-height: 1.5;
}

/* ---------- radar "Da non perdere" ---------- */
.radar { margin: 0 0 1.2em; }
.radar-head {
  display: flex;
  align-items: baseline;
  gap: .8em;
  margin-bottom: .55em;
}
.radar-head h2 {
  margin: 0;
  font-size: 1.02em;
  color: var(--ink-strong);
}
.radar-head .muted { font-size: .85em; }

.radar-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: .7em;
}
.radar-tile {
  display: flex;
  flex-direction: column;
  gap: .18em;
  padding: .8em .95em;
  border-radius: var(--radius-s);
  background: var(--card);
  border: 1px solid var(--hairline-soft);
  text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.radar-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }

/* Numero grande: cifre proporzionali (tabular allarga il '1' a display size) */
.radar-n {
  font-size: 1.55em;
  font-weight: 750;
  line-height: 1;
  color: var(--ink-strong);
}
.radar-l {
  font-size: .78em;
  font-weight: 640;
  color: var(--muted);
  line-height: 1.3;
}
/* Stato: mai solo colore — il tile in allerta ha anche il pallino. */
.radar-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  margin-right: .4em;
  vertical-align: 1px;
}
.radar-tile.alert { border-color: rgba(208, 69, 58, .35); }
.radar-tile.alert .radar-n { color: var(--bad); }
.radar-tile.calm { background: transparent; }
.radar-tile.calm .radar-n { color: var(--faint); font-weight: 650; }

/* Banner del filtro rischio attivo nella lista lead */
.risk-banner {
  display: flex;
  align-items: center;
  gap: .7em;
  margin: 0 0 1em;
  padding: .6em 1em;
  border-radius: var(--radius-s);
  border-left: 3px solid var(--bad);
  background: var(--bad-soft);
  color: var(--ink);
  font-size: .9em;
}
.risk-banner a { color: var(--accent-hover); font-weight: 650; }
