:root {
  --accent-from: #4f46e5;
  --accent-to: #9333ea;
  --grad: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  /* Sfondo pagine: i tre stop del gradiente + i due bagliori radiali.
     Il tema (SITE_THEME nel .env) sovrascrive questi valori via :root inline. */
  --bg-from: #ffffff;
  --bg-mid: #dde4ee;
  --bg-to: #aeb9ca;
  --bg-glow-a: rgba(148, 163, 184, 0.34);
  --bg-glow-b: rgba(203, 213, 225, 0.5);
  --bg-grad: linear-gradient(180deg, var(--bg-from) 0%, var(--bg-mid) 30%, var(--bg-to) 100%);
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ok: #059669;
  --err: #dc2626;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  /* Gradiente marcato bianco → grigio, con sfumature neutre.
     Il tema (SITE_THEME) può cambiare questi colori via :root inline. */
  background:
    radial-gradient(1000px 420px at 88% -6%, var(--bg-glow-a), transparent 65%),
    radial-gradient(800px 380px at 0% 0%, var(--bg-glow-b), transparent 60%),
    var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--accent-from); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Footer sempre in fondo, anche con poco contenuto */
body.site { display: flex; flex-direction: column; }
/* width:100% evita che il main si restringa alla larghezza del contenuto
   (flex column + margini automatici): i box della scheda di voto restano
   alla loro larghezza anche quando cambia il contenuto (es. voto di lista). */
body.site main { flex: 1 0 auto; width: 100%; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.center { text-align: center; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.main { padding: 40px 20px 60px; }
.narrow { max-width: 520px; margin: 0 auto; }

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo { height: 34px; width: auto; }
.main-nav { display: flex; gap: 10px; align-items: center; }
.main-nav a {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92em;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.main-nav a:hover,
.main-nav a.is-active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}
.main-nav a:active { transform: translateY(0); }

/* Hamburger (solo smartphone) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 11px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animazione di apertura delle tendine menu (sito e admin) */
@keyframes nav-drop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Hero */
.hero { text-align: center; padding: 70px 0 40px; }
.hero-badge {
  display: inline-block;
  background: var(--grad);
  color: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero-badge.hero-badge-muted {
  background: #e2e8f0;
  color: var(--muted);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}
.hero-tagline { font-size: 1.15em; color: var(--muted); max-width: 560px; margin: 0 auto 28px; }
.hero-election {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 20px;
  margin: 0 auto 26px;
  max-width: 640px;
  text-align: left;
}
.hero-election-label {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.hero-election strong { font-size: 1.02em; font-weight: 700; color: var(--ink); }
.hero-cta { margin-bottom: 30px; }

/* Countdown */
.countdown { margin-top: 12px; }
.countdown-label { color: var(--muted); margin-bottom: 14px; }
.countdown-boxes { display: flex; gap: 14px; justify-content: center; }
.cd {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-width: 78px;
  display: flex;
  flex-direction: column;
}
.cd span { font-size: 1.9rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cd small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.7em; }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.feature {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.feature-icon { font-size: 1.8rem; margin-bottom: 10px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; }

/* Cards & forms */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.92em; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="file"], select, textarea {
  font: inherit;
  color: var(--ink);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent-from) 45%, transparent); border-color: transparent; }

/* Select professionali: niente aspetto nativo, chevron personalizzato */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2364748b'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  padding-right: 42px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:hover { border-color: #c7d2fe; }
textarea { resize: vertical; }
.input-code { text-align: center; font-size: 1.3em; letter-spacing: 0.15em; text-transform: uppercase; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline input:not([type="checkbox"]):not([type="hidden"]) { flex: 1 1 160px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; border: none; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { color: var(--err); border-color: #fecaca; }
.btn-small { padding: 7px 12px; font-size: 0.82em; border-radius: 8px; }
.btn-lg { padding: 14px 34px; font-size: 1.05em; border-radius: 12px; }

/* Pulsanti icona nelle tabelle (es. modifica): solo icona, tooltip nativo */
.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn-ico:hover {
  color: var(--accent-from);
  border-color: color-mix(in srgb, var(--accent-from) 45%, transparent);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.16);
  transform: translateY(-1px);
}
.btn-ico:active { transform: translateY(0); }
.btn-ico svg { width: 16px; height: 16px; pointer-events: none; }
.btn-ico-danger:hover {
  color: var(--err);
  border-color: #fecaca;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.16);
}
.btn-ico.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-ico.is-disabled:hover {
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

/* Tooltip immediato (hover/focus) sui pulsanti icona: posizionato in fixed
   via JS, così non viene mai tagliato dalle tabelle con scroll. */
.tip {
  position: fixed;
  z-index: 900;
  background: #0f172a;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.32);
  white-space: nowrap;
  pointer-events: none;
  animation: tip-in 0.12s ease;
}
@keyframes tip-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #0f172a;
  border-radius: 1px;
}
.tip.tip-below::after { top: -4px; bottom: auto; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.alert-error { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* Ballot */
.role-block { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 0 0 20px; }
.role-block legend { font-weight: 700; padding: 0 8px; }
.choice {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.choice:hover { border-color: var(--accent-from); }
.choice input { width: auto; }
.choice-body { display: flex; flex-direction: column; }
.choice-name { font-weight: 600; }
.choice-body small { color: var(--muted); }

/* Results (stili completi nella sezione "Pagina Risultati" più sotto) */
.result-election { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 22px; }
.result-election:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.role-results { margin: 18px 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { display: inline; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-active { background: #ecfdf5; color: #059669; }
.badge-upcoming { background: #fffbeb; color: #b45309; }
.badge-closed { background: #f1f5f9; color: #475569; }
.badge-published { background: #eef2ff; color: #4f46e5; }
.badge-draft { background: #fff7ed; color: #ea580c; }
.badge-votes {
  margin-left: 8px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.68em;
  vertical-align: middle;
}
.badge-voted {
  margin-left: 8px;
  background: #ecfdf5;
  color: #059669;
  font-size: 0.68em;
  vertical-align: middle;
}

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.1em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 8px 18px;
}
.sidebar-logo { height: 26px; width: auto; }
.side-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.side-nav a {
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.94em;
  background: #f8fafc;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.side-nav a:hover,
.side-nav a.is-active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}
.side-nav a:hover { transform: translateY(-1px); }
.side-nav a:active { transform: translateY(0); }
.logout { margin-top: auto; }
.logout .btn { width: 100%; }

/* Hamburger admin (solo smartphone) */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 11px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.admin-main { flex: 1; padding: 32px; max-width: 1100px; }
.admin-main h1 { margin-bottom: 22px; }

/* Sub-menu di configurazione elezione */
.election-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 22px; }
.election-tabs .tab {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9em;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.election-tabs .tab:hover {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}
.election-tabs .tab.is-active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

/* Election cards (dashboard) */
.election-card { padding: 22px 24px; }
.election-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.election-title { margin: 0 0 5px; font-size: 1.15em; }
.election-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88em; }
.election-meta .dot { opacity: 0.5; }
.election-section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.election-section-label {
  font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.election-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.election-actions form { display: inline-flex; }
.election-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.estat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.estat strong {
  font-size: 1.5rem;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.estat span {
  color: var(--muted);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.candidate-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.candidate-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85em;
  color: var(--ink);
}
.candidate-tag em {
  font-style: normal;
  font-weight: 700;
  color: var(--accent-from);
  font-size: 0.9em;
}

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; }
.stat strong { font-size: 2rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--muted); }

/* Grid & misc */
.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.scroll-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.check-select-all {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.sel-tutti-cont {
  display: inline-block;
  min-width: 44px;
  text-align: center;
  font-size: 0.8em;
  font-weight: 700;
  color: #fff;
  background: var(--grad);
  border-radius: 999px;
  padding: 1px 10px;
}
.logo-preview { max-height: 56px; margin-bottom: 8px; border-radius: 8px; }

/* Selettore tema pagine: card con anteprima del gradiente */
.field-label {
  display: block;
  font-weight: 500;
  font-size: 0.92em;
  color: var(--ink);
  margin-bottom: 8px;
}
.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-card:hover { border-color: var(--accent-from); }
.theme-card:has(input:checked) {
  border-color: var(--accent-from);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-from) 28%, transparent);
}
.theme-card:has(input:focus-visible) { outline: 2px solid var(--accent-from); outline-offset: 2px; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview { height: 64px; border-radius: 8px; border: 1px solid var(--line); }
.theme-preview-default { background: linear-gradient(180deg, #ffffff 0%, #dde4ee 30%, #aeb9ca 100%); }
.theme-preview-istituzionale { background: linear-gradient(180deg, #5AD5C3 0%, #6d28d9 80%, #6d28d9 100%); }
.theme-info { display: flex; flex-direction: column; gap: 2px; }
.theme-info strong { font-size: 0.95em; }
.theme-info small { color: var(--muted); font-size: 0.8em; }
.theme-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.theme-card:has(input:checked) .theme-check {
  background: var(--accent-from);
  border-color: var(--accent-from);
  color: #fff;
}

/* Campi colore accent: barra gradiente live + swatch con codice hex */
.accent-preview {
  position: relative;
  height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  margin-bottom: 14px;
}
.accent-preview::after {
  content: "anteprima del gradiente in tempo reale";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(15, 23, 42, 0.28);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.accent-preview.is-editing::after { opacity: 1; }
.color-field { display: flex; flex-direction: column; gap: 6px; }
.color-field-label { font-weight: 500; font-size: 0.92em; color: var(--ink); }
.color-field-control {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.color-field-control:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-from) 45%, transparent);
}
.color-field-control.is-invalid { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.4); border-color: transparent; }
.color-swatch {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: var(--swatch, #fff);
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15);
}
.color-swatch:hover {
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15), 0 0 0 2px color-mix(in srgb, var(--swatch, #fff) 35%, transparent);
}
.color-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  /* Il click sullo swatch apre il popover custom (funziona ovunque). */
  pointer-events: none;
}
.color-field .color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  border: none;
  background: transparent;
  padding: 4px 0;
  width: 100%;
  box-shadow: none;
  outline: none;
}
.color-field .color-hex:focus { outline: none; box-shadow: none; }

/* Popover selettore colore custom */
.color-popover {
  position: fixed;
  z-index: 1000;
  width: 236px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.color-popover[hidden] { display: none; }
.cp-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cp-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: transform 0.1s ease;
}
.cp-swatch:hover { transform: scale(1.08); }
.cp-swatch:focus-visible { outline: 2px solid var(--accent-from); outline-offset: 1px; }
.cp-hue-row { display: flex; align-items: center; }
.cp-hue { flex: 1; accent-color: var(--accent-from); cursor: pointer; }
.cp-foot { display: flex; align-items: center; gap: 8px; }
.cp-current {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
}
.cp-native {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8em;
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
}
.cp-native:hover { color: var(--ink); }
.cp-native input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* Login page */
.login-logo { height: 48px; width: auto; margin-bottom: 8px; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px; width: 100%; max-width: 400px; text-align: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: rgba(255,255,255,0.6); }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 22px 20px; color: var(--muted); font-size: 0.9em; }
.footer-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--accent-from); font-weight: 600; }
.footer-dev { font-size: 0.82em; }

/* Error page */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.error-page .card { width: 100%; }

/* Tabelle larghe: scroll orizzontale dentro la card, niente overflow di pagina */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 820px) {
  .features { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .admin-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  }
  .sidebar-brand { padding: 0; margin-right: auto; white-space: nowrap; min-width: 0; }
  .sidebar-brand span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .sidebar-toggle { display: inline-flex; }
  .side-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 260px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2), 0 2px 8px rgba(15, 23, 42, 0.06);
  }
  .sidebar.nav-open .side-nav { display: flex; animation: nav-drop-in 0.18s ease; }
  .side-nav a {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 0.94em;
    color: var(--ink);
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
  }
  .side-nav a:hover,
  .side-nav a.is-active {
    background: var(--grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
    transform: none;
  }
  .logout {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }
  .sidebar.nav-open .logout { display: block; }
  .sidebar.nav-open .logout .btn { width: 100%; }
  .sidebar.nav-open .sidebar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .sidebar.nav-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
  .sidebar.nav-open .sidebar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .admin-main { padding: 20px; }
  .main-nav { gap: 6px; }
  .main-nav a { padding: 8px 13px; font-size: 0.85em; }
  .steps { grid-template-columns: 1fr; }
  .result-head { flex-direction: column; }
  .result-stats { width: 100%; }
  .rstat { flex: 1 1 140px; }
  .ballot-submit { flex-direction: column; align-items: stretch; text-align: center; }
}

/* Smartphone stretti: menu hamburger al posto della barra di link.
   Il menu è una tendina compatta ancorata al pulsante, non più a tutta larghezza. */
@media (max-width: 480px) {
  .nav { position: relative; height: 64px; }
  .brand { white-space: nowrap; min-width: 0; }
  .brand span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 260px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2), 0 2px 8px rgba(15, 23, 42, 0.06);
  }
  .site-header.nav-open .main-nav { display: flex; animation: nav-drop-in 0.18s ease; }
  .main-nav a {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 0.94em;
    color: var(--ink);
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
  }
  .main-nav a:hover,
  .main-nav a.is-active {
    background: var(--grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
    transform: none;
  }
  .site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .cd { min-width: 64px; padding: 12px 14px; }
  .cd span { font-size: 1.5rem; }
  .estat { padding: 10px 6px; }
  .estat strong { font-size: 1.25rem; }
  .hero { padding: 48px 0 28px; }
  .dtp-pop { min-width: 0; width: 100%; }
  .theme-picker { grid-template-columns: 1fr; }
  .election-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Campi form (etichetta + controllo) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field.is-invalid .dtp-input { border-color: var(--err); }

/* ===== Pagina Privacy Policy ===== */
.privacy-card {
  max-width: 860px;
  margin: 0 auto 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
}
.privacy-card h2 {
  font-size: 1.15em;
  margin: 34px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.privacy-card h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.privacy-card h2 .num {
  flex: none;
  font-size: 0.72em;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--grad);
  color: #fff;
}
.privacy-card p { color: #334155; font-size: 0.95em; line-height: 1.7; }
.privacy-card p a { font-weight: 600; }
.privacy-card ul { margin: 0 0 14px 4px; padding-left: 20px; }
.privacy-card li { color: #334155; font-size: 0.93em; margin-bottom: 7px; line-height: 1.65; }
.privacy-card li b { color: var(--ink); }
.privacy-card table { font-size: 0.88em; margin: 14px 0 16px; }
.privacy-card th {
  font-size: 0.72em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
}
.privacy-card td { vertical-align: top; line-height: 1.55; }
.privacy-card td:first-child { font-weight: 700; white-space: nowrap; }
.privacy-card .nota {
  border-left: 3px solid #cbd5e1;
  padding-left: 14px;
  margin: 18px 0;
  font-size: 0.82em;
  color: var(--muted);
}
.privacy-card .riquadro {
  border-radius: 12px;
  padding: 15px 17px;
  font-size: 0.9em;
  margin: 16px 0;
  background: #f5f3ff;
  border: 1px solid #e0e7ff;
  color: #334155;
}
.privacy-card .riquadro b { color: var(--accent-from); }

/* ===== Consenso cookie (GDPR) ===== */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 500;
  padding: 16px 20px 20px;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(.22,.68,.25,1), opacity 0.55s ease;
  pointer-events: none;
}
.cookie-banner.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.cookie-banner.uscita { transform: translateY(120%); opacity: 0; transition: transform 0.5s cubic-bezier(.55,.06,.68,.19), opacity 0.4s ease; }
.cookie-card {
  position: relative;
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  border-radius: 16px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28), inset 0 1px 0 rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}
.cookie-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
}
.cookie-ico {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--accent-from);
  background: #eef2ff;
  border: 1px solid #e0e7ff;
}
.cookie-ico svg { width: 26px; height: 26px; }
.cookie-testo { min-width: 0; }
.cookie-testo h3 { font-size: 1rem; font-weight: 700; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.cookie-testo h3 .badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok);
  border: 1px solid #a7f3d0;
  border-radius: 100px;
  padding: 2px 8px;
  background: #ecfdf5;
}
.cookie-testo p { font-size: 0.86rem; color: #475569; margin: 0; max-width: 620px; }
.cookie-testo p a { color: var(--accent-from); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cookie-azioni { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cookie-azioni .btn { padding: 10px 18px; font-size: 0.86rem; white-space: nowrap; }
.btn-essenziali { background: #f8fafc; border-color: #cbd5e1; }
.btn-essenziali:hover { background: #eef2ff; }

/* Pulsante flottante cookie */
.cookie-fab {
  position: fixed;
  right: 26px; bottom: 26px;
  z-index: 550;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: var(--grad);
  border: none;
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.4);
  transition: transform 0.3s cubic-bezier(.22,.68,.25,1), box-shadow 0.3s;
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  pointer-events: none;
}
.cookie-fab.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.cookie-fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 18px 44px rgba(79, 70, 229, 0.5); }
.cookie-fab svg { width: 26px; height: 26px; pointer-events: none; }
.cookie-fab .fab-tip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: #fff;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.22,.68,.25,1);
}
.cookie-fab:hover .fab-tip,
.cookie-fab:focus-visible .fab-tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* Pannello Cookie Policy (modal) */
.cp-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}
.cp-overlay.on { display: flex; animation: cp-in 0.25s ease; }
@keyframes cp-in { from { opacity: 0; } to { opacity: 1; } }
.cp-card {
  width: min(720px, 96vw);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 18px;
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 40px 100px rgba(15, 23, 42, 0.35);
  animation: cp-card-in 0.35s cubic-bezier(.22,.68,.25,1);
}
@keyframes cp-card-in { from { transform: translateY(26px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.cp-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
}
.cp-head .cookie-ico { width: 40px; height: 40px; border-radius: 11px; }
.cp-head h2 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.cp-head h2 small { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.cp-chiudi {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: 0.2s;
  display: grid;
  place-items: center;
  flex: none;
}
.cp-chiudi:hover { background: #eef2ff; transform: rotate(90deg); }
.cp-body { padding: 24px 26px 10px; }
.cp-body h3 { font-size: 0.98rem; font-weight: 700; margin: 24px 0 8px; display: flex; align-items: center; gap: 9px; }
.cp-body h3:first-child { margin-top: 0; }
.cp-body h3::before { content: ""; width: 5px; height: 16px; border-radius: 3px; flex: none; background: var(--grad); }
.cp-body p { font-size: 0.88rem; color: #475569; margin-bottom: 10px; }
.cp-body ul { margin: 0 0 12px 4px; padding-left: 18px; }
.cp-body li { font-size: 0.86rem; color: #475569; margin-bottom: 6px; }
.cp-body li b { color: var(--ink); }
.cp-tabella {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 0.83rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.cp-tabella th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.cp-tabella td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cp-tabella tr:last-child td { border-bottom: none; }
.cp-tabella td:first-child { font-weight: 700; white-space: nowrap; }
.cp-tabella .tag-ess { color: var(--ok); font-weight: 700; white-space: nowrap; }
.cp-tabella .tag-no { color: var(--err); font-weight: 700; white-space: nowrap; }
.cp-note { font-size: 0.78rem; color: var(--muted); border-left: 3px solid #cbd5e1; padding-left: 14px; margin: 14px 0; }
.cp-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 18px 26px 22px;
  background: linear-gradient(0deg, #fff 60%, rgba(255,255,255,0));
}
.cp-foot .btn { padding: 10px 18px; font-size: 0.86rem; }

/* Modal ripristino backup */
.bk-overlay {
  position: fixed;
  inset: 0;
  z-index: 650;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}
.bk-overlay.on { display: flex; animation: cp-in 0.25s ease; }
.bk-card {
  width: min(560px, 96vw);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 18px;
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 40px 100px rgba(15, 23, 42, 0.35);
  animation: cp-card-in 0.35s cubic-bezier(.22, .68, .25, 1);
}
.bk-card-narrow { width: min(480px, 96vw); }
.bk-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
}
.bk-head h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.bk-chiudi {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: 0.2s;
  display: grid;
  place-items: center;
  flex: none;
}
.bk-chiudi:hover { background: #eef2ff; transform: rotate(90deg); }
.bk-body { padding: 22px 26px 10px; }
.bk-body p { font-size: 0.88rem; }
.bk-err {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.84rem;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.bk-opzioni { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.bk-opzione {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.bk-opzione:hover:not(:disabled) {
  border-color: var(--accent-from);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
  background: #fff;
}
.bk-opzione:disabled { opacity: 0.5; cursor: not-allowed; }
.bk-opzione .bk-ico {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--grad);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: #fff;
}
.bk-opzione b { display: block; font-size: 0.94rem; margin-bottom: 2px; }
.bk-opzione small { color: var(--muted); font-size: 0.8rem; line-height: 1.4; display: block; }
.bk-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  padding: 18px 26px 22px;
  background: linear-gradient(0deg, #fff 60%, rgba(255, 255, 255, 0));
}
.bk-foot .btn { padding: 10px 18px; font-size: 0.86rem; }
.bk-count { font-size: 0.82rem; color: var(--muted); margin-right: auto; }
.bk-lista {
  max-height: 38vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 4px;
}
.bk-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.bk-check + .bk-check { border-top: 1px solid var(--line); }
.bk-check-tutte {
  padding: 8px 2px;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ===== Elezioni a liste ===== */
.is-hidden { display: none !important; }

/* Selettore tipo elezione (card radio, come il theme-picker) */
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.type-card:hover { border-color: var(--accent-from); }
.type-card:has(input:checked) {
  border-color: var(--accent-from);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-from) 28%, transparent);
}
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card .type-ico { font-size: 1.5rem; }
.type-card strong { font-size: 0.98em; }
.type-card small { color: var(--muted); font-size: 0.8em; line-height: 1.4; }
.type-check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.type-card:has(input:checked) .type-check {
  background: var(--accent-from);
  border-color: var(--accent-from);
  color: #fff;
}

/* Opzioni radio in riga (modalità liste, voto, preferenze) */
.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.opt:has(input:checked) {
  border-color: var(--accent-from);
  background: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-from) 20%, transparent);
}
.opt input { margin-top: 3px; accent-color: var(--accent-from); }
.opt b { display: block; font-size: 0.9em; }
.opt small { color: var(--muted); font-size: 0.8em; line-height: 1.4; }

/* Box lista: gestione admin, scheda di voto, risultati */
.list-admin { display: flex; flex-direction: column; gap: 14px; }
.list-card { padding: 0; overflow: hidden; }
.list-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbff, #fff);
}
.list-info { min-width: 0; }
.list-name { font-weight: 700; font-size: 1.02em; }
.list-sub { margin-top: 2px; }
.list-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.list-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  flex: none;
}
.list-logo-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1em;
  color: #fff;
  background: var(--grad);
  flex: none;
}
.list-body { padding: 16px 18px; }
.mini-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}
.mini-form input { width: auto; flex: 1 1 130px; padding: 8px 10px; font-size: 0.85em; }
.mini-form .btn { padding: 8px 14px; font-size: 0.82em; }

/* Scheda di voto: box per lista. Stessa larghezza centrata dei blocchi
   per carica della scheda "candidati singoli": le due schede restano
   coerenti tra loro. */
.list-block {
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  max-width: 760px;
  margin: 0 auto 22px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.list-block.is-selected {
  border-color: var(--accent-from);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-from) 22%, transparent);
}
.list-block.is-dim { opacity: 0.45; pointer-events: none; }
.list-block-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbff, #fff);
  flex-wrap: wrap;
}
.list-block.is-selected .list-block-head { background: linear-gradient(180deg, #f5f3ff, #fff); }
.list-block-info { min-width: 0; flex: 1; }
.list-block-name { font-weight: 700; font-size: 1.05em; }
.list-block-desc { color: var(--muted); font-size: 0.82em; }
.list-block-body { padding: 18px; }
.list-vote {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.86em;
  white-space: nowrap;
  margin-left: auto;
  cursor: pointer;
  padding: 9px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.list-vote:hover { border-color: #c7d2fe; }
.list-vote input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.list-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.list-vote:hover .list-radio-dot { border-color: var(--accent-from); }
.list-block.is-selected .list-vote {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}
.list-block.is-selected .list-radio-dot {
  border-color: #fff;
  background: transparent;
  box-shadow: inset 0 0 0 4px #fff;
}
.list-voted-tag {
  display: none;
  background: var(--grad);
  color: #fff;
  font-size: 0.68em;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}
.list-block.is-selected .list-voted-tag { display: inline-block; }
.list-block.is-selected .list-vote-txt { display: none; }

/* Contatore preferenze globale (modalità "tra tutti i candidati") */
.global-pref-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  color: #4338ca;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.9em;
  margin: 0 auto 22px;
  width: fit-content;
  flex-wrap: wrap;
}
.global-pref-counter b {
  background: var(--grad);
  color: #fff;
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.85em;
}
.global-pref-counter .gpc-note { font-weight: 500; color: #4338ca; font-size: 0.82em; }
.choice-blank-global { max-width: 520px; margin: 0 auto 22px; }

/* Scheda di voto: adattamento mobile (lista e singola coerenti) */
@media (max-width: 600px) {
  .list-block-head { gap: 10px; }
  .list-vote { margin-left: 0; width: 100%; justify-content: center; }
  .role-block legend { flex-wrap: wrap; row-gap: 4px; }
}

/* Risultati: classifica delle liste */
.seg-label {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin: 18px 0 10px;
}
.list-ranking { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 22px; }
.lr-row { display: flex; align-items: center; gap: 12px; }
.lr-rank { font-weight: 800; color: var(--muted); width: 26px; flex: none; }
.lr-bar { flex: 1; height: 30px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.lr-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #fff;
  font-size: 0.78em;
  font-weight: 700;
  min-width: 60px;
  white-space: nowrap;
}
.lr-tot { font-weight: 700; width: 76px; text-align: right; flex: none; }
.seg-hint {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
/* Nei risultati i box lista restano a tutta larghezza (card deliberatamente
   ampia): la larghezza ridotta vale solo per la scheda di voto. */
.result-list-block {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
.result-list-block .list-block-head { border: none; }

@media (max-width: 820px) {
  .type-picker { grid-template-columns: 1fr; }
  .lr-fill { min-width: 40px; padding: 0 8px; font-size: 0.7em; }
}
.bk-check input { width: 17px; height: 17px; accent-color: var(--accent-from); flex: none; }

/* Toast conferma */
.cookie-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 700;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 20px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: 0.35s;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 92vw;
}
.cookie-toast.on { opacity: 1; transform: translate(-50%, 0); }
.cookie-toast .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }

@media (max-width: 900px) {
  .cookie-card { grid-template-columns: auto 1fr; gap: 14px; }
  .cookie-azioni { grid-column: 1 / -1; justify-content: flex-end; }
  .privacy-card { padding: 26px 22px; }
  .privacy-card td:first-child { white-space: normal; }
}
@media (max-width: 560px) {
  .cookie-card { grid-template-columns: 1fr; text-align: center; }
  .cookie-ico { margin: 0 auto; }
  .cookie-azioni { justify-content: center; }
  .cookie-azioni .btn { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .cp-overlay { padding: 10px; align-items: flex-end; }
  .cp-card { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .cp-head { padding: 16px 18px; gap: 10px; }
  .cp-head .cookie-ico { width: 36px; height: 36px; border-radius: 10px; }
  .cp-head h2 { font-size: 1.05rem; }
  .cp-body { padding: 18px 18px 8px; }
  .cp-body h3 { font-size: 0.9rem; }
  .cp-foot { padding: 14px 18px 20px; }
  .cp-tabella { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cp-foot .btn { flex: 1 1 100%; }
}

/* ===== Page hero (pagine pubbliche interne) ===== */
.page-hero {
  text-align: center;
  padding: 46px 0 26px;
}
.page-hero .hero-badge { margin-bottom: 16px; }
.page-hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.page-hero .hero-tagline {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.05em;
}

/* Su sfondi colorati (tema istituzionale) il titolo usa un colore scuro pieno:
   il gradiente accent può risultare illeggibile sul fondo verde/viola. */
body.theme-istituzionale .hero h1,
body.theme-istituzionale .page-hero h1 {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--ink);
}

/* ===== Pagina Vota ===== */
.vote-card {
  max-width: 500px;
  margin: 0 auto 28px;
  text-align: center;
}
.vote-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  background: var(--grad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  margin-bottom: 16px;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.3);
}
.steps {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.step {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  font-size: 0.88em;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  margin-bottom: 10px;
}
.step p { margin: 0; color: var(--muted); }
.step strong { color: var(--ink); }

/* ===== Pagina Scheda (ballot) ===== */
.role-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  margin: 0 auto 22px;
  max-width: 760px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
/* Titolo della carica dentro la card, su sfondo bianco, subito sotto il
   bordo superiore (non più appoggiato sulla linea del bordo). */
.role-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(180deg, #eef0ff, #fff);
  border-bottom: 1px solid var(--line);
}
.role-title { font-weight: 800; font-size: 1.08em; letter-spacing: -0.01em; }
.role-body { padding: 18px 20px 20px; }
/* Legend tenuta solo per gli screen reader: il titolo visibile è .role-head */
.role-block legend.role-legend-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.pref-count {
  margin-left: auto;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 12px;
}
.pref-count.is-full { color: var(--ok); background: #ecfdf5; }

.choice {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #fff;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.choice:last-child { margin-bottom: 0; }
.choice:hover { border-color: #c7d2fe; }
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice:has(input:focus-visible) { outline: 2px solid var(--accent-from); outline-offset: 2px; }
.choice:has(input:checked) {
  border-color: var(--accent-from);
  background: linear-gradient(180deg, #f5f3ff, #eef2ff);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
}
.choice-avatar {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
  background: #eef2ff;
  color: var(--accent-from);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95em;
  transition: background 0.15s ease, color 0.15s ease;
}
.choice:has(input:checked) .choice-avatar { background: var(--grad); color: #fff; }
.choice-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.choice-name { font-weight: 700; font-size: 1.02em; }
.choice-body small { color: var(--muted); }
.choice-check {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.choice:has(input:checked) .choice-check {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}

/* Scheda bianca: voce separata in fondo a ogni carica */
.choice-blank {
  border-style: dashed;
  background: #f8fafc;
}
.choice-blank:hover { border-color: #94a3b8; }
.choice-blank:has(input:checked) {
  border-style: solid;
  border-color: var(--accent-from);
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
}
.choice-avatar-blank { background: #f1f5f9; color: var(--muted); font-size: 1.05em; }
.choice-blank:has(input:checked) .choice-avatar-blank { background: var(--grad); color: #fff; }
/* Con più preferenze, scegliendo la scheda bianca i candidati vengono disabilitati: aspetto attenuato */
.choice:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }

.ballot-submit {
  max-width: 760px;
  margin: 6px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.ballot-note { color: var(--muted); font-size: 0.9em; }
.ballot-hint {
  display: none;
  color: var(--muted);
  font-size: 0.82em;
  font-weight: 600;
}
.ballot-hint.is-visible { display: inline-block; }
.ballot-submit .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== Pagina Risultati ===== */
/* La card si adatta alla larghezza del contenitore (e alla risoluzione):
   niente più tetto stretto, il contenuto respira a tutta larghezza. */
.result-card { max-width: none; margin: 0 0 24px; }
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.result-title h2 { margin: 0 0 4px; }
.result-title p { margin: 0; }
.result-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.rstat {
  position: relative;
  min-width: 128px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.rstat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
}
.rstat-ico { font-size: 1.15em; line-height: 1; margin-bottom: 4px; }
.rstat strong {
  font-size: 1.7rem;
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rstat span {
  color: var(--muted);
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
/* Il box "Bianche" è in evidenza ma senza "valore di voto": bordo tratteggiato e numero neutro */
.rstat-bianche { border-style: dashed; background: #fff; }
.rstat-bianche::before { display: none; }
.rstat-bianche strong {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--muted);
}

.role-results h3 {
  font-size: 1.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.role-results h3::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.bar-row.is-winner {
  background: linear-gradient(180deg, #f5f3ff, #eef2ff);
  border-color: #e0e7ff;
}
.bar-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85em;
  color: var(--muted);
  background: #f1f5f9;
}
.bar-row.is-winner .bar-rank { background: var(--grad); color: #fff; }
.bar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  background: #eef2ff;
  color: var(--accent-from);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9em;
}
.bar-row.is-winner .bar-avatar { background: var(--grad); color: #fff; }
.bar-info { flex: 1; min-width: 0; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 0.95em; }
.bar-count { color: var(--muted); white-space: nowrap; }
.bar-count small { color: var(--muted); }
.bar { height: 12px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--grad); border-radius: 999px; transition: width 0.6s ease; }
.winner-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 700;
  background: var(--grad);
  color: #fff;
  vertical-align: middle;
}

/* Scheda bianca nei risultati: conteggiata ma senza valore di voto */
.blank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: var(--muted);
}
.blank-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
}
.blank-label { flex: 1; min-width: 0; font-weight: 700; font-size: 0.92em; color: var(--ink); }
.blank-label small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8em; }
.blank-count { color: var(--muted); font-weight: 700; white-space: nowrap; }

/* Preferenze a candidati rimossi dopo il voto: contate ma senza riga */
.orphan-note {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.84rem;
  line-height: 1.5;
}

/* DatePicker data/ora */
.dtp { position: relative; }
.dtp-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2364748b'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='3'%20y='4'%20width='18'%20height='18'%20rx='2'/%3E%3Cline%20x1='16'%20y1='2'%20x2='16'%20y2='6'/%3E%3Cline%20x1='8'%20y1='2'%20x2='8'%20y2='6'/%3E%3Cline%20x1='3'%20y1='10'%20x2='21'%20y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}
.dtp-pop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 300px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  padding: 14px;
  z-index: 50;
}
.dtp-pop.is-open { display: block; }
.dtp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dtp-title { font-weight: 700; font-size: 0.95em; }
.dtp-nav {
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: #f1f5f9; color: var(--ink); font-size: 1.2em; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.dtp-nav:hover { background: var(--grad); color: #fff; }
.dtp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.dtp-week span { text-align: center; font-size: 0.68em; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; padding: 4px 0; }
.dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dtp-day {
  height: 34px; border: none; border-radius: 8px; background: transparent;
  font: inherit; font-size: 0.9em; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.dtp-day:hover { background: #eef2ff; }
.dtp-day.is-today { box-shadow: inset 0 0 0 1px var(--accent-from); }
.dtp-day.is-selected { background: var(--grad); color: #fff; font-weight: 700; }
.dtp-time { display: flex; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dtp-time label { flex: 1; font-size: 0.78em; color: var(--muted); }
.dtp-time select { width: 100%; padding: 8px 26px 8px 10px; border-radius: 8px; border: 1px solid var(--line); font: inherit; background-color: #fff; color: var(--ink); background-position: right 7px center; background-size: 12px 12px; }
.dtp-foot { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

/* Editor rich text (regolamento) */
.rich-editor { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.rich-editor:focus-within { border-color: var(--accent-from); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-from) 15%, transparent); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.rich-toolbar button {
  min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); font: inherit; font-size: 0.85em;
  cursor: pointer; line-height: 1;
}
.rich-toolbar button:hover { background: #e2e8f0; }
.rich-toolbar button:active { background: #cbd5e1; }
.rich-sep { width: 1px; margin: 4px 6px; background: var(--line); }
.rich-content {
  min-height: 320px; padding: 16px; outline: none; line-height: 1.6;
  color: var(--ink); font-size: 0.95rem; overflow-wrap: break-word;
}
.rich-content:empty::before {
  content: 'Scrivi qui il regolamento...'; color: #94a3b8; pointer-events: none;
}
.rich-content h2 { font-size: 1.35em; margin: 0.7em 0 0.3em; }
.rich-content h3 { font-size: 1.15em; margin: 0.7em 0 0.3em; }
.rich-content blockquote { margin: 0.6em 0; padding: 6px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.rich-content ul, .rich-content ol { margin: 0.5em 0 0.5em 1.4em; padding: 0; }
.rich-content a { color: var(--accent-from); }

/* Regolamento: visualizzazione pubblica e in sola lettura */
.regulation-gate { padding: 16px; }
.regulation-scroll {
  max-height: 260px;
  overflow-y: auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.regulation-accept {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 600;
  cursor: pointer;
}
.regulation-warning {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 0.9em;
}
.regulation-content { line-height: 1.7; }
.regulation-content h2 { font-size: 1.3em; margin: 0.8em 0 0.3em; }
.regulation-content h3 { font-size: 1.12em; margin: 0.8em 0 0.3em; }
.regulation-content p { margin: 0.5em 0; }
.regulation-content ul, .regulation-content ol { margin: 0.5em 0 0.5em 1.5em; padding: 0; }
.regulation-content blockquote { margin: 0.6em 0; padding: 6px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.regulation-content a { color: var(--accent-from); }
