/* ==========================================================================
   Piattaforma segnalatori
   ========================================================================== */

:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1b2330;
  --ink-2: #3a4553;
  --muted: #646f7d;
  --line: #e4e0d6;
  --line-strong: #cdc7b9;

  --brand: #26374b;
  --brand-hover: #1e2c3d;
  --brand-dark: #172230;
  --brand-soft: #e6eaf0;
  --gold: #f6d48a;

  --gain: #26374b;
  --gain-soft: #e6eaf0;
  --info: #1d5b9f;
  --info-soft: #e6eef9;
  --violet: #5a3ea3;
  --violet-soft: #efe9fa;
  --warn: #8a5300;
  --warn-soft: #fcf0d9;
  --danger: #b3261e;
  --danger-soft: #fbe7e5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(18 26 38 / 6%), 0 6px 20px rgb(18 26 38 / 5%);
  --focus: 0 0 0 3px rgb(38 55 75 / 22%);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 2px; }
code {
  font: 600 0.95em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.strong { font-weight: 650; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--warn); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 56px; }

/* ---------- Barra superiore ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgb(0 0 0 / 8%);
  /* App aperta dalla schermata Home dell'iPhone: la barra scorre sotto l'ora e la batteria */
  padding-top: env(safe-area-inset-top);
}
.ambiente ~ .topbar { padding-top: 0; }
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}
.brand-logo { display: block; flex: none; width: auto; height: 36px; }
.user-menu { display: flex; align-items: center; gap: 12px; flex: none; }
.user-name { display: none; font-size: 0.9rem; color: rgb(255 255 255 / 75%); }
@media (min-width: 640px) { .user-name { display: inline; } }

.tabs {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 12px 11px;
  border-bottom: 3px solid transparent;
  color: rgb(255 255 255 / 72%);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--gold); }

/* ---------- Pulsanti ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--brand-soft); color: var(--brand); }
.btn-secondary:hover { background: #d5dce6; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-on-dark { background: transparent; border-color: rgb(255 255 255 / 35%); color: #fff; }
.btn-on-dark:hover { background: rgb(255 255 255 / 10%); }
.btn-sm { padding: 6px 12px; font-size: 0.875rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------- Card, intestazioni, sezioni ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 640px) { .card { padding: 24px; } }
.card-title { font-size: 1.05rem; margin-bottom: 16px; }
.subtitle { font-size: 0.95rem; margin: 20px 0 8px; }

.page-head { display: grid; gap: 6px; margin-bottom: 24px; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-head-row > div { display: grid; gap: 6px; }
.titolo-con-azione { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-esci { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.lead { color: var(--muted); font-size: 1.05rem; }
.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.back { display: inline-block; margin-bottom: 14px; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.empty .muted { max-width: 48ch; }

.callout {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.card .callout { margin-top: 16px; }
.narrow { max-width: 680px; }

/* ---------- Messaggi ---------- */

.alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-ok { background: var(--gain-soft); border-color: #c5cfdc; color: #1e2c3d; }
.alert-errore { background: var(--danger-soft); border-color: #f1c3be; color: #8c1d17; }
.alert-avviso { background: var(--warn-soft); border-color: #efd5a3; color: #6b4100; }
.form .alert { margin-bottom: 0; }

.credenziali { display: grid; gap: 10px; }
.credenziali .dl { margin-top: 4px; }
.credenziali .dl dt { color: inherit; opacity: 0.8; }

/* ---------- Form ---------- */

.form { display: grid; gap: 18px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.grid-2 { display: grid; gap: 18px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: 1 / -1; }
}

fieldset.card { margin: 0 0 16px; min-width: 0; }
legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 18px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
}
legend + * { clear: both; }
.step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 750;
}

.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-label { font-size: 0.925rem; font-weight: 600; color: var(--ink-2); }
.field-label em { font-style: normal; color: var(--danger); }
.hint { font-size: 0.85rem; color: var(--muted); }
.error { font-size: 0.85rem; font-weight: 600; color: var(--danger); }

input:not([type="checkbox"]):not([type="hidden"]),
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* evita lo zoom automatico su iPhone */
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 100px; resize: vertical; }
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2365706c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
::placeholder { color: #9aa3ae; }

.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }

.input-group { display: flex; }
.input-prefix {
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 650;
}
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group:focus-within .input-prefix { border-color: var(--brand); }
.has-error .input-prefix { border-color: var(--danger); }

.field-valore input { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.check input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
.check.has-error { border-color: var(--danger); }
.check + .error { display: block; margin-top: 6px; }

/* ---------- Pagina "Nuova segnalazione" ---------- */

.layout-segnala, .layout-detail { display: grid; gap: 16px; }
.layout-detail .col-main { display: grid; gap: 16px; align-content: start; }

@media (min-width: 900px) {
  .layout-segnala, .layout-detail {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 24px;
  }
  .layout-segnala .col-main { grid-column: 1; grid-row: 1; }
  .layout-segnala .col-side { grid-column: 2; grid-row: 1; position: sticky; top: 124px; }
  .sticky { position: sticky; top: 124px; }
  .layout-segnala .form-actions .btn { min-width: 260px; }
}
@media (max-width: 899px) {
  .layout-segnala .form-actions .btn { width: 100%; }
}

.card-gain {
  border: 0;
  background: radial-gradient(120% 120% at 100% 0%, #3a5577 0%, var(--brand) 45%, var(--brand-dark) 100%);
  color: #fff;
}
.card-gain .eyebrow { color: rgb(255 255 255 / 72%); }
.gain-amount {
  display: block;
  margin: 8px 0 2px;
  color: var(--gold);
  font-size: clamp(2.4rem, 1.9rem + 2vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.gain-amount.is-vuoto { opacity: 0.35; }
.gain-note { color: rgb(255 255 255 / 78%); font-size: 0.925rem; }
.gain-rule {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 16%);
  font-size: 0.95rem;
}
.gain-rule strong { color: var(--gold); }
.gain-examples { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 0.9rem; }
.gain-examples caption {
  padding-bottom: 4px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 60%);
}
.gain-examples td { padding: 7px 0; border-top: 1px solid rgb(255 255 255 / 10%); color: rgb(255 255 255 / 85%); }
.gain-examples td:last-child { text-align: right; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

.gain-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--gain-soft);
  color: var(--gain);
  font-weight: 600;
}
.gain-inline strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ---------- Portafoglio ---------- */

.wallet, .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wallet-card { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .wallet { grid-template-columns: 1.5fr 1fr 1fr; }
  .wallet-card { grid-column: auto; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
.stats { margin-bottom: 24px; }

.wallet-card {
  padding: 22px 24px;
  border-radius: var(--radius);
  background: radial-gradient(120% 140% at 100% 0%, #3a5577 0%, var(--brand) 45%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.wallet-card .eyebrow { color: rgb(255 255 255 / 72%); }
.wallet-total {
  display: block;
  margin: 6px 0 18px;
  color: var(--gold);
  font-size: clamp(2.2rem, 1.8rem + 1.6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.wallet-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgb(255 255 255 / 16%);
}
.wallet-split span { display: block; font-size: 0.8rem; color: rgb(255 255 255 / 70%); }
.wallet-split strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.stat-card {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat-card strong { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted); }
.stat-warn strong { color: var(--warn); }

.lead-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.lead-item { display: grid; gap: 16px; }
.lead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lead-who { display: grid; gap: 2px; min-width: 0; }
.lead-top h3 { font-size: 1.05rem; }
.lead-bottom { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 12px; }
.lead-gain { display: grid; text-align: right; }
.lead-gain small { font-size: 0.8rem; color: var(--muted); }
.lead-gain strong { font-size: 1.25rem; color: var(--gain); font-variant-numeric: tabular-nums; }
.lead-gain.is-void strong { color: var(--muted); text-decoration: line-through; }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; gap: 6px; min-width: 0; font-size: 0.75rem; color: var(--muted); }
.steps li::before { content: ""; height: 6px; border-radius: 999px; background: var(--line); }
.steps li.done::before { background: var(--brand); }
.steps li.current::before { background: var(--gold); box-shadow: inset 0 0 0 1px #d8ae52; }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badge di stato ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-lg { padding: 6px 14px; font-size: 0.9rem; }
.badge-neutro { background: #ecebe5; color: #4b5462; }
.badge-info   { background: var(--info-soft); color: var(--info); }
.badge-viola  { background: var(--violet-soft); color: var(--violet); }
.badge-ok     { background: var(--warn-soft); color: var(--warn); }
.badge-pagato { background: var(--gain); color: #fff; }
.badge-ko     { background: var(--danger-soft); color: var(--danger); }

/* ---------- Area agente ---------- */

.filters { display: grid; gap: 12px; margin-bottom: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); }
.chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.active span { color: rgb(255 255 255 / 75%); }
.search { display: flex; flex-wrap: wrap; gap: 8px; }
.search input { flex: 1 1 220px; min-width: 0; }
.search select { flex: 0 1 260px; width: auto; min-width: 0; }
@media (max-width: 560px) { .search select { flex: 1 1 100%; } }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a.strong { text-decoration: none; }
.table a.strong:hover { text-decoration: underline; }
.table .badge-ko { margin-left: 6px; }
.is-disabled td { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 10px 20px; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  white-space: pre-wrap;
}

/* ---------- Accesso ---------- */

.auth {
  display: grid;
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 220px);
  padding: 12px 0 24px;
}
@media (min-width: 900px) {
  .auth { grid-template-columns: 1fr 420px; gap: 64px; }
}
.auth-single { grid-template-columns: 1fr !important; justify-items: center; }
.auth-intro { display: grid; gap: 14px; max-width: 54ch; }
.auth-logo {
  display: block;
  width: clamp(150px, 42vw, 220px);
  height: auto;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgb(38 55 75 / 22%);
}
.auth-intro h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }
.auth-card { display: grid; gap: 18px; width: 100%; max-width: 440px; }

/* ---------- Piè di pagina ---------- */

.footer { padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

/* Modulo "Nuovo segnalatore" */
.form-nuovo-head { display: grid; gap: 4px; }
.form-nuovo-head .card-title { margin: 0; }
.grid-4 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ==========================================================================
   Avanzamento, aggiornamenti e notifiche
   ========================================================================== */

.mt { margin-top: 14px; }
.mt-xs { margin-top: 4px; }
.text-danger { color: var(--danger); }
.link-quiet { color: inherit; text-decoration: none; }
.link-quiet:hover { text-decoration: underline; }

.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 16px; }
.card-head .card-title { margin: 0; }

.btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.btn-danger { color: var(--danger); border-color: #efc3bf; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* Contatore notifiche */
.tab-badge, .badge-new {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d93a2b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1;
  vertical-align: 2px;
}
.badge-new { height: 18px; font-size: 0.68rem; letter-spacing: 0.02em; }
.tab-badge { margin-left: 4px; }

/* Linea del tempo (tappe) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 14px;
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 32px;
  bottom: 2px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.timeline > li:last-child::before { display: none; }
.timeline > li.is-done::before { background: var(--brand); }
.timeline > li.is-current::before { background: var(--line); }

.dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
}
.is-done > .dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.is-current > .dot { box-shadow: 0 0 0 4px rgb(246 212 138 / 55%); }
.is-next > .dot { border-color: var(--brand); }

.dot-button { cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.dot-button:hover:not(:disabled), .dot-button:focus-visible { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); outline: none; }
.dot-button:disabled { cursor: not-allowed; opacity: 0.5; }

.timeline-body { min-width: 0; padding-top: 4px; }
.timeline-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-height: 22px; }
.timeline > li:not(.is-done) .timeline-body strong { color: var(--muted); font-weight: 550; }
.timeline > li.is-next .timeline-body strong { color: var(--ink); font-weight: 650; }
.checklist > li.is-next .timeline-row { margin-top: -4px; }
.timeline.is-closed > li .timeline-body strong { color: var(--muted); }
.timeline.is-closed > li.is-done > .dot { background: var(--muted); border-color: var(--muted); }
.timeline.is-closed > li.is-done::before { background: var(--line-strong); }

.rogito { margin-top: 10px; }
.messaggio-box { display: grid; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.check-inline { display: flex; align-items: center; gap: 10px; font-size: 0.925rem; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }

/* Storico aggiornamenti */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: grid; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { padding-top: 0; border-top: 0; }
.feed-item:last-child { padding-bottom: 0; }
.feed-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.feed-msg {
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  white-space: pre-wrap;
}
.feed-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-ok { color: var(--gain); font-weight: 600; }

.feed-novita { padding: 6px 20px; }
.feed-novita .feed-item { padding: 0; border-color: var(--line); }
.feed-link { display: grid; gap: 4px; padding: 14px 0; color: inherit; text-decoration: none; }
.feed-link:hover strong { text-decoration: underline; }
.novita .section-head h2 { display: flex; align-items: center; gap: 8px; }

/* Card cliccabili nel portafoglio */
.lead-link { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.lead-link:hover { border-color: var(--line-strong); box-shadow: 0 2px 4px rgb(18 26 38 / 8%), 0 10px 28px rgb(18 26 38 / 8%); }
.lead-link.has-news { border-color: #f0b8b2; }

.progress { display: grid; gap: 8px; }
.minibar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.minibar span { height: 6px; border-radius: 999px; background: var(--line); }
.minibar span.on { background: var(--brand); }
.minibar span.last { background: var(--gold); box-shadow: inset 0 0 0 1px #d8ae52; }
.progress.is-closed .minibar span.on, .progress.is-closed .minibar span.last { background: var(--line-strong); box-shadow: none; }
.progress.is-closed p { color: var(--danger); font-weight: 600; }

/* Box compenso nella scheda dell'agente */
.compenso-box { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--gain-soft); }
.compenso-box strong { font-size: 1.6rem; font-weight: 800; color: var(--gain); font-variant-numeric: tabular-nums; }

/* Pagina segnalazione del segnalatore: card del guadagno a destra su desktop, in alto su telefono */
@media (min-width: 900px) {
  .layout-segnalatore .col-main { grid-column: 1; grid-row: 1; }
  .layout-segnalatore .col-side { grid-column: 2; grid-row: 1; position: sticky; top: 124px; }
}
.layout-detail .col-side { display: grid; gap: 16px; align-content: start; }

/* ==========================================================================
   Stima indicativa → guadagno effettivo → compenso definitivo
   ========================================================================== */

.gain-flag {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(246 212 138 / 18%);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 650;
}
.gain-fasi { display: grid; gap: 12px; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid rgb(255 255 255 / 16%); list-style: none; counter-reset: fase; }
.gain-fasi li { position: relative; display: grid; gap: 2px; padding-left: 32px; font-size: 0.875rem; color: rgb(255 255 255 / 70%); counter-increment: fase; }
.gain-fasi li::before {
  content: counter(fase);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 35%);
  font-size: 0.75rem;
  font-weight: 700;
}
.gain-fasi li strong { color: #fff; font-size: 0.9rem; }
.gain-fasi li.is-attiva::before { border-color: var(--gold); background: var(--gold); color: var(--brand-dark); }

.gain-inline small { font-weight: 500; opacity: 0.8; }

.lead-gain.fase-stima strong { color: var(--ink-2); }
.lead-gain-nota { font-size: 0.72rem !important; }

.info-stima {
  margin: -4px 0 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 0.875rem;
}

.timeline-nota { margin-top: 2px; font-size: 0.8rem; color: var(--warn); }
.ricalcolo { font-size: 0.925rem; }
.ricalcolo s { color: var(--muted); }
.ricalcolo strong { color: var(--gain); }

.compenso-box.fase-stima { background: var(--surface-2); border: 1px dashed var(--line-strong); }
.compenso-box.fase-stima strong { color: var(--ink-2); }

/* ==========================================================================
   Modulo privacy: popup, banner, dichiarazioni, verifiche
   ========================================================================== */

.salta { position: absolute; left: -9999px; top: 0; z-index: 100; padding: 10px 14px; background: #fff; color: var(--brand); font-weight: 700; }
.salta:focus { left: 8px; top: 8px; }

.ambiente {
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  background: #fff3cd;
  color: #6b4100;
  border-bottom: 1px solid #efd5a3;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.badge-sm { padding: 1px 8px; font-size: 0.72rem; }
.badge-avviso { background: var(--warn-soft); color: var(--warn); }
.codice { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; }
.hash { font-size: 0.72rem; word-break: break-all; }
.lista-semplice { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.form-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline input:not([type="checkbox"]), .form-inline select { width: auto; min-width: 180px; padding: 7px 10px; font-size: 0.9rem; }
.azioni-riga { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.riquadro { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 10px; margin: 0; }
.riquadro legend { float: none; width: auto; padding: 0 6px; margin: 0; font-size: 0.925rem; }
.radio-gruppo { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.radio-gruppo legend { float: none; margin-bottom: 4px; }
.card-avviso { border-color: #efd5a3; background: #fffaf0; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover { border-color: var(--line-strong); }
.table-compatta td, .table-compatta th { padding: 8px 10px; font-size: 0.85rem; }
.btn-nuova { box-shadow: 0 6px 18px rgb(38 55 75 / 25%); }
.btn-nuova svg { flex: none; }
.narrow-wide { max-width: 920px; }
.legenda p + p { margin-top: 6px; }

/* Documenti */
.documento { display: grid; gap: 14px; }
.documento-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.documento-testo { white-space: pre-wrap; line-height: 1.6; font-size: 0.95rem; }
.testo-documento { font: 0.9rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 420px; }
/* Documenti da accettare: ingombro minimo. Il testo si legge scorrendo nel riquadro
   oppure a pagina intera con "Leggi ↗" */
.form-documenti { gap: 10px; }
.card.doc-accetta { display: grid; gap: 6px; padding: 10px 12px; }
.doc-accetta-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; }
.doc-accetta-head h2 { font-size: 0.85rem; }
.doc-meta { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.doc-meta .badge { font-size: 0.68rem; padding: 1px 7px; }
.doc-scroll {
  max-height: 84px;
  overflow-y: auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  white-space: pre-wrap;
  font-size: 0.7rem;
  line-height: 1.38;
  color: var(--ink-2);
}
.doc-scroll-breve { max-height: 56px; }
.doc-accetta .check { gap: 8px; padding: 6px 10px; font-size: 0.78rem; line-height: 1.35; }
.doc-accetta .check input { width: 18px; height: 18px; margin-top: 0; }
.doc-scroll:focus-visible { outline: none; box-shadow: var(--focus); }
.check-forte { border-color: var(--brand); background: var(--brand-soft); }
.facoltativo { border-style: dashed; }

/* Popup */
body.modale-aperta { overflow: hidden; }
.modale {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(12 19 28 / 35%);
  overflow: hidden;
}
.modale[open] { display: flex; flex-direction: column; }
.modale::backdrop { background: rgb(12 19 28 / 55%); backdrop-filter: blur(2px); }
.modale .modulo-segnalazione { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modale-testa {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modale-testa h2 { font-size: 1.35rem; }
.modale-testa p { margin-top: 4px; }
.modale-chiudi {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.modale-chiudi:hover { background: var(--surface-2); }
.modale-chiudi:focus-visible { outline: none; box-shadow: var(--focus); }
.modale-corpo { display: grid; gap: 18px; padding: 20px 24px; overflow-y: auto; flex: 1; }
.modale .modale-corpo .alert { margin: 0; }
.modale-piede {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modale-promemoria { margin-right: auto; }
.modale-successo { display: grid; justify-items: center; gap: 12px; padding: 40px 28px; text-align: center; }
.modale-successo:focus { outline: none; }
.modale-successo[hidden] { display: none; }
.modulo-pagina { padding: 0; overflow: hidden; }
.modulo-pagina .modale-corpo { overflow: visible; }

@media (max-width: 640px) {
  .modale {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .modale-testa, .modale-corpo, .modale-piede { padding-left: 16px; padding-right: 16px; }
  .modale-piede { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modale-piede .btn { flex: 1; }
  .modale-promemoria { flex-basis: 100%; }
}

.sezione-modulo { border: 0; margin: 0; padding: 0; min-width: 0; }
.telefono-gruppo { display: flex; gap: 8px; }
.telefono-gruppo select { flex: 0 0 auto; width: 132px; }
.telefono-gruppo input { flex: 1; min-width: 0; }

.stima-facoltativa {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface-2);
}
.stima-facoltativa summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.stima-facoltativa summary .muted { font-weight: 500; font-size: 0.85rem; margin-left: 6px; }
.stima-facoltativa[open] summary { margin-bottom: 12px; }

.banner-privacy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid #c9d6e3;
  border-left: 4px solid #3b5f86;
  border-radius: var(--radius-sm);
  background: #f3f6fa;
  color: #1f2d3a;
}
.banner-icona { color: #3b5f86; margin-top: 2px; }
.banner-testo { display: grid; gap: 8px; font-size: 0.925rem; }
.banner-testo h3 { font-size: 1rem; }
.banner-agenzia { padding-top: 4px; }
.banner-azioni { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 2px; }
.link-esterno { font-weight: 600; }

.dichiarazioni { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.dichiarazioni legend { float: none; padding: 0; margin: 0 0 2px; }
.dichiarazioni-titolo { font-size: 1.05rem; font-weight: 750; }
.dichiarazione-blocco { display: grid; gap: 4px; }
.dichiarazione {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 9px 11px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s;
}
.dichiarazione label, .dichiarazione input { cursor: pointer; }
/* Conferma del riquadro «Prima di procedere» */
.dichiarazione-avviso { margin-top: 12px; background: rgb(255 255 255 / 75%); }
/* "Accetta tutto" (modulo di segnalazione e primo accesso) */
.accetta-tutto {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  cursor: pointer;
}
.accetta-tutto input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.accetta-tutto:has(input:checked) { border-style: solid; }
.accetta-tutto:has(input:focus-visible) { box-shadow: var(--focus); }
.dichiarazione:hover { border-color: var(--line-strong); }
.dichiarazione:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.dichiarazione:has(input:focus-visible) { box-shadow: var(--focus); }
.dichiarazione.has-error { border-color: var(--danger); }
.dichiarazione input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); }
.dichiarazione-testo { display: grid; gap: 6px; min-width: 0; font-size: 0.78rem; line-height: 1.45; }
.dichiarazione-testo strong { font-size: 0.9rem; }
.dichiarazione-scroll {
  max-height: 62px;
  overflow-y: auto;
  padding: 5px 8px;
  font-size: 0.7rem;
  line-height: 1.38;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: pre-line;
}
.dichiarazione:has(input:checked) .dichiarazione-scroll { background: rgb(255 255 255 / 65%); }
.dichiarazione-scroll:focus-visible, .doc-scroll:focus-visible { outline: none; box-shadow: var(--focus); }

.btn .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 40%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gira 0.8s linear infinite;
}
.btn.in-corso .spinner { display: inline-block; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.in-corso:disabled { opacity: 0.85; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn .spinner { animation-duration: 2.4s; } }

/* Area segnalatore */
.azioni-richieste ul { margin-top: 6px; }
.azione-richiesta { border-color: #efd5a3; border-width: 2px; margin-bottom: 16px; display: grid; gap: 12px; }
.minibar-10 { grid-template-columns: repeat(10, 1fr); }
.lista-dichiarazioni { display: grid; gap: 12px; padding-left: 18px; }
.lista-dichiarazioni p { margin-top: 4px; font-size: 0.9rem; }
.dettagli summary { cursor: pointer; list-style: none; }
.dettagli summary::-webkit-details-marker { display: none; }
.dettagli summary .card-title { display: inline; }
.dettagli summary::after { content: " ▾"; color: var(--muted); }
.dettagli[open] summary { margin-bottom: 12px; }

/* Area staff */
.notifiche-staff { margin-bottom: 20px; }
.lista-notifiche { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lista-notifiche li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 0.925rem; }
.lista-dichiarazioni-staff { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.lista-dichiarazioni-staff summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.lista-dichiarazioni-staff .note { margin-top: 8px; }
.azioni-privacy { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.azione { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.azione > summary { cursor: pointer; font-weight: 650; color: var(--brand); }
.azione[open] > summary { margin-bottom: 12px; }
.bloccato { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--ink-2); }
.bloccato svg { flex: none; margin-top: 2px; color: var(--muted); }
.contatto-telefono { display: grid; gap: 2px; margin-bottom: 14px; }
.telefono-grande { font-size: 1.5rem; font-weight: 800; text-decoration: none; letter-spacing: 0.01em; }
.richiesta { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.richiesta.scaduta { border-left: 3px solid var(--danger); padding-left: 10px; }
.checklist-requisiti { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; font-size: 0.925rem; }
.checklist-requisiti li.ok span { color: var(--gain); font-weight: 800; }
.checklist-requisiti li.ko { color: var(--ink-2); }
.checklist-requisiti li.ko span { color: var(--warn); font-weight: 800; }
details > summary .card-title { display: inline-block; margin: 0 8px 0 0; }

@media print {
  .topbar, .footer, .back, .ambiente { display: none; }
  .stampabile { box-shadow: none; border: 0; }
}
.badge-verde { background: var(--gain-soft); color: var(--gain); }
.modale-promemoria { flex-basis: 100%; margin-right: 0; }
.ruolo-utente { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgb(255 255 255 / 14%); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; }
.scelta-esito { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.timeline > li.is-rifiutato > .dot { border-color: var(--danger); background: var(--danger); color: #fff; font-weight: 800; font-size: 0.85rem; }
.timeline > li.is-rifiutato .timeline-body strong { color: var(--danger); font-weight: 700; }
.timeline > li.is-rifiutato::before { background: var(--line); }
.alert-info-leggero { background: var(--info-soft); border-color: #c9d9ef; color: #1d4572; }
.titolo-gruppo { font-size: 1.05rem; margin-bottom: 10px; }
.minibar-5 { grid-template-columns: repeat(5, 1fr); }
.minibar span.rifiuto { background: var(--danger); }

/* --------------------------------------------------------------------------
   Premio produzione: indicatore a lancetta in stile gioco
   -------------------------------------------------------------------------- */
.premio {
  --p-bg: #0c1b2b;
  --p-bg-2: #13304a;
  --p-ink: #eef6ff;
  --p-muted: #9fb4c9;
  --p-neon: #ece5dd;
  --p-gold: #ffd84d;
  margin-top: 16px;
  display: grid;
  gap: 8px 24px;
  align-items: center;
  padding: 18px 18px 20px;
  border-radius: var(--radius);
  color: var(--p-ink);
  background:
    radial-gradient(120% 90% at 20% 0%, rgb(236 229 221 / 14%), transparent 55%),
    radial-gradient(90% 80% at 100% 100%, rgb(255 216 77 / 12%), transparent 60%),
    linear-gradient(150deg, var(--p-bg-2), var(--p-bg));
  box-shadow: 0 10px 30px rgb(12 27 43 / 28%), inset 0 0 0 1px rgb(255 255 255 / 7%);
  overflow: hidden;
}
@media (min-width: 700px) {
  .premio { grid-template-columns: minmax(260px, 330px) 1fr; padding: 22px 28px; }
}
.premio-gauge svg { display: block; width: 100%; max-width: 330px; margin: 0 auto; height: auto; overflow: visible; }

.premio-tacche line { stroke: rgb(255 255 255 / 28%); stroke-width: 1.5; stroke-linecap: round; }
.premio-tacche line.lunga { stroke: rgb(255 255 255 / 55%); stroke-width: 2.2; }
.premio .seg { stroke: rgb(255 255 255 / 10%); }
.premio .seg.on { stroke: url(#premio-grad); animation: premio-seg .45s ease-out both; animation-delay: calc(var(--i) * 80ms + 250ms); filter: drop-shadow(0 0 4px rgb(255 216 77 / 55%)); }
.premio .seg.next { stroke: rgb(236 229 221 / 30%); animation: premio-next 1.6s ease-in-out infinite; }
.premio.is-pieno .seg.on { filter: drop-shadow(0 0 6px rgb(236 229 221 / 70%)); }

.premio-estremo { fill: var(--p-muted); font-size: 13px; font-weight: 700; }
.premio-lancetta {
  fill: #ff5a5f;
  transform-box: view-box;
  transform-origin: 130px 122px;
  transform: rotate(var(--angolo));
  animation: premio-lancetta 1.5s cubic-bezier(.22, 1.25, .36, 1) .25s both;
}
.premio-perno { fill: #1e3d5c; stroke: rgb(255 255 255 / 45%); stroke-width: 2; }
.premio-perno-luce { fill: #ff5a5f; }
.premio-lettura { fill: var(--p-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.premio-lettura .n { font-size: 38px; fill: var(--p-gold); }
.premio-lettura .di { font-size: 20px; fill: var(--p-ink); }
.premio.is-pieno .premio-lettura .n { fill: var(--p-neon); }
.premio-unita { fill: var(--p-muted); font-size: 10.5px; font-weight: 700; letter-spacing: .18em; }

.premio-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.premio-eyebrow { font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--p-neon); }
.premio-livello {
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; color: var(--p-bg); background: var(--p-gold);
}
.premio-titolo { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); font-weight: 750; color: var(--p-ink); }
.premio-titolo strong { color: var(--p-gold); }
.premio.is-sbloccato .premio-titolo, .premio.is-pieno .premio-titolo { color: var(--p-neon); }
.premio-testo { margin: 8px 0 14px; color: rgb(238 246 255 / 86%); max-width: 46ch; }
.premio-testo strong { color: var(--p-ink); }
.premio-obiettivo {
  display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 10px 18px 10px 12px; border-radius: 14px;
  background: rgb(255 216 77 / 12%); box-shadow: inset 0 0 0 1px rgb(255 216 77 / 40%);
}
.premio-obiettivo .premio-coppa { grid-row: 1 / 3; color: var(--p-gold); }
.premio-obiettivo span { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--p-muted); }
.premio-obiettivo strong { font-size: 1.5rem; line-height: 1.1; font-weight: 800; color: var(--p-gold); font-variant-numeric: tabular-nums; }
.premio-obiettivo.is-ok { background: rgb(236 229 221 / 12%); box-shadow: inset 0 0 0 1px rgb(236 229 221 / 45%); }
.premio-obiettivo.is-ok .premio-coppa, .premio-obiettivo.is-ok strong { color: var(--p-neon); }
.premio-obiettivo.is-ok .premio-coppa { animation: premio-brilla 2.4s ease-in-out infinite; }
.premio-nota { margin: 10px 0 0; font-size: .8rem; color: var(--p-muted); }
.premio-nota + .premio-nota { margin-top: 4px; }

@keyframes premio-lancetta { from { transform: rotate(150deg); } }
@keyframes premio-seg { from { opacity: .1; } }
@keyframes premio-next { 50% { stroke: rgb(236 229 221 / 65%); } }
@keyframes premio-brilla { 50% { filter: drop-shadow(0 0 6px rgb(236 229 221 / 80%)); transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .premio-lancetta, .premio .seg.on, .premio .seg.next, .premio-obiettivo .premio-coppa { animation: none; }
}

/* Premio nella pagina Segnalatori */
.premio-mini { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.premio-mini-barra { width: 88px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.premio-mini-barra span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff8a3d, #e0b000 50%, var(--gain)); }
.wallet-nota { margin: 10px 0 0; font-size: .8rem; color: rgb(255 255 255 / 70%); }

/* --------------------------------------------------------------------------
   Link di invito / nuova password con messaggio da inviare
   -------------------------------------------------------------------------- */
.invio-link { display: grid; gap: 16px; margin-bottom: 20px; border: 2px solid var(--brand); }
.invio-head { display: flex; gap: 14px; align-items: flex-start; }
.invio-head p { margin: 4px 0 0; }
.invio-icona {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand);
}
.campo-copia { display: flex; gap: 8px; align-items: center; }
.campo-copia input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.invio-link textarea { font: inherit; font-size: .95rem; line-height: 1.5; min-height: 220px; }
.invio-azioni { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.invio-azioni .btn { display: inline-flex; align-items: center; gap: 8px; }
.btn-whatsapp { background: #1f8f4e; color: #fff; } /* verde di WhatsApp: unica eccezione al blu del logo */
.btn-whatsapp:hover { background: #18773f; color: #fff; }
@media (max-width: 520px) {
  .invio-azioni .btn { flex: 1 1 100%; justify-content: center; }
}
.link-dimenticata { justify-self: end; margin-top: -8px; }
.anteprima-link a { display: block; margin-top: 6px; word-break: break-all; }

/* --------------------------------------------------------------------------
   Scheda segnalazione (staff): persona in alto, poi stato di avanzamento
   -------------------------------------------------------------------------- */
.scheda-persona, .scheda-avanzamento { margin-bottom: 16px; }
.persona-griglia { display: grid; gap: 16px 28px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 14px; }
.persona-voce { display: grid; gap: 2px; align-content: start; min-width: 0; }
.persona-voce strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.persona-voce a { color: inherit; }
.persona-nome strong { font-size: 1.4rem; letter-spacing: -0.01em; }
.persona-voce .telefono-grande { font-size: 1.4rem; font-weight: 750; color: var(--brand); text-decoration: none; }
.persona-contatto {
  margin-top: 18px; padding: 10px 14px; border-radius: var(--radius-sm);
  display: flex; gap: 10px; align-items: center; font-size: .92rem;
}
.persona-contatto svg { flex: none; }
.persona-contatto.is-ok { background: var(--gain-soft); color: var(--gain); }
.persona-contatto.is-bloccato { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--line-strong); }

.stepper { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.stepper li { display: flex; gap: 12px; align-items: center; position: relative; }
.stepper-dot {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .85rem; background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted);
  position: relative; z-index: 1;
}
.stepper li.is-done .stepper-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper li.is-current .stepper-dot { box-shadow: 0 0 0 5px var(--brand-soft); }
.stepper li.is-rifiutato .stepper-dot { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 0 0 5px var(--danger-soft); }
.stepper-testo { display: grid; gap: 1px; font-size: .92rem; color: var(--muted); }
.stepper-testo strong { font-weight: 650; }
.stepper li.is-done .stepper-testo, .stepper li.is-current .stepper-testo { color: var(--ink); }
.stepper li.is-current .stepper-testo strong { font-weight: 800; }
.stepper li.is-rifiutato .stepper-testo strong { color: var(--danger); }
.stepper-testo small { color: var(--muted); font-size: .78rem; }
@media (min-width: 820px) {
  .stepper { grid-template-columns: repeat(5, 1fr); gap: 0; }
  .stepper li { flex-direction: column; align-items: center; text-align: center; padding: 0 8px; gap: 8px; }
  .stepper li:not(:last-child)::after {
    content: ''; position: absolute; top: 16px; left: calc(50% + 17px); width: calc(100% - 34px); height: 3px;
    border-radius: 2px; background: var(--line);
  }
  .stepper li.is-done:not(:last-child)::after { background: var(--brand); }
}
.aggiorna-stato {
  margin-top: 22px; padding: 18px; border-radius: var(--radius-sm);
  background: var(--brand-soft); border: 1px solid rgb(38 55 75 / 16%); display: grid; gap: 12px;
}
.aggiorna-stato p { margin: 0; }
.aggiorna-stato .form { gap: 12px; }
.aggiorna-titolo { font-size: 1.02rem; font-weight: 600; }
.aggiorna-titolo strong { color: var(--brand); }
.aggiorna-secondarie { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid rgb(38 55 75 / 12%); }
.scheda-avanzamento > details.azione { margin-top: 14px; }

/* Notifiche del segnalatore */
.notifiche-lista { padding: 0; overflow: hidden; }
.notifiche-lista .feed-item { padding: 0; }
.notifiche-lista .feed-item:first-child { border-top: 0; }
.notifiche-lista .feed-item.is-new { background: var(--brand-soft); }
.notifiche-lista .feed-link { display: grid; gap: 4px; padding: 16px 20px; }
.notifiche-lista .feed-link p { margin: 0; }
.nota-stato { margin: 4px 0 0; font-size: .85rem; color: var(--warn); font-weight: 600; }
.nota-stato.is-ko { color: var(--danger); }

/* --------------------------------------------------------------------------
   Archivio delle accettazioni (solo admin)
   -------------------------------------------------------------------------- */
.archivio-avviso {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; padding: 14px 16px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2);
}
.archivio-avviso svg { flex: none; margin-top: 2px; color: var(--brand); }
.archivio-avviso p { margin: 0; font-size: .92rem; }
.archivio-voce { margin-bottom: 12px; }
.archivio-testa { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: flex-start; }
.archivio-testa p { margin: 4px 0 0; }
.archivio-data { display: grid; gap: 2px; text-align: right; }
.archivio-lista { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.archivio-lista details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-2); }
.archivio-lista summary { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; cursor: pointer; }
.archivio-titolo { display: grid; gap: 2px; }
.archivio-lista .note { margin: 12px 0 8px; }
.archivio-lista code { overflow-wrap: anywhere; }
.paginazione { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 18px 0; }
@media (max-width: 640px) { .archivio-data { text-align: left; } }
.input-group-suffisso input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); max-width: 110px; }
.input-suffix {
  display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem;
  white-space: nowrap;
}
.input-group-suffisso:focus-within .input-suffix { border-color: var(--brand); }

/* Impostazioni dell'agente: dati dell'account */
.dati-account { display: grid; gap: 12px; margin: 0 0 12px; }
.dati-account > div { display: grid; gap: 2px; }
.dati-account dt { font-size: 0.8rem; font-weight: 650; color: var(--muted); }
.dati-account dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 640px) { .dati-account { grid-template-columns: 1fr 1fr; } }
