/* =========================================================
   Open Day ENFAPI Como
   Idea: una fascia blu "lago" con il riquadro calendario,
   indirizzi riconoscibili a colpo d'occhio dal colore del loro laboratorio,
   orari come biglietti da strappare. Il resto resta pulito e leggibile.
   Per adattare i colori al marchio basta cambiare le variabili qui sotto.
   ========================================================= */
:root {
  --navy:   #0f2a52;   /* fascia hero, titoli */
  --blue:   #1f63c6;   /* pulsanti, link */
  --blue-d: #174f9f;
  --sun:    #ffb400;   /* accento caldo: numeri dei passi, calendario */
  --ink:    #14213d;   /* testo */
  --muted:  #5b6a84;
  --line:   #dbe3ee;
  --bg:     #f2f5fa;
  --card:   #ffffff;
  --ok:     #12865a;
  --err:    #c4372c;
  --warn:   #8f6400;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body:    "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--body); background: var(--bg); color: var(--ink); }
a { color: var(--blue); text-underline-offset: 2px; }
img { max-width: 100%; }
.wrap { max-width: 880px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main.wrap { padding-top: 28px; padding-bottom: 56px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

h1, h2 { font-family: var(--display); color: var(--navy); line-height: 1.1; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); font-weight: 800; margin: 0 0 .4em; }
h2 { font-size: 1.3rem; font-weight: 600; margin: 1.6em 0 .7em; }
.card > h2:first-of-type { margin-top: 0; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .875rem; }
.big { font-size: 1.2rem; font-weight: 600; }
.lead { font-size: 1.05rem; color: var(--muted); margin-top: 0; }
.back a { font-weight: 600; text-decoration: none; }
.back a::before { content: "‹ "; }

/* ---------- Intestazione ---------- */
header.top { background: #fff; border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand .logo { height: 42px; width: auto; display: block; }
.brand-tag { font-family: var(--display); font-weight: 600; color: var(--navy); font-size: 1.05rem; padding-left: 14px; border-left: 2px solid var(--line); }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
header.top nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 7px 12px; border-radius: 999px; }
header.top nav a:hover { background: var(--bg); color: var(--blue); }

/* ---------- Fascia hero ---------- */
.hero {
  color: #fff;
  background:
    radial-gradient(520px 260px at 92% 0%, rgba(255, 180, 0, .22), transparent 70%),
    radial-gradient(640px 320px at 0% 120%, rgba(31, 99, 198, .65), transparent 70%),
    var(--navy);
  position: relative; overflow: hidden;
}
.hero::after { /* onde del lago */
  content: ""; position: absolute; inset: auto 0 0 0; height: 46px; opacity: .14;
  background: repeating-linear-gradient(170deg, transparent 0 14px, #fff 14px 15px);
  pointer-events: none;
}
.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding-block: 40px 76px; position: relative; z-index: 1; }
.hero-text { min-width: 0; flex: 1; }
.hero h1 { color: #fff; margin: 0 0 12px; }
.hero-desc { margin: 0 0 12px; max-width: 58ch; color: rgba(255,255,255,.86); font-size: 1.05rem; }
.hero-place { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: #fff; }
.hero-place .ico { width: 20px; height: 20px; stroke: var(--sun); }
main.after-hero { margin-top: -48px; position: relative; z-index: 2; padding-top: 0; }

/* Riquadro calendario */
.date-tile { flex-shrink: 0; width: 118px; text-align: center; background: #fff; color: var(--navy); border-radius: var(--r-md);
  box-shadow: 0 14px 30px -12px rgba(5, 18, 40, .55); overflow: hidden; transform: rotate(2.5deg); }
.date-tile .dt-wd { display: block; background: var(--sun); color: var(--navy); font-weight: 700; font-size: .9rem; padding: 5px 0; }
.date-tile .dt-day { display: block; font-family: var(--display); font-weight: 800; font-size: 3.2rem; line-height: 1; padding-top: 10px; }
.date-tile .dt-month { display: block; font-weight: 600; padding: 2px 0 12px; font-size: .95rem; }

/* ---------- Superfici ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; margin-bottom: 20px; }
.booking-form { box-shadow: 0 18px 40px -24px rgba(15, 42, 82, .35); border: 0; }
.card.center { text-align: center; max-width: 560px; margin: 24px auto; }
.danger-zone { background: transparent; border: 1px dashed #e3b9b4; }
.danger-zone h2 { color: var(--ink); font-size: 1.1rem; }

/* Passi del modulo (sono davvero in sequenza) */
h2.step { display: flex; align-items: center; gap: 12px; }
.step-n { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); color: var(--navy);
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.step-help { margin: -6px 0 16px; color: var(--muted); }

/* ---------- Campi ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-weight: normal; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm); transition: border-color .15s;
}
input:hover, select:hover, textarea:hover { border-color: #b9c6d8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 99, 198, .18); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0 12px; }
.narrow { max-width: 220px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; }
.check-line input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); flex-shrink: 0; }
.hint { margin: -8px 0 18px; }
.field-label { margin: 0 0 10px; font-weight: 600; font-size: .92rem; color: var(--ink); }

/* ---------- Pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--blue); color: #fff; border: 0;
  border-radius: 999px; padding: 12px 24px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s; }
.btn:hover { background: var(--blue-d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-big { padding: 15px 34px; font-size: 1.08rem; margin-top: 6px; }
.btn-secondary { background: #fff; color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.btn-secondary:hover { background: #eef4fc; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #a42c23; }
.link-danger { background: none; border: 0; color: var(--err); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* ---------- Avvisi ---------- */
.alert { padding: 13px 16px; border-radius: var(--r-md); margin-bottom: 16px; border-left: 4px solid; background: #fff; }
.alert-ok { border-color: var(--ok); color: #0d5f40; background: #e9f6f0; }
.alert-err { border-color: var(--err); color: #8f2219; background: #fdeeec; }
.alert-warn { border-color: #e2a500; color: var(--warn); background: #fff7e2; }

/* ---------- Indirizzi da visitare ---------- */
.visits { display: grid; gap: 12px; margin-bottom: 8px; }
.visit { --cc: var(--blue); border: 2px solid var(--line); border-radius: var(--r-md); background: #fff; transition: border-color .15s, box-shadow .15s; }
.visit-head { display: flex; align-items: center; gap: 14px; margin: 0; padding: 14px 16px; cursor: pointer; font-weight: normal; position: relative; }
.visit-head input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.visit-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--cc) 14%, #fff); color: var(--cc); }
.visit-icon .ico { width: 26px; height: 26px; }
.visit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.visit-head .course-name { font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--navy); line-height: 1.2; }
.visit-head .free { font-size: .88rem; color: var(--muted); }
.visit-check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: grid; place-items: center; transition: all .15s; }
.visit-check svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.visit-head:hover .visit-check { border-color: var(--cc); }
.visit-head input:focus-visible ~ .visit-check { outline: 3px solid var(--sun); outline-offset: 2px; }
.visit:has(.visit-toggle:checked), .visit.open { border-color: var(--cc); box-shadow: 0 10px 24px -16px var(--cc); }
.visit:has(.visit-toggle:checked) .visit-check, .visit.open .visit-check { background: var(--cc); border-color: var(--cc); }
.visit:has(.visit-toggle:checked) .visit-check svg, .visit.open .visit-check svg { opacity: 1; }
.visit-slots { display: none; padding: 4px 16px 18px; border-top: 1px dashed var(--line); margin: 0 16px; padding-inline: 0; }
.visit:has(.visit-toggle:checked) .visit-slots, .visit.open .visit-slots { display: block; padding-top: 14px; }
.visit.full { background: #f6f8fb; }
.visit.full .visit-head { cursor: not-allowed; }
.visit.full .visit-icon { filter: grayscale(1); opacity: .6; }
.visit.full .course-name { color: var(--muted); }

/* Orari come biglietti */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.slot { --cc2: var(--cc, var(--blue)); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 11px 14px 10px; margin: 0; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); cursor: pointer; font-weight: normal;
  transition: border-color .15s, background .15s, transform .1s; }
.slot::before, .slot::after { /* tacche del biglietto */
  content: ""; position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--line); transform: translateY(-50%); }
.slot::before { left: -7px; clip-path: inset(0 0 0 50%); }
.slot::after { right: -7px; clip-path: inset(0 50% 0 0); }
.visit-slots .slot::before, .visit-slots .slot::after { background: #fff; }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot .time { font-family: var(--display); font-weight: 600; font-size: 1.3rem; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.slot .time small { font-size: .8rem; font-family: var(--body); font-weight: 500; color: var(--muted); margin-left: 2px; }
.slot .free { font-size: .8rem; color: var(--ok); font-weight: 600; }
.slot:hover { border-color: var(--cc2); }
.slot:has(input:checked) { background: color-mix(in srgb, var(--cc2) 16%, #fff); border: 2px solid var(--cc2); padding: 10px 13px 9px; }
.slot:has(input:checked)::before, .slot:has(input:checked)::after { border-color: var(--cc2); border-width: 2px; }
.slot:has(input:checked) .free { color: color-mix(in srgb, var(--cc2) 65%, #000); }
.slot:has(input:checked) .free::before { content: "✓ "; }
.slot:has(input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 2px; }
.slot.full { cursor: not-allowed; background: #f5f7fa; border-style: dashed; }
.slot.full .time { color: #9aa6b8; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.slot.full .free { color: var(--muted); font-weight: 500; }
.slot.full:hover { border-color: var(--line); }
.slot.mine:not(:has(input:checked)) { border-color: var(--cc2); border-style: dashed; }

/* Etichetta indirizzo */
.course-pill { --cc: var(--blue); display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--cc) 13%, #fff); color: color-mix(in srgb, var(--cc) 70%, #000); font-weight: 700; font-size: .92rem; }
.course-pill .ico { width: 16px; height: 16px; }
svg.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Conferma "biglietto" ---------- */
.ticket { max-width: 520px; margin: 0 auto 24px; background: #fff; border-radius: var(--r-lg); box-shadow: 0 24px 50px -28px rgba(15, 42, 82, .5); overflow: hidden; text-align: center; }
.ticket-top { background: var(--sun); padding: 26px 24px 30px; position: relative; }
.ticket-top h2 { margin: 10px 0 4px; font-size: 1.6rem; }
.ticket-top p { margin: 0; font-weight: 600; color: var(--navy); }
.ticket-top::after { /* linea di strappo */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 12px;
  background: radial-gradient(circle at 8px 12px, #fff 6px, transparent 6.5px) 0 0 / 16px 12px repeat-x; }
.check { width: 56px; height: 56px; border-radius: 50%; background: var(--navy); margin: 0 auto; display: grid; place-items: center; }
.check svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ticket-body { padding: 22px 26px 26px; }
.ticket-people { font-weight: 600; }
.visit-list { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.visit-list li { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.visit-list.left li { justify-content: flex-start; }
.vl-time { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- Scelta della giornata ---------- */
.events { display: grid; gap: 14px; }
.event-link { display: flex; align-items: center; gap: 22px; padding: 18px 22px 18px 18px; background: #fff; border-radius: var(--r-lg);
  text-decoration: none; color: var(--ink); box-shadow: 0 14px 30px -22px rgba(15, 42, 82, .5); border: 2px solid transparent; transition: border-color .15s; }
.event-link:hover { border-color: var(--blue); }
.event-link .date-tile { width: 84px; transform: none; box-shadow: none; border: 1.5px solid var(--line); }
.event-link .date-tile .dt-day { font-size: 2.2rem; padding-top: 6px; }
.event-link .date-tile .dt-month { padding-bottom: 8px; font-size: .82rem; }
.ev-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-text strong { font-family: var(--display); font-size: 1.3rem; color: var(--navy); }
.ev-go { font-weight: 700; color: var(--blue); }

/* ---------- Pagina "La tua prenotazione" ---------- */
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 20px; }
.summary span.muted { display: block; font-size: .85rem; }
.summary strong { font-weight: 600; }
.summary .span-all { grid-column: 1 / -1; }
.summary .visit-list { margin: 6px 0 0; }

/* ---------- Piè di pagina ---------- */
.foot { border-top: 1px solid var(--line); background: #fff; }
.foot .wrap { display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: baseline; padding-block: 18px; font-size: .88rem; color: var(--muted); }
.foot strong { color: var(--navy); }
.foot span:last-child { margin-left: auto; }

/* =========================================================
   Area amministratore: stessa identità, più sobria
   ========================================================= */
.is-admin main.wrap { max-width: 1100px; }
.is-admin header.top .wrap { max-width: 1100px; }
.is-admin h1 { font-size: 1.8rem; }
.login { max-width: 400px; margin: 48px auto; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .82rem; font-weight: 600; color: var(--muted); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions a { margin-left: 14px; font-weight: 600; }
.table .actions form { display: inline-flex; gap: 10px; align-items: center; margin: 0; }
.table tr.past td { color: var(--muted); }
.table tfoot td { border-bottom: 0; padding-top: 12px; }
.table td .cap + .small { display: block; margin-top: 3px; }
body > main > .table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); }
.cap { width: 88px !important; display: inline-block !important; margin: 0 !important; padding: 8px 10px !important; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; margin: 0; }
.inline input[type=checkbox] { margin: 0; }
.inline-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.inline-form input[type=text] { width: 180px; margin: 0; }
.tag { display: inline-block; font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: #eceff4; color: var(--muted); font-weight: 600; }
.tag-ok { background: #e3f4ec; color: var(--ok); }
.tag-off { background: #fdeceb; color: var(--err); }
.tag-course { background: var(--bg); color: var(--navy); }
.bar { display: inline-block; width: 90px; height: 8px; background: #e5eaf1; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.slot-block h2 { margin: 0; }
.slot-block .table { margin-top: 8px; }
.course-row { margin: 16px 0 4px; }
.preview { min-height: 1.4em; margin: -4px 0 14px; }
.gen-title { margin: 0 0 8px; }
.cap-head { white-space: nowrap; }
code { background: #eef1f6; padding: 1px 6px; border-radius: 4px; }

/* Schede indirizzo (filtri admin) */
.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.course { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--r-md);
  text-decoration: none; color: var(--ink); background: #fff; }
.course:hover { border-color: var(--blue); }
.course .course-name { font-weight: 700; }
.course.selected { border-color: var(--blue); background: #eef4fc; }
.courses.compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 18px; }
.courses.compact .course { padding: 8px 12px; align-items: center; }

/* ---------- Schermi stretti ---------- */
@media (max-width: 760px) {
  .grid5, .grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 20px 16px; }
  .hero-inner { padding-block: 26px 70px; gap: 16px; align-items: flex-start; }
  .date-tile { width: 86px; }
  .date-tile .dt-day { font-size: 2.3rem; }
  .brand .logo { height: 34px; }
  .brand-tag { font-size: .95rem; padding-left: 10px; }
  .event-link { gap: 14px; padding: 14px; }
  .ev-go { display: none; }
  .slots { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  header.top, .hero, .foot, .no-print, .alert { display: none !important; }
  body { background: #fff; }
  main.after-hero { margin-top: 0; }
  .card { border: 0; padding: 0; break-inside: avoid; box-shadow: none; }
}
.logo-text { font-family: var(--display); font-weight: 800; font-size: 1.35rem; color: var(--navy); }
.nowrap { white-space: nowrap; }
/* =========================================================
   Campi configurabili e popup degli avvisi
   ========================================================= */
.req { color: var(--err); }
.field-help { display: block; margin-top: 5px; font-weight: 400; font-size: .84rem; color: var(--muted); }
textarea { resize: vertical; min-height: 84px; }
.notes-text { font-weight: 400; white-space: normal; }

/* Finestra popup */
.od-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.od-modal[hidden] { display: none; }
.od-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 24, 48, .55); backdrop-filter: blur(2px); }
.od-modal-box { --tone: var(--blue); position: relative; width: min(460px, 100%); background: #fff; border-radius: var(--r-lg);
  padding: 30px 26px 24px; text-align: center; box-shadow: 0 30px 70px -20px rgba(5, 18, 40, .6); border-top: 6px solid var(--tone);
  animation: od-pop .18s ease-out; }
.od-modal-confirm .od-modal-box { --tone: var(--sun); }
.od-modal-block .od-modal-box { --tone: var(--err); }
.od-modal-icon { width: 54px; height: 54px; margin: -58px auto 12px; border-radius: 50%; background: var(--tone); color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.7rem; border: 4px solid #fff; }
.od-modal-confirm .od-modal-icon { color: var(--navy); }
.od-modal-box h2 { margin: 0 0 10px; font-size: 1.35rem; }
.od-modal-text p { margin: 0 0 10px; color: var(--ink); }
.od-modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.od-modal-block .od-modal-actions .btn { background: var(--err); }
body.od-modal-open { overflow: hidden; }
@keyframes od-pop { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* Interruttore sì/no (area amministratore) */
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-weight: 600; font-size: .88rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span::before { content: ""; display: inline-block; vertical-align: middle; width: 38px; height: 22px; border-radius: 999px;
  background: #cfd8e4; transition: background .15s; margin-right: 0; }
.switch span { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span::before { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span::before { outline: 3px solid var(--sun); outline-offset: 2px; }
.switch input:disabled + span { opacity: .35; cursor: not-allowed; }

.fields-table td { vertical-align: middle; }
.fields-table input[type=text] { margin: 0; min-width: 170px; padding: 9px 11px; }
.fields-table tr.is-off td:not(:nth-child(2)) { opacity: .45; }
.notes-list { margin: 14px 0 0; padding-left: 18px; }
.notes-list li { margin-bottom: 4px; }

/* Regole */
.rule-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; font-size: .88rem; }
.rule-legend > div { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); border-left: 4px solid var(--blue); }
.rule-legend [data-type=confirm] { border-color: var(--sun); }
.rule-legend [data-type=block] { border-color: var(--err); }
.rules { display: grid; gap: 12px; margin-bottom: 14px; }
.rule { border: 1.5px solid var(--line); border-left: 5px solid var(--blue); border-radius: var(--r-md); padding: 14px 16px; background: #fff; display: grid; gap: 10px; }
.rule[data-type=confirm] { border-left-color: var(--sun); }
.rule[data-type=block] { border-left-color: var(--err); }
.rule.is-off { background: #f7f9fc; }
.rule.is-off .rule-cond, .rule.is-off .rule-act, .rule.is-off .r-msg { opacity: .55; }
.rule.is-deleted { opacity: .35; }
.rule-top { display: flex; justify-content: space-between; align-items: center; }
.rule-cond, .rule-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-cond select, .rule-cond input, .rule-act select { width: auto; margin: 0; padding: 9px 11px; }
.rule-cond .r-value { width: 84px; }
.rule-word { font-weight: 600; color: var(--muted); }
.rule textarea { margin: 0; min-height: 60px; }
.rule-foot { display: flex; justify-content: flex-end; }
.rule-del { color: var(--err); }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sticky-save .btn-big { margin: 0; }
.sticky-save a { font-weight: 600; }
@media (max-width: 700px) {
  .rule-legend { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .od-modal-box { animation: none; } }
.booking-notes { min-width: 160px; max-width: 280px; }
@media (max-width: 600px) {
  .brand { gap: 10px; }
  .brand-tag { font-size: .82rem; line-height: 1.2; max-width: 170px; }
}

/* Impostazioni del modulo: predefinite o per singolo open day */
.scope-card label { margin: 0; }
.scope-card select { max-width: 520px; font-weight: 600; }
.scope-note { margin: 10px 0 0; }
.mode-card h2 { margin-bottom: 14px; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-opt { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-weight: 400; }
.mode-opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); flex-shrink: 0; }
.mode-opt strong { display: block; color: var(--navy); }
.mode-opt small { display: block; color: var(--muted); font-size: .86rem; margin-top: 2px; }
.mode-opt:has(input:checked) { border-color: var(--blue); background: #eef4fc; }
#custom-area.is-default { display: none; }
.reset-form { margin: 4px 0 20px; }
.tag-custom { background: #fff4d6; color: #7a5600; margin-left: 6px; }
@media (max-width: 700px) { .mode-options { grid-template-columns: 1fr; } }
