:root {
  --navy: #003087;
  --navy-deep: #00245f;
  --navy-soft: #eaf0f8;
  --green: #00a650;
  --green-deep: #008941;
  --green-soft: #eef8f2;
  --orange: #e86f19;
  --orange-soft: #fff4e9;
  --red: #c83232;
  --red-soft: #fff0f0;
  --ink: #15212b;
  --muted: #60707e;
  --line: #dce4e9;
  --surface: #ffffff;
  --background: #f4f7f9;
  --shadow: 0 10px 32px rgba(20, 37, 52, .09);
  --shadow-sm: 0 4px 15px rgba(20, 37, 52, .07);
  --radius: 18px;
  --radius-sm: 12px;
  --content: 1080px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--background); }
body { margin: 0; min-height: 100vh; background: var(--background); line-height: 1.45; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--navy); }
img { max-width: 100%; display: block; }

.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 9999;
  background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  min-height: 70px; padding: 9px max(16px, env(safe-area-inset-left));
  background: rgba(255,255,255,.96); border-bottom: 1px solid rgba(220,228,233,.9);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand span { display: grid; min-width: 0; }
.brand strong { color: var(--navy); font-size: 16px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-content: center; gap: 5px; border-radius: 12px; cursor: pointer; }
.icon-button span { width: 22px; height: 2px; background: var(--navy); border-radius: 2px; }
.main-nav { grid-column: 1 / -1; display: none; padding: 8px 0 4px; }
.main-nav.open { display: grid; }
.main-nav a { text-decoration: none; font-weight: 700; padding: 12px 8px; border-top: 1px solid var(--line); }

main { min-height: 70vh; }
.view { animation: enter .2s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.hero { position: relative; background: var(--surface); overflow: hidden; }
.hero-photo { position: relative; height: 270px; overflow: hidden; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 72%; }
.hero-photo::after { content: ""; position: absolute; inset: auto 0 0; height: 75%; background: linear-gradient(to top, rgba(0,36,95,.42), transparent 70%); pointer-events: none; }
.hero-content { position: relative; max-width: 760px; margin: -32px auto 0; padding: 0 16px 24px; z-index: 2; }
.hero-card { background: var(--surface); border-radius: 24px; padding: 22px 18px; box-shadow: var(--shadow); text-align: center; }
.date-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; color: var(--orange); background: var(--orange-soft); border: 1px solid #f4cda9; border-radius: 999px; font-size: 13px; font-weight: 800; }
.hero h1 { color: var(--navy); font-size: clamp(30px, 8vw, 44px); line-height: 1.08; margin: 13px 0 3px; letter-spacing: -.025em; }
.hero-location { color: var(--green-deep); font-size: 19px; font-weight: 800; margin: 0 0 18px; }
.organizer-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.organizers { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: stretch; gap: 8px; }
.organizer { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 9px 5px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.organizer .logo-box { height: 46px; width: 100%; display: grid; place-items: center; overflow: hidden; }
.organizer img { max-width: 100%; max-height: 46px; object-fit: contain; }
.organizer.us img { width: 46px; height: 46px; }
.organizer.hunters .logo-box { height: 40px; }
.organizer.hunters img { max-height: 40px; }
.organizer.choir img { height: 46px; width: 46px; object-fit: cover; border-radius: 8px; }
.organizer span { font-size: 10px; line-height: 1.15; color: var(--navy-deep); font-weight: 750; }
.hero-actions { display: grid; gap: 10px; margin-top: 18px; }
.deadline { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 12px; border-radius: 12px; background: var(--orange-soft); border: 1px solid #f4cda9; color: #754018; font-size: 13px; font-weight: 700; }
.deadline.closed { background: var(--red-soft); border-color: #efb5b5; color: #8c2727; }

.section { padding: 28px 16px; }
.section-inner { max-width: var(--content); margin: 0 auto; }
.section-title { color: var(--navy); font-size: 24px; line-height: 1.15; margin: 0 0 16px; letter-spacing: -.015em; }
.section-subtitle { color: var(--muted); margin: -8px 0 18px; }
.info-grid { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.card h2, .card h3 { color: var(--navy); margin-top: 0; }
.card h3 { font-size: 17px; margin-bottom: 10px; }
.card p:last-child { margin-bottom: 0; }

.timeline { display: grid; gap: 10px; }
.timeline-item { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: start; }
.timeline-time { color: var(--navy); font-weight: 850; font-variant-numeric: tabular-nums; padding-top: 12px; }
.timeline-content { padding: 11px 13px; border-radius: 12px; background: #f8fafb; border: 1px solid var(--line); }
.timeline-content strong { font-size: 14px; }
.price-list, .summary-list { display: grid; gap: 0; }
.price-row, .summary-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.price-row:last-child, .summary-row:last-child { border-bottom: 0; }
.price-row strong { color: var(--green-deep); font-size: 17px; }
.notice { border-left: 4px solid var(--navy); background: var(--navy-soft); padding: 13px 14px; border-radius: 0 11px 11px 0; color: #31475c; }
.notice.weather { border-left-color: var(--green); background: var(--green-soft); }
.notice.warning { border-left-color: var(--orange); background: var(--orange-soft); }
.notice.danger { border-left-color: var(--red); background: var(--red-soft); color: #7d2727; }

.button { min-height: 48px; border: 1px solid transparent; border-radius: 12px; padding: 12px 16px; font-weight: 800; cursor: pointer; transition: transform .06s ease, background .15s ease, opacity .15s ease; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-deep); }
.button-secondary { background: #fff; color: var(--navy); border-color: #9ab0cf; }
.button-navy { background: var(--navy); color: #fff; }
.button-danger { background: #fff; color: var(--red); border-color: #dc7777; }
.button-wide { width: 100%; }
.button-small { min-height: 38px; padding: 8px 11px; border-radius: 9px; font-size: 13px; }

.form-shell { max-width: 650px; margin: 0 auto; }
.form-card { background: var(--surface); padding: 20px 16px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.form-header { margin-bottom: 18px; }
.form-header h1 { margin: 0 0 5px; color: var(--navy); font-size: 27px; }
.form-header p { margin: 0; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 750; font-size: 14px; }
.field input { min-height: 48px; width: 100%; border: 1px solid #cdd8df; border-radius: 11px; background: #fff; color: var(--ink); padding: 10px 12px; outline: none; }
.field input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0,48,135,.12); }
.field-help { color: var(--muted); font-size: 12px; }
.honeypot { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(1px,1px,1px,1px) !important; }
.form-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.form-section h2 { color: var(--navy); font-size: 18px; margin: 0 0 12px; }
.counter-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 0; }
.counter-label { font-weight: 700; }
.counter-label small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.counter { display: grid; grid-template-columns: 42px 34px 42px; align-items: center; gap: 6px; }
.counter button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #f3f6f8; color: var(--navy); font-size: 22px; line-height: 1; cursor: pointer; }
.counter button.plus { background: var(--green); color: #fff; border-color: var(--green); }
.counter button:disabled { opacity: .4; cursor: not-allowed; }
.counter output { text-align: center; color: var(--green-deep); font-weight: 850; font-size: 18px; font-variant-numeric: tabular-nums; }
.computed-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; }
.computed-row strong { color: var(--green-deep); font-size: 19px; }
.contribution-card { margin-top: 14px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, #f6fcf8, #e7f7ed); border: 1px solid #a9dfbd; }
.contribution-card span { display: block; color: #426354; font-size: 13px; }
.contribution-card strong { display: block; color: var(--green-deep); font-size: 34px; line-height: 1.1; margin-top: 4px; }
.form-actions { display: grid; gap: 10px; margin-top: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); text-decoration: none; font-weight: 750; margin-bottom: 14px; }

.summary-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.summary-row span:first-child { color: var(--muted); }
.summary-row strong { text-align: right; }
.summary-row.total { margin-top: 3px; padding-top: 13px; border-top: 2px solid #d7e0e6; }
.summary-row.contribution strong { color: var(--green-deep); font-size: 24px; }
.success-icon { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 35px; font-weight: 800; }
.success-panel { text-align: center; max-width: 620px; margin: 0 auto; }
.success-panel .summary-card { text-align: left; margin-top: 20px; }

.search-box { display: flex; gap: 8px; }
.search-box input { flex: 1; min-width: 0; }
.search-results { display: grid; gap: 10px; margin-top: 16px; }
.search-result { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.search-result strong { display: block; }
.search-result small { display: block; margin-top: 2px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-state { text-align: center; color: var(--muted); padding: 20px 8px; }
.verify-card { border: 1px solid #b9d7c5; background: var(--green-soft); border-radius: 13px; padding: 14px; margin-bottom: 17px; }
.verify-card strong { color: var(--navy); }
.masked-email { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; color: var(--navy); }

.privacy-note { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 14px; }

.site-footer { padding: 30px 16px max(30px, env(safe-area-inset-bottom)); background: #eaf0f3; border-top: 1px solid var(--line); color: #465662; }
.footer-inner { max-width: var(--content); margin: 0 auto; display: grid; gap: 16px; }
.site-footer p { margin: 4px 0 0; font-size: 13px; }
.admin-link { font-size: 13px; color: var(--navy); }

.toast { position: fixed; z-index: 500; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: calc(100% - 32px); max-width: 520px; padding: 13px 16px; border-radius: 12px; background: #17212b; color: #fff; box-shadow: var(--shadow); font-weight: 650; }
.toast.error { background: #8c2727; }
.toast.success { background: #076f3b; }

.dialog { border: 0; padding: 0; border-radius: 18px; max-width: 440px; width: calc(100% - 28px); box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(0,20,38,.55); backdrop-filter: blur(2px); }
.dialog-card { padding: 22px; text-align: center; }
.dialog-card h2 { color: var(--navy); margin: 10px 0 8px; }
.dialog-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; font-weight: 900; font-size: 25px; }
.dialog-icon.danger { background: var(--red-soft); color: var(--red); }
.dialog-actions { display: grid; gap: 9px; margin-top: 20px; }

.loading { display: grid; place-items: center; min-height: 220px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid #dce4e9; border-top-color: var(--navy); border-radius: 50%; animation: spin .75s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

.admin-page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 50px; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.admin-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 16px 0 22px; }
.metric { padding: 15px; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 4px; color: var(--navy); font-size: 26px; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
table.admin-table { width: 100%; border-collapse: collapse; min-width: 950px; }
.admin-table th, .admin-table td { padding: 10px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
.admin-table th { position: sticky; top: 0; background: #f4f7f9; color: var(--navy); }
.status-pill { padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-pill.cancelled { color: #8c2727; background: #ffeded; }

@media (min-width: 700px) {
  .site-header { grid-template-columns: auto 1fr; padding-left: 24px; padding-right: 24px; }
  .icon-button { display: none; }
  .main-nav { grid-column: auto; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 0; }
  .main-nav a { border: 0; padding: 10px 11px; border-radius: 9px; }
  .main-nav a:hover { background: var(--navy-soft); }
  .hero-photo { height: 390px; }
  .hero-content { margin-top: -48px; }
  .hero-card { padding: 28px; }
  .hero-actions { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1.2fr .8fr; align-items: start; }
  .form-card { padding: 26px; }
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
  .dialog-actions { grid-template-columns: 1fr 1fr; }
  .admin-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (min-width: 1000px) {
  .hero-photo { height: 440px; }
  .section { padding-top: 38px; padding-bottom: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Utility classes used by generated views; kept in CSS so CSP can block inline styles. */
.info-stack { grid-template-columns: 1fr !important; }
.section-flush-top { padding-top: 0; }
.computed-help { display: block; color: var(--muted); }
.back-link-button { border: 0; background: none; padding: 0; cursor: pointer; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.form-section-first { border-top: 0; margin-top: 0; padding-top: 0; }
.admin-login-field { margin-top: 16px; }
.admin-title { margin: 0; color: var(--navy); }
.admin-muted { color: var(--muted); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* v0.2 - capienza e lista d'attesa */
.capacity-card {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #cdd9e4;
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fbfd 0%, #f3f7fa 100%);
  text-align: left;
}
.capacity-head, .waitlist-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.capacity-head span, .waitlist-line span { color: var(--navy); font-weight: 800; font-size: 13px; }
.capacity-head strong { color: var(--green-deep); font-size: 25px; line-height: 1; font-variant-numeric: tabular-nums; }
.capacity-head strong small { color: var(--muted); font-size: 14px; font-weight: 750; }
.capacity-note { margin-top: 6px; color: var(--muted); font-size: 12px; }
.waitlist-line { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.waitlist-line strong { color: #9a4c10; font-size: 15px; font-variant-numeric: tabular-nums; }
.capacity-loading { color: var(--muted); text-align: center; font-size: 13px; padding: 5px; }
.capacity-progress {
  display: block;
  width: 100%;
  height: 9px;
  margin-top: 9px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #dfe8ed;
  accent-color: var(--green);
}
.capacity-progress::-webkit-progress-bar { background: #dfe8ed; border-radius: 999px; }
.capacity-progress::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.capacity-progress::-moz-progress-bar { background: var(--green); border-radius: 999px; }
.capacity-progress.waitlist { accent-color: var(--orange); }
.capacity-progress.waitlist::-webkit-progress-value { background: var(--orange); }
.capacity-progress.waitlist::-moz-progress-bar { background: var(--orange); }
.capacity-form-notice { margin-bottom: 16px; }
.success-icon.waitlist { background: var(--orange-soft); color: var(--orange); }
.search-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
}
.search-status.confirmed { color: #076f3b; background: #e7f7ed; }
.search-status.waitlist { color: #8a480f; background: #fff1df; }

.status-pill.confirmed { color: #076f3b; background: #e7f7ed; }
.status-pill.waitlist { color: #8a480f; background: #fff1df; }

.admin-capacity-card {
  display: grid;
  gap: 14px;
  margin: 16px 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.admin-capacity-card h2 { margin: 0 0 4px; color: var(--navy); font-size: 20px; }
.admin-capacity-card p { margin: 0; color: var(--muted); font-size: 13px; }
.admin-capacity-fields { display: grid; gap: 12px; }
.admin-capacity-fields .field { margin-bottom: 0; }
.admin-capacity-action { display: flex; justify-content: flex-start; }

@media (min-width: 700px) {
  .admin-capacity-fields { grid-template-columns: 1fr 1fr; }
  .admin-capacity-card { grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); align-items: end; }
  .admin-capacity-card > .notice { grid-column: 1 / -1; }
  .admin-capacity-action { grid-column: 2; justify-content: flex-end; }
}

.admin-email-check {
  margin: 16px 0 22px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.admin-email-check.ok {
  background: #eef8f2;
  border-color: #bfe4cc;
  color: #076f3b;
}
.admin-email-check.warning {
  background: #fff8ee;
  border-color: #f2c793;
}
.admin-email-check-head strong { color: #8a480f; font-size: 17px; }
.admin-email-check-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.admin-email-pairs { display: grid; gap: 10px; margin-top: 14px; }
.admin-email-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid #efd6b8;
  border-radius: 12px;
  background: #fff;
}
.admin-email-score { font-weight: 850; color: #8a480f; }
.admin-email-reason { color: var(--muted); font-size: 12px; line-height: 1.4; }
.admin-email-side {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.admin-email-side strong { color: var(--navy); }
.admin-email-side code {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  color: #34495e;
  background: #f5f7f9;
  padding: 5px 7px;
  border-radius: 7px;
}
.admin-email-side .button { grid-column: 2; grid-row: 1; }

@media (min-width: 780px) {
  .admin-email-pair {
    grid-template-columns: 1fr 1fr;
  }
  .admin-email-score,
  .admin-email-reason { grid-column: 1 / -1; }
}
