/* ============================================================
   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;

  --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); } }

/* 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(4, 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 .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); }
@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); }

.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;
}

.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; }

/* ---------- 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 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; }
.acts-h { text-align: right; }
.acts-cell { text-align: right; white-space: nowrap; }
.acts-cell .btn { margin-left: 6px; }

/* 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 td { border: 0; padding: 2px 0; }
  .grid-contatti td.nome-cell { font-size: 1.1rem; margin-bottom: 2px; }
  .grid-contatti td:empty { display: none; }
  .grid-contatti .acts-cell { display: flex; gap: 8px; margin-top: 12px; text-align: left; white-space: normal; }
  .grid-contatti .acts-cell .btn { flex: 1; margin: 0; }
}

@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 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; }
  .form-sheet .voto-picker label { flex: 1; 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-info    { border-color: var(--gold); background: var(--gold-tint); }
.voto-picker label.sel-cortese { border-color: var(--green); background: var(--green-tint); }

/* ---------- 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; }
