/* =========================================================================
   SSCN Lounge — stile ispirato a sscnapoli.it
   Azzurro, blu navy profondo, accento rosso; Oswald per i titoli, Work Sans per i testi.
   ========================================================================= */

:root {
  --navy: #06325F;
  --navy-2: #053464;
  --navy-deep: #021B2F;
  --azzurro: #0098D7;
  --azzurro-2: #2293CD;
  --azzurro-dark: #0079ad;
  --azzurro-soft: #e5f4fb;
  --red: #E33555;
  --red-dark: #c42443;
  --red-soft: #fdecef;
  --amber: #f0a400;
  --amber-soft: #fff6e2;
  --bg: #F5F5F5;
  --surface: #fff;
  --text: #212529;
  --muted: #6b7887;
  --line: #e3e7ec;
  --line-strong: #cdd5de;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(2, 27, 47, .05), 0 6px 18px rgba(2, 27, 47, .06);
  --shadow-lg: 0 18px 50px rgba(2, 27, 47, .22);
  --font-display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar-h: 64px;
  --guest-cols: minmax(0, 2.3fr) minmax(0, 1fr) minmax(0, 1.1fr) 132px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body > main, body > .page-main { flex: 1 0 auto; }
a { color: var(--azzurro); text-decoration: none; }
a:hover { color: var(--azzurro-dark); }
img { max-width: 100%; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: 1.05;
  color: var(--navy);
  margin: 0 0 .5em;
}
p { margin: 0 0 1em; }
.ico { width: 20px; height: 20px; flex: none; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ---------- utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.lead { font-size: 18px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 720px) { .hide-sm { display: none !important; } }

/* =========================================================================
   Topbar (come l'header bianco del sito con logo centrale)
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.topbar-left { justify-self: start; display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-right { justify-self: end; display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand:hover { color: var(--navy); }
.brand img { width: 46px; height: 46px; display: block; }
.brand-text {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1;
}
.brand-text small { display: block; margin-top: 3px; font-size: 11px; letter-spacing: .24em; color: var(--azzurro); }
@media (max-width: 560px) { .brand-text { display: none; } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.icon-btn:hover { background: var(--bg); color: var(--navy); }
.icon-btn .ico { width: 22px; height: 22px; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; padding: 0 4px; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .04em;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--azzurro);
}
.usermenu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 260px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 70;
}
.usermenu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.usermenu-head strong { display: block; color: var(--navy); }
.usermenu-head span { font-size: 13px; color: var(--muted); }
.usermenu-panel a, .usermenu-panel button {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px;
  border: 0; border-radius: 4px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--bg); color: var(--navy); }
.usermenu-panel .ico { color: var(--azzurro); }
.usermenu-panel button.danger .ico { color: var(--red); }

/* ---------- barra di navigazione backend ---------- */
.adminnav {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 45;
  background: var(--navy);
}
.adminnav .container { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.adminnav .container::-webkit-scrollbar { display: none; }
.adminnav a {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 11px;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, .78);
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.adminnav a .ico { width: 18px; height: 18px; }
.adminnav a:hover, .adminnav a.active { color: #fff; border-bottom-color: var(--azzurro); }

/* =========================================================================
   Hero (fasce blu con grande scritta in trasparenza, come il sito)
   ========================================================================= */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 40px 0 34px;
  background:
    radial-gradient(900px 380px at 88% -20%, rgba(0, 152, 215, .42), transparent 62%),
    linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 58%, #0a4c88 100%);
}
.hero::before {
  content: attr(data-bg);
  position: absolute;
  right: -0.04em;
  bottom: -0.2em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(96px, 15vw, 230px);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .1);
  pointer-events: none;
}
.hero .container { position: relative; }
.hero h1 { color: #fff; font-size: clamp(32px, 4.6vw, 54px); margin: 8px 0 10px; }
.hero p { color: rgba(255, 255, 255, .8); margin: 0; max-width: 760px; }
.hero-compact { padding: 28px 0 24px; }
.hero-compact h1 { font-size: clamp(28px, 3.6vw, 42px); margin-bottom: 4px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 6px; color: rgba(255, 255, 255, .86); font-size: 15px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta .ico { width: 18px; height: 18px; color: var(--azzurro); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }

.kicker { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); text-transform: uppercase; flex-wrap: wrap; }
.kicker-label { color: var(--red); font-size: 20px; letter-spacing: .01em; line-height: 1; }
.kicker-meta { font-family: var(--font-body); font-size: 13px; color: rgba(255, 255, 255, .72); text-transform: none; }
.kicker-center { justify-content: center; }
.on-light .kicker-meta, .card .kicker-meta { color: var(--muted); }

/* =========================================================================
   Pulsanti
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 2px solid transparent;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 20px; height: 20px; }
.btn-primary { background: var(--azzurro); color: #fff; }
.btn-primary:hover { background: var(--azzurro-dark); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-deep); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-light { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-light:hover { border-color: var(--navy); color: var(--navy); }
.btn-ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--navy); border-color: #fff; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; gap: 6px; }
.btn-sm .ico { width: 17px; height: 17px; }
.btn-lg { min-height: 60px; padding: 0 28px; font-size: 20px; }
.btn-xl { min-height: 72px; padding: 0 32px; font-size: 24px; }
.btn-block { width: 100%; }
.btn-square { width: 40px; min-height: 40px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* =========================================================================
   Pagina, card, tile
   ========================================================================= */
.page { padding: 28px 0 72px; }
.section { margin-top: 36px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 28px; }
.section-head .kicker-label { font-size: 16px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.card-narrow { max-width: 720px; }
.card-title { font-size: 22px; margin-bottom: 18px; }
.card + .card { margin-top: 20px; }
.card-flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 20px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-rooms { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
@media (max-width: 400px) { .grid-cards, .grid-rooms, .grid-2 { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; border-left: 4px solid var(--azzurro); }
.tile.red { border-left-color: var(--red); }
.tile.navy { border-left-color: var(--navy); }
.tile-num { font-family: var(--font-display); font-size: 44px; line-height: 1; color: var(--navy); }
.tile-label { margin-top: 8px; font-family: var(--font-display); font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.progress { height: 6px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, .18); }
.progress > span { display: block; height: 100%; width: 0; background: var(--azzurro); border-radius: 3px; transition: width .3s ease; }
.progress-light { background: #e7ecf1; }

/* ---------- card evento (stile "news" del sito) ---------- */
.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 250px;
  padding: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(500px 240px at 100% 0%, rgba(0, 152, 215, .45), transparent 65%),
    linear-gradient(165deg, #0a4c88 0%, var(--navy) 42%, var(--navy-deep) 100%);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.event-card:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.event-card::before {
  content: attr(data-day);
  position: absolute;
  right: 10px;
  top: -34px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 190px;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .13);
  pointer-events: none;
}
.event-card h3 { color: #fff; font-size: 30px; margin: 8px 0 12px; position: relative; }
.event-card .kicker { position: relative; }
.event-card-meta { position: relative; display: flex; flex-wrap: wrap; gap: 6px 18px; color: rgba(255, 255, 255, .82); font-size: 14px; margin-bottom: 16px; }
.event-card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.event-card-meta .ico { width: 16px; height: 16px; color: var(--azzurro); }
.event-card .progress { position: relative; }
.event-card-count { position: relative; display: flex; justify-content: space-between; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: 14px; margin-top: 8px; color: rgba(255, 255, 255, .8); }
.event-card-count b { color: #fff; font-weight: 500; }
.badge-today {
  position: absolute; top: 18px; left: 24px;
  background: var(--red); color: #fff;
  font-family: var(--font-display); font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 3px;
}

/* ---------- card sala ---------- */
.room-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 190px;
  padding: 22px 22px 20px;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  border-top: 4px solid var(--azzurro);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.room-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.room-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.room-card h3 { font-size: 28px; margin: 0; }
.room-card-arrow { width: 44px; height: 44px; border-radius: 50%; background: var(--azzurro-soft); color: var(--azzurro); display: flex; align-items: center; justify-content: center; flex: none; }
.room-card-arrow .ico { width: 24px; height: 24px; }
.room-card-count { margin-top: auto; display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 14px; }
.room-card-count strong { font-size: 44px; line-height: 1; color: var(--navy); font-weight: 500; letter-spacing: 0; }
.room-card-count em { font-style: normal; font-size: 22px; color: var(--muted); }
.room-card.is-complete { border-top-color: var(--navy); }

/* =========================================================================
   Tabelle
   ========================================================================= */
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  background: #fff;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover, .table th a.sorted { color: var(--navy); }
.table th a .ico { width: 14px; height: 14px; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table tr.is-present { background: linear-gradient(90deg, var(--azzurro-soft), #fff 55%); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: 4px; }
.table .actions form { display: inline; }
.table .strong { font-weight: 600; color: var(--navy); }
.table .name-cell .ln { font-family: var(--font-display); text-transform: uppercase; font-size: 17px; letter-spacing: .01em; color: var(--navy); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { padding: 48px 20px !important; text-align: center; color: var(--muted); }
.table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.table-toolbar .input { min-height: 46px; }
.table-toolbar .grow { flex: 1 1 240px; }
.table-toolbar select.input { width: auto; flex: 0 1 220px; }

/* ---------- badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
  background: var(--bg); color: var(--muted);
}
.badge .ico { width: 13px; height: 13px; }
.badge-azzurro { background: var(--azzurro-soft); color: var(--azzurro-dark); }
.badge-ok { background: var(--azzurro); color: #fff; }
.badge-red { background: var(--red-soft); color: var(--red-dark); }
.badge-navy { background: var(--navy); color: #fff; }
.badge-amber { background: var(--amber-soft); color: #8a5d00; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 3px; background: var(--bg); color: var(--navy); font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tag-list { background: var(--navy); color: #fff; }
.tag-sponsor { background: var(--azzurro-soft); color: var(--azzurro-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 14px; color: var(--navy); }
.chip b { font-family: var(--font-display); font-weight: 500; color: var(--azzurro); }

/* =========================================================================
   Form
   ========================================================================= */
.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field label, .field-label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--navy);
}
.field .hint { margin-top: 5px; font-size: 13px; color: var(--muted); }
.field-error { margin-top: 5px; font-size: 14px; color: var(--red-dark); font-weight: 500; }
.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--azzurro); box-shadow: 0 0 0 3px rgba(0, 152, 215, .18); }
.input-lg { min-height: 58px; font-size: 18px; }
textarea.input { min-height: 110px; resize: vertical; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306325F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}
input[type=file].input { padding: 11px; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 15px; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--azzurro); }
.check small { display: block; color: var(--muted); font-size: 13px; }
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.radio-card { display: flex; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--line-strong); border-radius: 6px; cursor: pointer; background: #fff; }
.radio-card input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--azzurro); flex: none; }
.radio-card strong { display: block; color: var(--navy); font-weight: 600; }
.radio-card small { color: var(--muted); font-size: 13px; }
.radio-card:has(input:checked) { border-color: var(--azzurro); background: var(--azzurro-soft); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }
.form-actions-start { justify-content: flex-start; }
.form-section { padding-top: 20px; border-top: 1px solid var(--line); }
.form-section h3 { font-size: 18px; margin-bottom: 12px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 90px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 40px; padding: 0 12px; border: 0; border-radius: 4px;
  background: var(--bg); color: var(--navy);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: 13px; cursor: pointer;
}

/* ---------- avvisi ---------- */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 16px; border-radius: 6px; border-left: 4px solid; font-size: 15px; background: #fff; }
.alert .ico { margin-top: 1px; }
.alert-msg { flex: 1; }
.alert-success { background: #e9f6fc; border-color: var(--azzurro); color: #05506f; }
.alert-error { background: var(--red-soft); border-color: var(--red); color: #8f1630; }
.alert-info { background: #edf2f7; border-color: var(--navy); color: var(--navy); }
.alert-warning { background: var(--amber-soft); border-color: var(--amber); color: #7a5300; }
.alert-close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; opacity: .6; }
.alert-close:hover { opacity: 1; }
.flash-float {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top) + 14px);
  right: 16px;
  z-index: 90;
  width: min(440px, calc(100% - 32px));
}
.flash-float .alert { box-shadow: var(--shadow-lg); animation: slide-in .25s ease-out; }
.flash-float .alert.hiding { opacity: 0; transform: translateX(20px); transition: all .3s; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ico { width: 52px; height: 52px; color: var(--line-strong); stroke-width: 1.5; }
.empty h3 { margin: 14px 0 6px; font-size: 22px; }
.empty p { max-width: 460px; margin: 0 auto 18px; }

.footer { padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); background: #fff; }
.footer .container { display: flex; justify-content: space-between; gap: 12px; }
.area-tablet .footer { display: none; }

/* =========================================================================
   Login
   ========================================================================= */
.is-bare { background: var(--navy-deep); }
.auth {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 90px 20px 40px;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 85% -5%, rgba(0, 152, 215, .42), transparent 60%),
    linear-gradient(150deg, var(--navy-deep) 0%, var(--navy) 72%, #0a4c88 100%);
}
.auth::before {
  content: attr(data-bg);
  position: absolute;
  left: 50%;
  bottom: -0.16em;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: min(34vw, 440px);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, .07);
  pointer-events: none;
}
.auth-side-text {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(60px, 9vw, 120px);
  line-height: 1;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .12);
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 450px;
  background: #fff;
  border-radius: 10px;
  padding: 0 36px 34px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.auth-card-wide { max-width: 560px; }
.auth-logo {
  display: block;
  width: 96px; height: 96px;
  margin: -48px auto 18px;
  padding: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.auth-card h1 { text-align: center; font-size: 36px; margin: 8px 0 4px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth-card .kicker-label { font-size: 17px; }
@media (max-width: 480px) { .auth-card { padding: 0 22px 26px; } }

/* =========================================================================
   Tablet — lista ospiti della sala
   ========================================================================= */
.room-head {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 22px 0 18px;
  background:
    radial-gradient(800px 300px at 90% -30%, rgba(0, 152, 215, .45), transparent 62%),
    linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 60%, #0a4c88 100%);
}
.room-head::before {
  content: attr(data-bg);
  position: absolute;
  right: -0.03em;
  bottom: -0.22em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(90px, 13vw, 190px);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .09);
  pointer-events: none;
}
.room-head .container { position: relative; }
.room-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px 28px; flex-wrap: wrap; }
.room-title { color: #fff; font-size: clamp(30px, 4.2vw, 48px); margin: 6px 0 2px; }
.room-sub { color: rgba(255, 255, 255, .75); font-size: 15px; }
.room-stats { display: flex; gap: 30px; }
.room-stat { text-align: right; }
.room-stat b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 46px; line-height: 1; font-variant-numeric: tabular-nums; }
.room-stat span { font-family: var(--font-display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.room-stat.present b { color: var(--azzurro); }
.room-head .progress { margin-top: 16px; height: 8px; }
@media (max-width: 640px) {
  .room-stats { width: 100%; justify-content: space-between; gap: 12px; }
  .room-stat { text-align: left; }
  .room-stat b { font-size: 36px; }
}

.room-toolbar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 30;
  padding: 12px 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(2, 27, 47, .05);
}
.search-box { position: relative; }
.search-box .ico-search { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%;
  height: 60px;
  padding: 0 64px 0 56px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 21px;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.search-box input:focus { outline: none; border-color: var(--azzurro); background: #fff; box-shadow: 0 0 0 3px rgba(0, 152, 215, .15); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px;
  display: none; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--navy); color: #fff; cursor: pointer;
}
.search-clear .ico { width: 22px; height: 22px; }
.search-box.has-value .search-clear { display: flex; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.toolbar-row .input { min-height: 50px; width: auto; flex: 1 1 150px; max-width: 250px; font-size: 15px; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 6px; background: var(--bg); }
.segmented button {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px;
  border: 0; border-radius: 4px;
  background: transparent; color: var(--muted);
  font-family: var(--font-display); font-size: 15px; letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented .count { padding: 1px 8px; border-radius: 999px; background: var(--line); color: var(--navy); font-family: var(--font-body); font-weight: 600; font-size: 13px; letter-spacing: 0; }
.segmented button.active .count { background: var(--azzurro); color: #fff; }
@media (max-width: 640px) {
  .segmented { width: 100%; }
  .segmented button { flex: 1; justify-content: center; padding: 0 6px; font-size: 13px; }
  .toolbar-row .input { max-width: none; }
}

.guest-head { display: grid; grid-template-columns: var(--guest-cols); gap: 16px; padding: 16px 20px 8px 25px; }
.guest-head button {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.guest-head button .ico { width: 14px; height: 14px; visibility: hidden; }
.guest-head button.sorted { color: var(--navy); }
.guest-head button.sorted .ico { visibility: visible; }
.guest-head .col-action { text-align: right; justify-self: end; font-family: var(--font-display); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.guest-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 120px; }
.guest {
  display: grid;
  grid-template-columns: var(--guest-cols);
  gap: 16px;
  align-items: center;
  min-height: 80px;
  padding: 10px 12px 10px 20px;
  background: #fff;
  border-radius: 6px;
  border-left: 5px solid transparent;
  box-shadow: 0 1px 2px rgba(2, 27, 47, .07);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color .2s, border-color .2s;
}
.guest:active { background: #f9fbfc; }
.guest.is-present { border-left-color: var(--azzurro); background: linear-gradient(90deg, #e3f3fb 0%, #fff 62%); }
.guest.flash { animation: flash-row 1.2s ease-out; }
.guest-name { color: var(--navy); line-height: 1.15; min-width: 0; }
.guest-name .ln { font-family: var(--font-display); font-size: 23px; font-weight: 500; text-transform: uppercase; letter-spacing: .01em; }
.guest-name .fn { font-size: 19px; font-weight: 500; }
.guest-company { margin-top: 3px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guest-company .ico { width: 14px; height: 14px; vertical-align: -2px; }
.guest-flags { display: inline-flex; gap: 6px; vertical-align: 3px; margin-left: 6px; }
.guest-col { min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-col .empty-val { color: var(--line-strong); }
.guest-inline { display: none; }
.guest-action { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.check-time { min-width: 46px; text-align: right; font-family: var(--font-display); font-size: 18px; color: var(--azzurro-dark); font-variant-numeric: tabular-nums; }
.check-btn {
  width: 64px; height: 64px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: transparent;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s;
}
.check-btn .ico { width: 34px; height: 34px; stroke-width: 3.2; }
.check-btn:hover { border-color: var(--azzurro); color: rgba(0, 152, 215, .35); }
.check-btn:active { transform: scale(.92); }
.guest.is-present .check-btn { background: var(--azzurro); border-color: var(--azzurro); color: #fff; }
.guest.is-pending .check-btn { opacity: .6; }
@media (max-width: 780px) {
  :root { --guest-cols: minmax(0, 1fr) auto; }
  .guest-head { display: none; }
  .guest .guest-col { display: none; }
  .guest .guest-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
  .guest-name .ln { font-size: 21px; }
  .guest-name .fn { font-size: 17px; }
}

.fab {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 70px; height: 70px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--red); color: #fff;
  box-shadow: 0 12px 30px rgba(227, 53, 85, .45);
  cursor: pointer;
}
.fab .ico { width: 34px; height: 34px; stroke-width: 2.5; }
.fab:active { transform: scale(.95); }

.conn-banner {
  position: fixed;
  left: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg);
}
.conn-banner[hidden] { display: none; }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: rgba(255, 255, 255, .7); }
.sync-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #3ccf7a; box-shadow: 0 0 0 3px rgba(60, 207, 122, .25); }
.sync-dot.offline::before { background: var(--red); box-shadow: 0 0 0 3px rgba(227, 53, 85, .3); }

/* ---------- pannello (sheet / modale) ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 27, 47, .6); animation: fade-in .15s; }
.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(660px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 30px 28px calc(28px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 14px 14px 0 0;
  animation: sheet-up .22s ease-out;
}
@media (min-width: 768px) {
  .sheet-panel { top: 50%; bottom: auto; transform: translate(-50%, -50%); border-radius: 10px; animation: pop-in .18s ease-out; }
}
.sheet-close { position: absolute; top: 14px; right: 14px; }
.sheet-name { font-family: var(--font-display); font-size: clamp(30px, 5vw, 42px); font-weight: 500; text-transform: uppercase; line-height: 1.02; color: var(--navy); margin: 8px 0 4px; padding-right: 40px; }
.sheet-name small { display: block; font-family: var(--font-body); text-transform: none; font-size: 22px; font-weight: 500; margin-top: 4px; }
.sheet .kicker-meta { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 22px 0; }
.detail-item small { display: block; font-family: var(--font-display); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.detail-item div { font-size: 18px; font-weight: 500; color: var(--navy); overflow-wrap: anywhere; }
.detail-notes { margin-bottom: 18px; padding: 12px 14px; border-left: 4px solid var(--amber); border-radius: 4px; background: var(--amber-soft); color: #5c4100; white-space: pre-wrap; }
.status-line { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 16px; }
.status-line .ico { width: 24px; height: 24px; }
.status-line.present { background: var(--azzurro-soft); color: #05506f; }
.status-line.present .ico { color: var(--azzurro); }
.status-line strong { color: var(--navy); }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  width: min(580px, calc(100% - 140px));
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  pointer-events: none;
}
@media (max-width: 640px) { .toast-wrap { width: calc(100% - 32px); bottom: calc(108px + env(safe-area-inset-bottom)); } }
.toast {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 12px 12px 18px;
  border-radius: 8px;
  border-left: 5px solid var(--azzurro);
  background: var(--navy-deep);
  color: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
  pointer-events: auto;
  animation: sheet-up .2s ease-out;
}
.toast.warn { border-left-color: var(--amber); }
.toast.error { border-left-color: var(--red); }
.toast .msg { flex: 1; font-size: 16px; line-height: 1.35; }
.toast .msg b { font-family: var(--font-display); font-weight: 500; text-transform: uppercase; letter-spacing: .02em; }
.toast button {
  height: 42px; padding: 0 16px;
  border: 1.5px solid rgba(255, 255, 255, .45); border-radius: 4px;
  background: transparent; color: #fff;
  font-family: var(--font-display); font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
}
.toast.hiding { opacity: 0; transition: opacity .25s; }

/* ---------- registro ingressi ---------- */
.log-action-in { color: var(--azzurro-dark); }
.log-action-out { color: var(--red-dark); }
.time-cell { font-family: var(--font-display); font-size: 18px; color: var(--navy); white-space: nowrap; }
.time-cell small { display: block; font-family: var(--font-body); font-size: 12px; color: var(--muted); }

/* ---------- import ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 36px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--azzurro); background: var(--azzurro-soft); }
.dropzone .ico { width: 40px; height: 40px; color: var(--azzurro); }
.dropzone strong { font-family: var(--font-display); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; font-size: 18px; color: var(--navy); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .file-name { font-weight: 600; color: var(--azzurro-dark); }
.map-table td { vertical-align: top; }
.map-table select.input { min-width: 170px; min-height: 44px; }
.map-sample { font-size: 13px; color: var(--muted); max-width: 280px; }
.map-sample div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-table { font-size: 13px; }
.preview-table td, .preview-table th { padding: 8px 12px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.preview-table tr.is-header td { background: var(--azzurro-soft); font-weight: 600; color: var(--navy); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--bg); padding: 2px 6px; border-radius: 3px; }

/* ---------- animazioni ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.toast { animation-name: toast-up; }
@keyframes toast-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop-in { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes flash-row { 0% { box-shadow: 0 0 0 3px var(--azzurro); } 100% { box-shadow: 0 1px 2px rgba(2, 27, 47, .07); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
