/* Stili condivisi: mobile-first, nessun framework */

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

header.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "brand status author";
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}
.brand { grid-area: brand; }
.badge { grid-area: status; justify-self: center; }
.author { grid-area: author; justify-self: end; }

header.top h1 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.02em;
}

/* Intestazione con il logo del Sagra Orecchiette 2026 */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 50%;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.brand .titles { min-width: 0; }
.brand .titles h1 { margin: 0; font-size: 1.05rem; line-height: 1.15; }
.brand .titles .sub {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Link all'autore in testata (LoopTech) */
.author {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: 12px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.author:hover, .author:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.author img {
  display: block;
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

/* Logo grande, mostrato in cima alla pagina cliente */
.hero-logo-wrap {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 4px auto 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.hero-logo {
  display: block;
  width: 70%;
  height: 70%;
  margin: 15%;
  object-fit: contain;
}

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.on { color: var(--ok); }
.badge.off { color: var(--danger); }

.card {
  position: relative;
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.09) 0%, var(--card) 42%);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 20px 8px 20px 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), rgba(56, 189, 248, 0.25) 60%, transparent);
  pointer-events: none;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.big-number {
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Riquadri numero servito e numero registrato affiancati */
.numbers-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
.numbers-row .card { margin-bottom: 0; }
.number-box {
  position: relative;
  flex: 1 1 140px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-top: 4px solid var(--accent);
  border-radius: 20px 8px 20px 8px;
  padding-top: 22px;
}
.number-box[hidden] { display: none !important; }
.number-box::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.number-box .big-number {
  font-size: clamp(2.4rem, 11vw, 3.8rem);
  margin: 4px 0;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}
.number-box h2 { width: 100%; margin-bottom: 8px; }
.number-box.warning { border-top-color: var(--warn); background: linear-gradient(160deg, rgba(245, 158, 11, 0.10) 0%, var(--card) 65%); }
.number-box.warning::after { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.number-box.warning .big-number { text-shadow: 0 2px 10px rgba(245, 158, 11, 0.25); }
.number-box.turn { border-top-color: var(--ok); background: linear-gradient(160deg, rgba(34, 197, 94, 0.12) 0%, var(--card) 65%); animation: pulse 1.4s ease-in-out infinite; }
.number-box.turn::after { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.number-box.turn .big-number { text-shadow: 0 2px 10px rgba(34, 197, 94, 0.30); }
.number-box.done { opacity: 0.55; border-top-color: var(--muted); }
.number-box.done::after { background: var(--muted); box-shadow: none; }
.number-box.done .big-number { text-shadow: none; }
.number-status {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  width: 100%;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.notice {
  padding: 12px 14px;
  border-radius: 12px 6px 12px 6px;
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.04) 100%);
  border-left: 4px solid var(--warn);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}
.notice strong { color: var(--warn); }

/* Form */
form.row {
  display: flex;
  gap: 10px;
}

input[type="number"],
input[type="text"],
input[type="password"] {
  flex: 1;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid #334155;
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font-size: 1.05rem;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  background: var(--accent);
  color: #06202b;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button.secondary { background: var(--card-2); color: var(--text); }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Interruttore suono e vibrazione */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.switch input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt { margin-top: 12px; }

/* Card ticket cliente */
.ticket {
  position: relative;
  border-radius: 16px 6px 16px 6px;
  padding: 18px 18px 18px 24px;
  margin-bottom: 14px;
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.07) 0%, var(--card) 45%);
  border: 1px solid rgba(148, 163, 184, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.30);
  overflow: hidden;
}
.ticket::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 5px;
  border-radius: 0 5px 5px 0;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  pointer-events: none;
}
.ticket.warning { background: linear-gradient(160deg, rgba(245, 158, 11, 0.10) 0%, var(--card) 60%); }
.ticket.warning::before { background: var(--warn); box-shadow: 0 0 14px var(--warn); }
.ticket.turn { background: linear-gradient(160deg, rgba(34, 197, 94, 0.12) 0%, var(--card) 60%); animation: pulse 1.4s ease-in-out infinite; }
.ticket.turn::before { background: var(--ok); box-shadow: 0 0 16px var(--ok); }
.ticket.done { opacity: 0.55; }
.ticket.done::before { background: var(--muted); box-shadow: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}

.ticket-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.ticket-num { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ticket-status { margin-top: 10px; font-size: 1.05rem; font-weight: 600; }
.ticket-meta { margin-top: 6px; color: var(--muted); font-size: 0.85rem; }

/* Finestra con la guida per sbloccare le notifiche */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal[hidden] { display: none; }

.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h3 { margin: 0 0 14px; font-size: 1.1rem; }

.steps {
  margin: 0 0 12px;
  padding-left: 22px;
  line-height: 1.6;
  font-size: 0.95rem;
}
.steps li { margin-bottom: 8px; }
.steps strong { color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #111827;
  border: 1px solid #334155;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #334155;
  font-size: 0.9rem;
}
.list li:last-child { border-bottom: none; }
.list span:last-child { color: var(--muted); }

footer.foot { text-align: center; color: var(--muted); font-size: 0.75rem; padding: 18px 0; }

/* Testata responsive su mobile */
@media (max-width: 480px) {
  header.top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 0 12px;
    grid-template-columns: none;
    grid-template-areas: none;
  }
  header.top .brand { flex: 1 1 auto; min-width: 0; }
  header.top .author { flex: 0 0 auto; order: 2; margin-left: auto; }
  header.top .badge {
    flex: 1 1 100%;
    order: 3;
    text-align: center;
    justify-self: auto;
    font-size: 0.7rem;
  }

  .brand img {
    width: 40px;
    height: 40px;
    padding: 6px;
  }
  .brand .titles h1 { font-size: 0.95rem; }
  .brand .titles .sub { font-size: 0.62rem; }

  .author { padding: 5px 9px; border-radius: 10px; }
  .author img { height: 26px; }
}

@media (min-width: 640px) {
  .big-number { font-size: 5.5rem; }
}
