/* ============================================================
   Telemarketing Dashboard — Prime Immobiliare
   Nero + oro (dal logo). Verde per "cortese", oro per "info utili".
   ============================================================ */
:root {
  --ink:        #1b1a17;
  --ink-soft:   #3a3833;
  --ink-2:      #56524a;
  --muted:      #8b867c;

  --gold:       #d4a017;
  --gold-deep:  #a97e0a;
  --gold-tint:  #fdf3d7;
  --gold-tint2: #f8e7b6;
  --gold-ink:   #4a3800;

  --green:      #2f9e5f;
  --green-deep: #1e7a46;
  --green-tint: #e2f4e9;
  --green-tint2:#cdedd7;
  --green-ink:  #14532d;

  --dia:        #27c3f0;
  --dia-deep:   #0a86b5;
  --dia-violet: #8b6cf0;
  --dia-tint:   #e4f7fe;
  --dia-tint2:  #cdeefb;
  --dia-ink:    #053d57;

  --paper:      #faf9f6;
  --card:       #ffffff;
  --line:       #ebe8e1;
  --line-2:     #f3f1eb;

  --st-recente: #2f9e5f;
  --st-media:   #d4a017;
  --st-vecchia: #e07b39;
  --st-mai:     #c2beb4;

  --ok-bg:#e2f4e9; --ok-ink:#1e7a46;
  --err-bg:#fdecea; --err-ink:#a12b1e;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-s: 0 1px 2px rgba(25,22,12,.05), 0 2px 8px rgba(25,22,12,.04);
  --shadow-m: 0 2px 6px rgba(25,22,12,.06), 0 12px 32px rgba(25,22,12,.08);
  --maxw: 1160px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6;
  color: var(--ink); background: var(--paper);
}
a { color: inherit; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- animazioni (additive: il contenuto è sempre visibile) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop  { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes glowring { from { box-shadow: 0 0 0 0 rgba(212,160,23,.45); } to { box-shadow: 0 0 0 12px rgba(212,160,23,0); } }
/* diamante: riflesso che scorre, scintille che brillano, barra che cambia colore */
@keyframes dia-shimmer { from { background-position: 0% 50%; } to { background-position: 250% 50%; } }
@keyframes dia-glint { 0% { left: -45%; } 55%, 100% { left: 125%; } }
@keyframes dia-twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes dia-bar {
  0%, 100% { box-shadow: inset 4px 0 0 var(--dia); }
  50%      { box-shadow: inset 4px 0 0 var(--dia-violet); }
}
@keyframes dia-text { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }

/* i .reveal restano visibili di default; l'animazione parte solo quando JS aggiunge .in */
.reveal.in { animation: rise .5s cubic-bezier(.2,.7,.2,1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  background: rgba(250,249,246,.85);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 62px;
}
.topbar .logo img { height: 30px; width: auto; display: block; }
.topbar .tag {
  font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line);
}
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar nav a {
  text-decoration: none; color: var(--ink-2);
  padding: 9px 14px; border-radius: 9px; font-weight: 600; font-size: .93rem;
  transition: background .15s, color .15s;
}
.topbar nav a:hover { background: var(--line-2); color: var(--ink); }
.topbar nav a.active { background: var(--ink); color: #fff; }
.topbar nav a.cta { background: var(--gold); color: #2a2000; }
.topbar nav a.cta:hover { background: var(--gold-deep); color: #fff; transform: translateY(-1px); }
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 12px; height: 56px; }
  .topbar .tag { display: none; }
  .topbar nav a { padding: 8px 10px; font-size: .86rem; }
  .topbar nav a.cta span { display: none; }
}

/* ---------- HERO (above the fold) ---------- */
.hero {
  position: relative;
  background: linear-gradient(160deg, #23201b 0%, #1a1815 45%, #131110 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; top: -120px; right: -80px; width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(212,160,23,.38), rgba(212,160,23,0) 70%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 40px 22px 36px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.hero .sub { color: rgba(255,255,255,.68); margin-top: 8px; font-size: 1.05rem; max-width: 46ch; }

.hero-search { position: relative; margin: 24px 0 6px; max-width: 620px; isolation: isolate; }
.hero-search input[type="text"] {
  width: 100%; padding: 15px 16px 15px 48px; font: inherit; font-size: 1rem;
  border: 1px solid rgba(255,255,255,.22); border-radius: 12px;
  background: rgba(255,255,255,.10); color: #fff;
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.hero-search input[type="text"]::placeholder { color: rgba(255,255,255,.6); }
.hero-search input[type="text"]:focus {
  outline: none; background: #fff; color: var(--ink);
  border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212,160,23,.3);
}
.hero-search input[type="text"]:focus + svg { color: var(--muted); }
.hero-search svg {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.75); pointer-events: none; z-index: 2;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

.hero-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  margin-top: 30px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px; overflow: hidden;
}
.hero-stats .s { background: rgba(20,18,15,.5); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.hero-stats a.s-link { transition: background .15s; }
.hero-stats a.s-link:hover { background: rgba(212,160,23,.14); }
.hero-stats .n { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.hero-stats .n.gold { color: var(--gold); }
.hero-stats .n.green { color: #5ccf8a; }
.hero-stats .s-btn.green { color: #5ccf8a; border-color: rgba(92,207,138,.5); }
.hero-stats a.s-link.s-green:hover { background: rgba(47,158,95,.18); }
.hero-stats a.s-link.s-green:hover .s-btn { background: #5ccf8a; color: #0d2a1a; border-color: #5ccf8a; }
.hero-stats .l { color: rgba(255,255,255,.6); font-size: .82rem; margin-top: 2px; }
.hero-stats .s-btn {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px;
  font-size: .8rem; font-weight: 700; color: var(--gold);
  border: 1px solid rgba(212,160,23,.45); border-radius: 999px; padding: 4px 11px;
  transition: background .15s, color .15s;
}
a.s-link:hover .s-btn, .hero-stats .s-btn:hover { background: var(--gold); color: #2a2000; border-color: var(--gold); }
.hero-stats .l2 { color: rgba(255,255,255,.5); font-size: .76rem; margin-top: 2px; }

/* riquadro DIAMANTE: numero iridescente + scintille */
.hero-stats .s-dia { position: relative; overflow: hidden; }
/* sfondo color diamante: solo sulla casella del tasso */
.hero-stats .s.s-bg-dia {
  background: linear-gradient(135deg, rgba(39,195,240,.24), rgba(139,108,240,.17)), rgba(20,18,15,.5);
  box-shadow: inset 0 0 0 1px rgba(39,195,240,.38), inset 0 0 26px rgba(39,195,240,.14);
}
.hero-stats .l2 .pct { color: #bff0ff; font-weight: 700; }
.hero-stats .n.dia {
  display: inline-block; color: transparent;
  background: linear-gradient(100deg, #7fe3ff, #ffffff 25%, #c4b5ff 50%, #7fe3ff 75%, #ffffff 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text;
  animation: dia-text 3.2s linear infinite;
}
.hero-stats .s-dia .spk { width: 9px; height: 9px; background: #d8f6ff; }
.hero-stats .s-dia .spk.s1 { top: 14px; right: 22px; }
.hero-stats .s-dia .spk.s2 { top: 44px; right: 52px; width: 6px; height: 6px; }
.hero-stats .s-dia .spk.s3 { top: 26px; left: auto; right: 78px; width: 5px; height: 5px; }
.hero-stats .s-btn.dia { color: var(--dia); border-color: rgba(39,195,240,.5); }
.hero-stats a.s-link.s-dia:hover { background: rgba(39,195,240,.14); }
.hero-stats a.s-link.s-dia:hover .s-btn { background: var(--dia); color: #04283b; border-color: var(--dia); }

/* tasso di conversione: barra di avanzamento */
.hero-stats .meter { height: 5px; border-radius: 999px; background: rgba(255,255,255,.14); margin-top: 10px; overflow: hidden; }
.hero-stats .meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--dia), var(--dia-violet)); }

@media (max-width: 1100px) {
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .hero-stats > :last-child { grid-column: span 2; }   /* 5 riquadri: l'ultimo riempie la riga */
}
@media (max-width: 680px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { padding: 30px 16px 26px; }
}

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 34px 22px 70px; }
.page-head { margin-bottom: 22px; }
.page-head .lead { color: var(--muted); margin-top: 4px; font-size: 1rem; }

.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 .c { color: var(--muted); font-weight: 600; font-size: .8rem; margin-left: 6px; }
.section-head .spacer { flex: 1; }

/* ---------- board: sezioni ben separate della home ---------- */
.board {
  margin-top: 28px; padding: 26px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-s);
}
.board + .board { margin-top: 22px; }
.board-alt { background: linear-gradient(180deg, #fbf9f4, #fff); }
.board-head { margin-bottom: 18px; }
.board-kicker {
  display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--gold-deep);
  background: var(--gold-tint); padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
.board-head h2 { font-size: 1.35rem; }
.board-head p { margin-top: 4px; font-size: .92rem; }
@media (max-width: 640px) { .board { padding: 18px 14px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.card-pad { padding: 22px; }

/* ---------- città + zone ---------- */
.citta-block { margin-top: 26px; }
.board .citta-block:first-of-type { margin-top: 18px; }
.citta-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 0; margin-bottom: 16px; border-bottom: 3px solid var(--ink);
}
.citta-head h3 { font-size: 1.3rem; }
.citta-head .pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-2);
}
.pill.gold { background: var(--gold-tint); color: var(--gold-ink); }
.pill.dia { background: var(--dia-tint); color: var(--dia-ink); box-shadow: 0 0 0 1px rgba(39,195,240,.45); }

.zone-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.zone-card {
  display: block; text-decoration: none; position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px; transition: transform .16s cubic-bezier(.2,.7,.2,1), box-shadow .16s, border-color .16s;
}
.zone-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--st-mai);
  transition: width .16s;
}
.zone-card.s-recente::before { background: var(--st-recente); }
.zone-card.s-media::before   { background: var(--st-media); }
.zone-card.s-vecchia::before { background: var(--st-vecchia); }
.zone-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-m); border-color: var(--gold); }
.zone-card:hover::before { width: 7px; }
.zone-card .zn { font-weight: 700; font-size: 1.05rem; }
.zone-card .zc {
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 2px 0 8px;
}
.zone-card .status { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink-2); }
.zone-card .row2 {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2);
  font-size: .86rem; color: var(--muted);
}
.zone-card .info-n {
  color: var(--gold-ink); background: var(--gold-tint); font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.zone-card .dia-n {
  color: var(--dia-ink); font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(110deg, #9aeaff, #e6fbff, #cdbfff, #9aeaff);
  background-size: 250% 100%; animation: dia-shimmer 3.4s linear infinite;
  box-shadow: 0 0 0 1px rgba(39,195,240,.55);
}
.zone-card .pills-r { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sdot.recente { background: var(--st-recente); }
.sdot.media   { background: var(--st-media); }
.sdot.vecchia { background: var(--st-vecchia); }
.sdot.mai     { background: var(--st-mai); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .82rem; color: var(--muted); margin-top: 14px; }
.legend span { display: flex; align-items: center; gap: 7px; }

/* ---------- voto badge ---------- */
.voto {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 9px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap; line-height: 1.35;
  letter-spacing: .01em;
}
.voto svg { flex: none; }
.voto--info    { background: var(--gold); color: #2e2200; }
.voto--info svg    { color: #2e2200; }
.voto--cortese { background: var(--green); color: #fff; }
.voto--cortese svg { color: #fff; }
.voto--none    { background: var(--line-2); color: var(--muted); font-weight: 600; }
.voto.big { font-size: .92rem; padding: 6px 14px 6px 11px; }
.voto--info.pulse { animation: pop .4s ease, glowring 1.6s ease 2; }

/* livello DIAMANTE: gradiente iridescente che scorre + riflesso + scintille */
.voto--diamante {
  position: relative; overflow: hidden; color: var(--dia-ink); font-weight: 800;
  background: linear-gradient(110deg, #7fe3ff 0%, #e3fbff 18%, #7cc8ff 36%, #c4b5ff 54%, #7fe3ff 72%, #e9fcff 90%, #7fe3ff 100%);
  background-size: 250% 100%;
  box-shadow: 0 0 0 1px rgba(39,195,240,.6), 0 0 14px rgba(39,195,240,.5);
  animation: dia-shimmer 3.4s linear infinite;
}
.voto--diamante svg { color: var(--dia-ink); filter: drop-shadow(0 0 2px rgba(255,255,255,.9)); }
.voto--diamante::after {
  content: ""; position: absolute; top: -40%; bottom: -40%; left: -45%; width: 32%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.95), transparent);
  transform: skewX(-20deg); pointer-events: none;
  animation: dia-glint 2.6s ease-in-out infinite;
}
.spk {
  position: absolute; width: 7px; height: 7px; background: #fff; pointer-events: none; opacity: 0;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: dia-twinkle 2.2s ease-in-out infinite;
}
.spk.s1 { top: 3px; right: 9px; }
.spk.s2 { bottom: 3px; left: 30px; animation-delay: .7s; width: 5px; height: 5px; }
.spk.s3 { top: 4px; left: 8px; animation-delay: 1.4s; width: 5px; height: 5px; }

/* ---------- tabella (righe colorate per ruolo) ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-s); }
.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.grid th, table.grid td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line-2); }
table.grid thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; background: #fbfaf7;
}
table.grid tbody tr { transition: background .12s; }
table.grid tbody tr:last-child td { border-bottom: 0; }

table.grid tr.row-cortese { background: var(--green-tint); box-shadow: inset 4px 0 0 var(--green); }
table.grid tr.row-cortese:hover { background: var(--green-tint2); }
table.grid tr.row-info { background: var(--gold-tint); box-shadow: inset 4px 0 0 var(--gold); }
table.grid tr.row-info:hover { background: var(--gold-tint2); }
table.grid tr.row-none:hover { background: var(--line-2); }
table.grid tr.row-diamante {
  background: var(--dia-tint); box-shadow: inset 4px 0 0 var(--dia);
  animation: dia-bar 3s ease-in-out infinite;
}
table.grid tr.row-diamante:hover { background: var(--dia-tint2); }

table.grid a.name {
  font-weight: 700; text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; gap: 3px;
}
table.grid a.name svg { color: var(--gold-deep); opacity: .5; transition: opacity .12s, transform .12s; }
table.grid a.name:hover { color: var(--gold-deep); text-decoration: underline; }
table.grid a.name:hover svg { opacity: 1; transform: translateX(2px); }
.nowrap { white-space: nowrap; }

table.grid td.nome-cell { font-weight: 700; }
table.grid th.acts-h { text-align: right; }
table.grid td.acts-cell { text-align: right; white-space: nowrap; vertical-align: bottom; }
.acts-cell .btn { margin-left: 6px; }
.acts-cell form.inline-form { display: inline-block; margin-left: 6px; vertical-align: middle; }
.acts-cell form.inline-form .btn { margin-left: 0; }
.btn-icon { padding: 0; width: 38px; height: 38px; flex: none; gap: 0; }
.btn-icon svg { margin: 0; }
.btn-icon-label { display: none; }

/* Su schermi stretti la lista contatti diventa un elenco di schede */
@media (max-width: 860px) {
  .grid-contatti thead { display: none; }
  .grid-contatti, .grid-contatti tbody, .grid-contatti tr, .grid-contatti td { display: block; width: 100%; }
  .grid-contatti tr { padding: 14px 16px; border-bottom: 1px solid var(--line); box-shadow: none !important; border-left: 5px solid var(--line); }
  .grid-contatti tr.row-cortese { border-left-color: var(--green); }
  .grid-contatti tr.row-info { border-left-color: var(--gold); }
  .grid-contatti tr.row-diamante { border-left-color: var(--dia); animation: none; }
  .grid-contatti td { border: 0; padding: 2px 0; }
  .grid-contatti td.nome-cell { font-size: 1.1rem; margin-bottom: 2px; }
  .grid-contatti td:empty { display: none; }
  table.grid.grid-contatti td.acts-cell {
    display: flex; gap: 8px; margin-top: 12px; text-align: left; white-space: normal; flex-wrap: wrap;
    position: static; background: none; box-shadow: none;
  }
  .grid-contatti .acts-cell .btn { flex: 1 1 auto; margin: 0; }
  .grid-contatti .acts-cell form.inline-form { flex: 1 1 auto; margin: 0; display: block; }
  .grid-contatti .acts-cell form.inline-form .btn-icon { width: 100%; height: auto; padding: 9px 12px; gap: 6px; }
  .grid-contatti .btn-icon-label { display: inline; }
}

@media (max-width: 960px) {
  table.grid .col-sec { display: none; }
  table.grid th, table.grid td { padding: 11px; }
}

/* ---------- filtri ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 20px; }
.filters input[type=text], .filters select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.filters input[type=text]:focus, .filters select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,.22);
}
.filters .grow { flex: 1 1 240px; min-width: 200px; }
.filters a.clear { color: var(--gold-deep); text-decoration: none; font-weight: 600; font-size: .88rem; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  transition: transform .14s, background .14s, box-shadow .14s, border-color .14s;
}
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; box-shadow: var(--shadow-m); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2a2000; }
.btn-gold:hover { background: var(--gold-deep); color: #fff; box-shadow: 0 8px 20px rgba(169,126,10,.35); }
.btn-light { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff; }
.btn-light:hover { background: rgba(255,255,255,.2); }
.btn-danger { border-color: #e3b7b1; color: #a12b1e; background: #fff; }
.btn-danger:hover { background: var(--err-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { padding: 7px 12px; font-size: .86rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }

.link { color: var(--gold-deep); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .92rem; margin-bottom: 14px; transition: color .15s, gap .15s; }
.backlink:hover { color: var(--ink); gap: 9px; }

/* ---------- form ---------- */
form label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 5px; }
form .field { margin-bottom: 16px; }
form input[type=text], form input[type=date], form input[type=tel], form select, form textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; transition: border-color .15s, box-shadow .15s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,.22);
}
form textarea { resize: vertical; min-height: 64px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 150px; }
.form-narrow { max-width: 640px; }

.form-wide { max-width: 780px; }
.form-sheet { padding: 0; overflow: hidden; }
.form-sheet .form-body { padding: 20px 24px; }
.form-section { padding: 18px 0; border-top: 1px solid var(--line-2); }
.form-section:first-of-type { border-top: 0; padding-top: 4px; }
.form-section .field:last-child { margin-bottom: 0; }
.form-section > .h {
  display: flex; align-items: center; gap: 10px;
  font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink); margin-bottom: 16px;
}
.form-section > .h .num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: #2a2000;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; letter-spacing: 0; flex: none;
}
.form-section > .h .opt { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.form-hint { font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 5px; }
.req { color: var(--gold-deep); font-weight: 800; }
.field-lg input { padding: 13px 14px; font-size: 1.05rem; font-weight: 600; }
.form-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 18px 26px; background: #fbf9f4; border-top: 1px solid var(--line);
}
.zona-new { margin-top: 8px; }

/* ---------- dettaglio ---------- */
.detail-hero {
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-s);
  border-left: 6px solid var(--line);
}
.detail-hero.role-info    { border-left-color: var(--gold); background: linear-gradient(115deg, var(--gold-tint), #fff 55%); }
.detail-hero.role-cortese { border-left-color: var(--green); background: linear-gradient(115deg, var(--green-tint), #fff 55%); }
.detail-hero.role-diamante {
  border-left-color: var(--dia); background: linear-gradient(115deg, var(--dia-tint), #fff 55%);
  box-shadow: var(--shadow-s), 0 0 0 1px rgba(39,195,240,.35), 0 0 22px rgba(39,195,240,.18);
}
.detail-hero h1 { font-size: 1.6rem; }
.detail-hero .addr { color: var(--ink-2); margin-top: 4px; }
.detail-hero .phone { font-size: 1.5rem; font-weight: 800; margin-top: 12px; letter-spacing: .01em; }
.detail-hero .phone a { text-decoration: none; }
.detail-hero .phone a:hover { color: var(--gold-deep); }
.detail-hero .acts { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }

.voto-picker { display: flex; flex-direction: column; gap: 10px; }
.voto-picker label {
  display: flex; align-items: center; gap: 12px; font-weight: 500;
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color .14s, background .14s, transform .1s;
}
.voto-picker label:hover { transform: translateX(2px); }
@media (min-width: 620px) {
  .form-sheet .voto-picker { flex-direction: row; flex-wrap: wrap; }
  .form-sheet .voto-picker label { flex: 1 1 calc(50% - 10px); align-items: flex-start; }
  .form-sheet .voto-picker label:hover { transform: translateY(-2px); }
}
.voto-picker input { accent-color: var(--gold-deep); width: 18px; height: 18px; }
.voto-picker label.sel-diamante { border-color: var(--dia); background: var(--dia-tint); box-shadow: 0 0 14px rgba(39,195,240,.3); }
.voto-picker label.sel-info    { border-color: var(--gold); background: var(--gold-tint); }
.voto-picker label.sel-cortese { border-color: var(--green); background: var(--green-tint); }

/* avviso "numero già presente" nel form di nuovo contatto */
.dup-box {
  margin: 0 0 18px; padding: 16px 18px; border-radius: var(--radius);
  background: #fff8e4; border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(212,160,23,.14); animation: rise .35s ease;
}
.dup-box h3 { font-size: 1.02rem; color: var(--gold-ink); margin-bottom: 4px; }
.dup-box > p { color: var(--ink-2); font-size: .92rem; margin-bottom: 12px; }
.dup-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-top: 10px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--line);
}
.dup-item .dup-info b { display: block; font-size: 1rem; }
.dup-item .dup-info span { color: var(--muted); font-size: .86rem; }
.dup-item .dup-info a { color: var(--gold-deep); font-weight: 600; text-decoration: none; margin-left: 6px; }
.dup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.dup-box + .form-section { border-top: 0; padding-top: 4px; }
.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;
}

/* ---------- alert / vari ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .93rem; font-weight: 600; animation: rise .4s ease; }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
#registra:target .hl-registra {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,.28);
  animation: pop .35s ease;
}
.empty { text-align: center; color: var(--muted); padding: 34px 12px; }
.inline-form { display: inline; }
