:root {
  --bg: #100e19;
  --bg-panel: #1c1830;
  --bg-panel-2: #241f3d;
  --border: #322a52;
  --text: #eae6f5;
  --text-dim: #9086b0;
  --accent: #ff5fa2;
  --accent-dim: #7a3357;
  --accent2: #4dd9ff;
  --ready: #7cff6b;
  --warn: #ffcb5c;
  --font-display: "Press Start 2P", monospace;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255,95,162,0.08), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(77,217,255,0.07), transparent 40%);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

button, input, textarea { font-family: inherit; }

a, .btn-link {
  color: var(--accent2);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Logo & type ---------- */

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-sm { font-size: 1rem; }
.logo-1 { color: var(--accent); }
.logo-2 { color: var(--accent2); }

.logo-img {
  height: 34px;
  width: 34px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.logo-sm .logo-img { height: 24px; width: 24px; border-radius: 6px; }
.logo-img:not([src]), .logo-img[src=""] { display: none; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 14px 0;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: -6px 0 4px 0;
}

.error-text {
  color: var(--warn);
  font-size: 0.85rem;
  background: rgba(255,203,92,0.08);
  border: 1px solid rgba(255,203,92,0.3);
  padding: 8px 10px;
  border-radius: var(--radius);
}

.telegram-link-notice {
  color: var(--accent2);
  font-size: 0.85rem;
  background: rgba(77,217,255,0.08);
  border: 1px solid rgba(77,217,255,0.3);
  padding: 8px 10px;
  border-radius: var(--radius);
  line-height: 1.4;
}

/* ---------- Login ---------- */

/* Specificità pari a quella delle classi sotto: senza questa regola,
   .login-screen{display:flex} e .app-screen{...} vincono sempre su [hidden]
   e gli schermi non si nascondono mai correttamente. */
.login-screen[hidden], .app-screen[hidden] {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255,95,162,0.05), 0 20px 60px rgba(0,0,0,0.5);
}

.login-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 10px 0 26px 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

/* ---------- Form fields (shared) ---------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  /* 16px minimo: sotto questa soglia Safari su iPhone zooma automaticamente sul campo al tocco */
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
  min-height: 44px;
}

/* I campi data/ora hanno un'icona e un popup disegnati dal browser stesso, non da noi:
   di default escono scuri e diventano invisibili su un sito con sfondo scuro.
   "color-scheme: dark" dice al browser di usare toni chiari per quei controlli nativi. */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.9) brightness(1.4);
  opacity: 0.85;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
input:focus-visible {
  border-color: var(--accent2);
  outline: 2px solid rgba(77,217,255,0.35);
  outline-offset: 1px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form[hidden] { display: none; }

/* ---------- Buttons ---------- */

.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  min-height: 44px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: #1a0a14; }
.btn-accent { background: var(--accent2); color: #04222b; }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent2); }
.btn-danger { background: rgba(255,95,95,0.15); color: #ff9a9a; border: 1px solid rgba(255,95,95,0.3); }

/* ---------- App shell ---------- */

.app-screen { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(28,24,48,0.6);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.dot-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ready);
  box-shadow: 0 0 8px var(--ready);
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  grid-template-areas: "left main right";
  gap: 20px;
  padding: 20px 24px 60px;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar-left { grid-area: left; }
.main { grid-area: main; }
.sidebar-right { grid-area: right; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 280px 1fr; grid-template-areas: "left main" "right right"; }
}

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "left" "main" "right"; }
}

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .layout { padding: 14px 14px 40px; gap: 14px; }
  .panel { padding: 16px; }
  .login-card { padding: 28px 22px; }
  .row-2 { grid-template-columns: 1fr; }
  .logo { font-size: 0.95rem; letter-spacing: 0; }
  .eyebrow { font-size: 0.66rem; }
  .event-card-head { gap: 10px; }
  .event-cover { width: 52px; height: 24px; }

  /* Calendario più leggibile su schermi stretti: barra a colonne, vista ad agenda */
  .fc .fc-toolbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .fc .fc-toolbar-chunk { display: flex; justify-content: center; }
  .fc .fc-toolbar-title { font-size: 0.95rem; text-align: center; }
  .fc .fc-button { padding: 6px 10px; font-size: 0.8rem; }
}

.sidebar { display: flex; flex-direction: column; gap: 20px; }
.main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------- Online ora ---------- */

.online-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
}

/* ---------- Next session box ---------- */

.next-session {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.next-session strong { color: var(--text); }

/* ---------- In evidenza e consigliati ---------- */

.panel-featured { padding: 12px; }

.featured-carousel {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 8;
  background: var(--bg-panel-2);
}

.featured-slides { position: relative; width: 100%; height: 100%; }

.featured-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.featured-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}
.featured-slide.active { opacity: 1; visibility: visible; }

.featured-slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  background: var(--bg-panel-2);
}

.featured-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(10,8,17,0.96) 0%, rgba(10,8,17,0.55) 45%, rgba(10,8,17,0.05) 75%);
}

.featured-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a0a14;
  background: var(--accent);
  padding: 4px 9px;
  border-radius: 4px;
}

.featured-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 14px 16px;
}

.featured-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  line-height: 1.2;
}

.featured-meta {
  font-size: 0.72rem;
  color: #cfc9e0;
  margin-top: 3px;
}

.featured-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  background: rgba(10,8,17,0.6);
  border: 1px solid var(--ready);
  color: var(--ready);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 5px;
}
.featured-price s { color: var(--text-dim); font-weight: 400; }

.featured-actions { margin-top: 10px; }
.featured-actions .btn {
  padding: 7px 12px;
  min-height: 0;
  font-size: 0.76rem;
}

.featured-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(10,8,17,0.6);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.featured-nav[hidden] {
  display: none;
}
.featured-nav:hover { background: rgba(10,8,17,0.85); border-color: var(--accent2); }
.featured-nav.prev { left: 10px; }
.featured-nav.next { right: 10px; }

.featured-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
}
.featured-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  cursor: pointer;
  border: none;
  padding: 0;
}
.featured-dot.active { background: var(--accent); width: 16px; border-radius: 4px; }

@media (max-width: 600px) {
  .featured-carousel { aspect-ratio: 16 / 11; }
  .featured-title { font-size: 0.92rem; }
}

/* ---------- Chi inviti (capsule) ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--accent2); }
.chip.selected {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255,95,162,0.12);
}
.chip input { display: none; }

.tz-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tz-preview:empty { display: none; }
.tz-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-panel-2);
  border-radius: var(--radius);
  font-size: 0.78rem;
}
.tz-preview-row span:first-child { color: var(--text-dim); }
.tz-preview-row span:last-child { font-family: var(--font-mono); font-weight: 600; }
.tz-preview-unknown { color: var(--text-dim); font-style: italic; font-weight: 400 !important; }

.event-tz-note {
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: italic;
}

.participant-empty {
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ---------- Link amministrazione ---------- */

.admin-link {
  text-align: center;
  margin-top: 18px;
}
.admin-link a {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: none;
}
.admin-link a:hover { color: var(--accent2); text-decoration: underline; }

/* ---------- Autocomplete gioco ---------- */

.autocomplete-wrap { position: relative; }

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.game-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.game-result:hover { background: rgba(255,255,255,0.05); }
.game-result img { width: 32px; height: 15px; object-fit: cover; border-radius: 3px; }

/* ---------- Availability list ---------- */

.avail-list {
  list-style: none;
  margin: 14px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.avail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
}
.avail-item .avail-meta { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.72rem; }
.avail-item button {
  background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.9rem;
}
.avail-item button:hover { color: var(--warn); }

/* ---------- Calendar ---------- */

#calendar { font-size: 0.85rem; }

.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--bg-panel-2);
  --fc-list-event-hover-bg-color: var(--bg-panel-2);
  --fc-today-bg-color: rgba(255,95,162,0.06);
  color: var(--text);
}
.fc .fc-toolbar-title { font-size: 1.05rem; }
.fc .fc-button {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-transform: capitalize;
  box-shadow: none;
}
.fc .fc-button:hover { background: var(--accent-dim); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent); color: #1a0a14; border-color: var(--accent); }
.fc-event { cursor: pointer; border: none; }
.fc-daygrid-event { padding: 1px 4px; }

/* ---------- RSVP ---------- */

.rsvp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.rsvp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  line-height: 1;
}

.rsvp-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.rsvp-btn {
  flex: 1;
  min-width: 90px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}
.rsvp-btn:hover { color: var(--text); }
.rsvp-btn.yes.active { background: rgba(124,255,107,0.15); border-color: var(--ready); color: var(--ready); }
.rsvp-btn.maybe.active { background: rgba(255,203,92,0.15); border-color: var(--warn); color: var(--warn); }
.rsvp-btn.no.active { background: rgba(255,95,162,0.12); border-color: var(--accent); color: var(--accent); }

/* ---------- Event cards / ready-check ---------- */

.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
}
.event-card.is-feasible { border-left-color: var(--ready); }

.event-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-cover {
  width: 64px;
  height: 30px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
}

.event-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.event-title { font-weight: 700; font-size: 1rem; }
.event-when { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent2); }

.event-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.event-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 6px;
  font-style: italic;
}

/* Ready-check bar: un segmento acceso per ogni partecipante disponibile */
.ready-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.ready-check-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 4px;
  white-space: nowrap;
}
.ready-segment {
  height: 8px;
  flex: 1;
  min-width: 14px;
  border-radius: 3px;
  background: var(--border);
}
.ready-segment.on { background: var(--ready); box-shadow: 0 0 6px rgba(124,255,107,0.5); }

.event-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.event-actions .btn { padding: 7px 12px; font-size: 0.78rem; }

.notified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ready);
  border: 1px solid var(--ready);
  border-radius: 999px;
  padding: 4px 10px;
  line-height: 1;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 20px 0;
}

/* ---------- Wishlist ---------- */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head .eyebrow { margin-bottom: 0; }

.btn-refresh-all {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.7rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, border-color 0.15s;
}
.btn-refresh-all:hover { color: var(--text); border-color: var(--accent2); }
.btn-refresh-all:disabled { opacity: 0.55; cursor: default; }
.btn-refresh-all.is-spinning { animation: spin-text 1s steps(4) infinite; }
@keyframes spin-text { to { opacity: 0.4; } }

/* Tooltip generico: aggiungi data-tooltip="testo" a qualunque elemento */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 9px);
  right: 0;
  width: 210px;
  background: var(--bg-panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.7rem;
  line-height: 1.35;
  font-family: var(--font-body);
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  z-index: 40;
  pointer-events: none;
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 14px;
  border: 5px solid transparent;
  border-top-color: var(--border);
  z-index: 41;
}

.wishlist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  max-height: 520px;
  overflow-y: auto;
}

.wishlist-category { margin-bottom: 2px; }

.wishlist-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 2px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.wishlist-category-header:hover { color: var(--text); }

.wishlist-category-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--accent2);
}

.wishlist-category-name {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
}

.wishlist-category-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  background: var(--bg-panel-2);
  border-radius: 999px;
  padding: 1px 8px;
}

/* Come sempre quando si usa "display" insieme a [hidden]: serve la regola sotto per
   evitare che il display esplicito vinca sull'attributo hidden e il gruppo non si nasconda. */
.wishlist-category-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
  margin-bottom: 10px;
}
.wishlist-category-items[hidden] { display: none; }

.wishlist-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}
.wishlist-item.on-sale { border-color: var(--ready); box-shadow: 0 0 0 1px rgba(124,255,107,0.25); }

.wishlist-item-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.wishlist-cover {
  width: 52px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
}

.wishlist-info { min-width: 0; flex: 1; }
.wishlist-name { font-size: 0.85rem; font-weight: 600; line-height: 1.25; }

.wishlist-status { margin-top: 4px; font-size: 0.72rem; }

.badge-soon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent2);
  border: 1px solid var(--accent2);
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1;
}
.badge-sale {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #0a2e08;
  background: var(--ready);
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1;
}
.badge-price {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.badge-error {
  font-size: 0.7rem;
  color: var(--warn);
}

.wishlist-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.wishlist-actions button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
  cursor: pointer;
}
.wishlist-actions button:hover { color: var(--text); border-color: var(--accent2); }

/* ---------- Pannello di amministrazione ---------- */

.admin-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px 24px 60px;
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 700px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.admin-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-user-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.admin-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.admin-toggle-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.admin-user-actions {
  display: flex;
  gap: 8px;
}
.admin-user-actions .btn-ghost {
  padding: 6px 12px;
  font-size: 0.76rem;
  border-radius: 6px;
}
.admin-delete-btn:hover { color: var(--warn); border-color: var(--warn); }

.admin-edit-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.admin-edit-form input {
  width: 100%;
}
.admin-edit-actions {
  display: flex;
  gap: 8px;
}
.admin-edit-actions .btn,
.admin-edit-actions .btn-ghost {
  padding: 8px 14px;
  font-size: 0.8rem;
}

/* ---------- Finestre di dialogo (al posto di alert/confirm del browser) ---------- */

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 5, 11, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog-overlay[hidden] {
  display: none;
}

.dialog-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: dialog-pop 0.15s ease;
}
@keyframes dialog-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.dialog-message {
  margin: 0 0 20px 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.dialog-actions .btn {
  min-height: 40px;
  padding: 9px 18px;
}

@media (max-width: 480px) {
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
