:root {
  --bg: #f7f3ee;
  --card: #ffffff;
  --text: #22191a;
  --muted: #6e6264;
  --border: #e6dcd3;
  --accent: #7a1022;
  --accent-text: #ffffff;
  --accent-soft: #f7e7ea;
  --gold: #b8901f;
  --gold-bright: #e9c766;
  --hero-from: #2c0510;
  --hero-to: #7a1022;
  --error: #b42318;
  --ok: #1d7a46;
  --shadow: 0 1px 2px rgba(40, 10, 15, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #150f10;
    --card: #1f1718;
    --text: #f3ecea;
    --muted: #a8999b;
    --border: #3a2c2e;
    --accent: #e0607a;
    --accent-text: #1a0a0e;
    --accent-soft: #3a1820;
    --gold: #e0bd5c;
    --gold-bright: #f0d27f;
    --hero-from: #1a0308;
    --hero-to: #5a0b19;
    --error: #f97066;
    --ok: #4ade80;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #150f10; --card: #1f1718; --text: #f3ecea; --muted: #a8999b; --border: #3a2c2e;
  --accent: #e0607a; --accent-text: #1a0a0e; --accent-soft: #3a1820; --gold: #e0bd5c;
  --gold-bright: #f0d27f; --hero-from: #1a0308; --hero-to: #5a0b19; --error: #f97066; --ok: #4ade80;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.serif { font-family: "Playfair Display", Georgia, serif; }

button {
  font: inherit;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: progress; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

fieldset, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 0 0 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}
legend { font-weight: 600; padding: 0 6px; }
label.field { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.hint { font-size: .85rem; color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.errors {
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--card);
}
.errors ul { margin: 6px 0 0; padding-left: 18px; }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Intestazione evento */
.hero {
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: #f6e9d6;
  border-bottom: 3px solid var(--gold-bright);
}
.hero-inner { max-width: 820px; margin: 0 auto; padding: 20px 16px 28px; }
.hero-top { display: flex; justify-content: flex-end; min-height: 36px; }
.hero h1 {
  margin: 4px 0 6px;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.15;
  color: var(--gold-bright);
}
.hero h1 em { display: block; font-weight: 500; font-size: .62em; color: #f6e9d6; }
.hero .meta { margin: 0; font-size: .95rem; opacity: .9; }
.hero .meta span + span::before { content: " · "; }

/* Selettore lingua */
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; font-size: .9rem; font-weight: 600;
  background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .3); color: #fff;
}
.lang-btn:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); }
.lang-btn .caret { font-size: .7rem; opacity: .8; }
.flag { width: 21px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: none; display: block; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  list-style: none; margin: 0; padding: 6px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  min-width: 180px;
}
.lang-menu[hidden] { display: none; }
.lang-menu li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .95rem;
}
.lang-menu li b { width: 24px; }
.lang-menu li span { color: var(--muted); }
.lang-menu li:hover, .lang-menu li.active { background: var(--accent-soft); }
.lang-menu li[aria-selected=true] b { color: var(--accent); }

@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  fieldset, .card { box-shadow: none; border-color: #ccc; }
}
