/* restinomain — tema "smeraldo e oro"
   Layout: colonna centrale stretta per i testi, griglie larghe per prodotti e passioni.
   Tema scuro per scelta: un solo set di colori. */
:root {
  --bg: #0b1612;          /* verde quasi nero */
  --surface: #11221b;     /* pannelli */
  --surface-2: #173027;   /* pannelli in evidenza */
  --line: #24423a;        /* bordi */
  --ink: #f2ead6;         /* avorio caldo */
  --muted: #a3b2a3;       /* testo secondario */
  --emerald: #2fa36f;     /* verde vivo */
  --gold: #d6ad52;        /* oro */
  --gold-ink: #1a1305;    /* testo su oro */
  --red: #e0533f;         /* accento rosso, con parsimonia */
  --ok: #57c48a;
  --err: #ff7a66;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(47, 163, 111, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(214, 173, 82, .08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
}
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 16px 64px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.15; margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow {
  font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}

/* ---------- barra in alto ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: rgba(11, 22, 18, .82);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-size: .95rem; color: var(--gold-ink);
  background: linear-gradient(140deg, #f0d48a, var(--gold) 55%, #9c7425);
}
.topbar nav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.topbar nav a, .linklike {
  color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: 999px; font-size: .93rem; white-space: nowrap;
}
.topbar nav a:hover, .linklike:hover { color: var(--ink); }
.topbar nav a.active { color: var(--ink); background: var(--surface-2); }
.topbar nav a.pill { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.inline { display: inline; margin: 0; }
@media (max-width: 520px) {
  .brand .brand-name { display: none; }
  .topbar nav a, .linklike { padding: 6px 8px; font-size: .88rem; }
}

/* ---------- home ---------- */
.hero {
  display: grid; gap: 28px; align-items: center; padding: 24px 0 40px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .hero { grid-template-columns: 300px 1fr; gap: 48px; padding: 48px 0 56px; } }
.portrait {
  position: relative; width: min(240px, 70vw); aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  padding: 6px; background: conic-gradient(from 210deg, var(--gold), #f3dc9b, var(--emerald), var(--gold));
  box-shadow: var(--shadow);
}
@media (min-width: 760px) { .portrait { width: 280px; } }
.portrait-inner {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center;
}
.portrait-inner img { width: 100%; height: 100%; object-fit: cover; }
.portrait-inner .mono { font-family: var(--font-display); font-size: clamp(3.5rem, 14vw, 5rem); color: var(--gold); }
.hero-text { text-align: center; }
@media (min-width: 760px) { .hero-text { text-align: left; } }
.hero-text h1 em { font-style: italic; color: var(--gold); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 34em; margin: 0 auto 22px; }
@media (min-width: 760px) { .lead { margin-left: 0; } }
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
@media (min-width: 760px) { .hero-links { justify-content: flex-start; } }

.btn, .social-btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 11px 18px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn { background: var(--gold); color: var(--gold-ink); }
.btn:hover { filter: brightness(1.07); }
.btn.ghost, .social-btn { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover, .social-btn:hover { border-color: var(--gold); }
.btn.danger { background: transparent; color: var(--err); border-color: currentColor; }
.social-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.social-btn svg .fill { fill: currentColor; stroke: none; }

.section { padding: 28px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 4px 0 0; }

.passions { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .passions { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.passion {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: grid; gap: 8px; align-content: start;
}
.passion svg { width: 30px; height: 30px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.passion h3 { font-size: 1.1rem; margin: 2px 0 0; }
.passion p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- lista desideri ---------- */
.page-head { margin: 8px 0 20px; }
.filters {
  display: grid; gap: 10px; margin-bottom: 14px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip:hover { border-color: var(--gold); }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 700; }
.filter-row { display: flex; gap: 8px; }
.filter-row input { flex: 1; min-width: 0; }
input, select {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
select { width: auto; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.note { background: rgba(214, 173, 82, .1); border: 1px solid rgba(214, 173, 82, .3); border-radius: 12px; padding: 10px 14px; margin: 8px 0; font-size: .92rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; } }
.grid.strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid.strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow); }
.card-link { position: absolute; inset: 0; z-index: 2; }
.thumb {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fbf6ea, #e9e1cd);
}
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 3rem; color: var(--gold);
  background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--surface));
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 {
  font-family: var(--font-body); font-size: .95rem; font-weight: 700; margin: 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tag { align-self: flex-start; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--emerald); }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.price { font-weight: 800; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.price.muted { color: var(--muted); font-weight: 600; font-size: .85rem; }
.go { font-size: .85rem; color: var(--muted); }
.card:hover .go { color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- account ---------- */
.auth {
  max-width: 440px; margin: 24px auto; padding: 28px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth h1 { font-size: 2rem; }
.form { display: grid; gap: 14px; margin: 16px 0; }
.form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.flash.ok { border-color: var(--ok); }
.flash.error { border-color: var(--err); color: var(--err); }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 32px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.tile-k { font-size: .8rem; color: var(--muted); }
.admin { border-top: 1px solid var(--line); padding-top: 24px; }
.form.add { grid-template-columns: 1fr; align-items: end; }
@media (min-width: 720px) { .form.add { grid-template-columns: 1fr 200px auto; } }
.admin-list { display: grid; gap: 8px; margin-top: 16px; }
.admin-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.admin-item summary { display: flex; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; }
.admin-item summary::-webkit-details-marker { display: none; }
.admin-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn { color: var(--red); font-weight: 800; }
.form.compact { padding: 0 14px 14px; margin: 0; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form.compact { grid-template-columns: 1fr 1fr; } .form.compact .grow, .form.compact .actions { grid-column: 1 / -1; } }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- piè di pagina ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 22px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem;
}
.footer .social { display: flex; gap: 16px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--gold); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- foto di viaggio ---------- */
.travel {
  position: relative; margin: 0; border-radius: 24px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 16 / 9; max-width: 100%;
}
@media (min-width: 760px) { .travel { aspect-ratio: 21 / 9; } }
.travel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.travel figcaption {
  position: absolute; inset: auto 0 0 0; padding: 40px 20px 18px; display: grid; gap: 2px;
  background: linear-gradient(to top, rgba(11, 22, 18, .92), rgba(11, 22, 18, 0));
}
.travel-title { font-family: var(--font-display); font-size: clamp(1.3rem, 4vw, 2rem); color: var(--ink); }

/* ---------- galleria momenti ---------- */
.gallery { columns: 2; column-gap: 12px; }
@media (min-width: 760px) { .gallery { columns: 4; column-gap: 16px; } }
.moment {
  break-inside: avoid; margin: 0 0 12px; border-radius: 16px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
}
@media (min-width: 760px) { .moment { margin-bottom: 16px; } }
.moment img { display: block; width: 100%; height: auto; transition: transform .3s ease; }
.moment:hover img { transform: scale(1.03); }
.moment figcaption { padding: 8px 12px 10px; font-size: .85rem; color: var(--muted); }

/* ---------- sfondo dinamico ---------- */
.bg-layer {
  --fade: .78;
  position: fixed; inset: -8vh 0; z-index: -1; overflow: hidden; pointer-events: none;
  will-change: transform;
}
.bg-img {
  position: absolute; inset: 0; background-size: cover; background-position: center 35%;
  filter: saturate(.55) brightness(.75);
  animation: bg-drift 38s ease-in-out infinite alternate;
  will-change: transform;
}
.bg-layer::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(1000px 600px at 80% 0%, rgba(47, 163, 111, .22), transparent 60%),
    radial-gradient(800px 500px at 0% 20%, rgba(214, 173, 82, .12), transparent 60%),
    linear-gradient(180deg, rgba(11, 22, 18, calc(var(--fade) - .1)), rgba(11, 22, 18, var(--fade)) 45%, rgba(11, 22, 18, calc(var(--fade) + .06)));
}
@keyframes bg-drift {
  0%   { transform: scale(1.08) translate(0, 0); }
  50%  { transform: scale(1.16) translate(-2%, 1.5%); }
  100% { transform: scale(1.12) translate(2%, -1%); }
}
body { background: var(--bg); }
@media (prefers-reduced-motion: reduce) { .bg-img { animation: none; transform: scale(1.08); } }

/* ---------- cartina dei viaggi ---------- */
.map-zoom { display: flex; gap: 6px; flex-wrap: wrap; }
.travel-map {
  position: relative; border-radius: 24px; overflow: hidden; max-width: 100%;
  background: radial-gradient(120% 120% at 50% 0%, rgba(23, 48, 39, .9), rgba(11, 22, 18, .95));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.map-svg { display: block; width: 100%; height: auto; aspect-ratio: 960 / 500; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .9rem; padding: 16px; text-align: center; }
.travel-map.map-ready .map-loading { display: none; }
.travel-map.map-failed .map-svg { display: none; }
.travel-map.map-failed .map-loading { position: static; padding: 28px 16px; }
.map-sphere { fill: rgba(47, 163, 111, .05); stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-graticule { fill: none; stroke: rgba(214, 173, 82, .07); stroke-width: .5; vector-effect: non-scaling-stroke; }
.map-country { fill: #1d3a30; transition: fill .3s ease; }
.map-country:hover { fill: #24473b; }
.map-country.visited { fill: rgba(214, 173, 82, .35); }
.map-borders { fill: none; stroke: rgba(11, 22, 18, .9); stroke-width: .6; vector-effect: non-scaling-stroke; }
.map-pin { cursor: pointer; outline: none; }
.pin-dot { fill: var(--gold); stroke: var(--bg); stroke-width: 2; }
.pin-ring { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: .7; transform-box: fill-box; transform-origin: center; animation: pin-pulse 2.4s ease-out infinite; }
.map-pin.active .pin-dot, .map-pin:focus-visible .pin-dot { fill: var(--red); }
.map-pin.pop .pin-dot { animation: pin-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes pin-pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes pin-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.map-card {
  position: absolute; z-index: 3; width: 220px; border-radius: 16px; overflow: hidden; text-decoration: none;
  background: var(--surface); border: 1px solid var(--gold); box-shadow: var(--shadow); color: var(--ink);
  animation: card-in .2s ease-out;
}
.map-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.map-card-body { display: grid; gap: 2px; padding: 10px 12px 12px; }
.map-card-place { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--emerald); }
.map-card-name { font-family: var(--font-display); font-size: 1.25rem; }
.map-card-go { font-size: .85rem; color: var(--gold); }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.map-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .92rem; }
.map-list a { color: var(--ink); text-decoration-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .pin-ring, .map-card { animation: none; } }

/* ---------- pagina di un viaggio ---------- */
.trip-hero { position: relative; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 24px; aspect-ratio: 16 / 9; max-width: 100%; }
@media (min-width: 760px) { .trip-hero { aspect-ratio: 21 / 8; } }
.trip-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trip-hero-text { position: absolute; inset: auto 0 0 0; padding: 48px 20px 20px; background: linear-gradient(to top, rgba(11, 22, 18, .95), rgba(11, 22, 18, 0)); }
.trip-hero-text h1 { margin: 2px 0 0; }
.back { display: inline-flex; gap: 6px; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--gold); }
.moment button { all: unset; display: block; cursor: zoom-in; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 92vh; }
.lightbox::backdrop { background: rgba(5, 10, 8, .92); }
.lightbox img { display: block; max-width: 96vw; max-height: 82vh; border-radius: 12px; }
.lightbox p { color: var(--ink); text-align: center; margin: 10px 0 0; }
.lightbox-close { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; }
.map-country-outlined { stroke: rgba(11, 22, 18, .9); stroke-width: .6; vector-effect: non-scaling-stroke; }

/* ---------- link nelle passioni e pagina viaggi ---------- */
.passion-link { margin-top: 4px; font-size: .9rem; font-weight: 700; color: var(--gold); text-decoration: none; }
.passion-link:hover { color: var(--ink); }
.map-page .section-head { align-items: center; }
.trip-card {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); transition: transform .18s ease, border-color .18s ease;
}
.trip-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.trip-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.trip-card-body { display: grid; gap: 2px; padding: 10px 14px 14px; }
.trip-card-name { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }

/* ---------- riquadro MainWishList in evidenza ---------- */
.passion-wish {
  position: relative; text-decoration: none; color: var(--ink); isolation: isolate;
  border: 2px solid transparent;
  background:
    linear-gradient(160deg, rgba(214, 173, 82, .20), rgba(47, 163, 111, .08) 60%, rgba(0, 0, 0, 0)) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, #f3dc9b, var(--gold) 40%, var(--red) 75%, var(--gold)) border-box;
  box-shadow: 0 0 0 1px rgba(214, 173, 82, .25), 0 12px 34px rgba(214, 173, 82, .18);
  transition: transform .2s ease, box-shadow .2s ease;
}
.passion-wish:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px rgba(214, 173, 82, .5), 0 18px 44px rgba(214, 173, 82, .3); }
.passion-wish::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 236, 180, .14) 45%, transparent 60%);
  background-size: 250% 100%; animation: wish-shine 4.5s ease-in-out infinite;
}
@keyframes wish-shine { 0% { background-position: 150% 0; } 60%, 100% { background-position: -50% 0; } }
.passion-wish h3 { color: var(--gold); font-size: 1.25rem; }
.passion-wish p { color: var(--ink); opacity: .85; }
.passion-wish svg { stroke: var(--gold); width: 34px; height: 34px; }
.passion-wish .passion-link { color: var(--gold); }
.wish-badge {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
@media (prefers-reduced-motion: reduce) { .passion-wish::after { animation: none; } }

/* ---------- gestione utenti ---------- */
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.user-info { display: grid; gap: 2px; min-width: 0; }
.count-badge {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; margin-left: 6px;
  border-radius: 999px; background: var(--red); color: #fff; font-family: var(--font-body); font-size: .85rem; font-weight: 800; vertical-align: middle;
}
h3.sub { font-size: 1.1rem; margin: 24px 0 10px; }
.admin + .admin { margin-top: 32px; }

/* ---------- niente contenuti che sbordano ---------- */
.admin-list > *, .grid > *, .dash-grid > *, .tiles > *, .form > *, .copy-row > * { min-width: 0; }
.admin-list, .admin-item, .prod-item, .panel { max-width: 100%; }
input, select { max-width: 100%; }
.thumb img.centered { padding: 0; object-fit: cover; }

/* ---------- dashboard a riquadri ---------- */
.dash-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 36px; }
@media (min-width: 720px) { .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dash-tile {
  position: relative; display: grid; gap: 6px; align-content: start; padding: 20px 20px 22px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; transition: transform .18s ease, border-color .18s ease;
}
.dash-tile:hover { transform: translateY(-3px); border-color: var(--gold); }
.dash-tile svg { width: 30px; height: 30px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dash-tile-title { font-family: var(--font-display); font-size: 1.3rem; }
.dash-tile-sub { color: var(--muted); font-size: .9rem; padding-right: 24px; }
.dash-tile-go { position: absolute; right: 18px; bottom: 16px; color: var(--gold); font-size: 1.3rem; }
.dash-tile-wish {
  border: 2px solid transparent;
  background:
    linear-gradient(160deg, rgba(214, 173, 82, .18), rgba(0, 0, 0, 0) 60%) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, #f3dc9b, var(--gold) 45%, var(--red) 80%, var(--gold)) border-box;
}
.dash-tile-wish .dash-tile-title { color: var(--gold); }
#account .tiles { margin-bottom: 14px; }

/* ---------- pagina gestione lista ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel .form { margin: 0; }
.form.add { grid-template-columns: 1fr; }
@media (min-width: 760px) { .form.add { grid-template-columns: minmax(0, 1fr) 220px auto; align-items: end; } }
.prod-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.prod-item[open] { border-color: var(--gold); }
.prod-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; cursor: pointer; list-style: none;
}
.prod-row::-webkit-details-marker { display: none; }
.prod-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #fff; display: grid; place-items: center; }
.prod-thumb img { width: 100%; height: 100%; object-fit: contain; }
.prod-main { display: grid; gap: 3px; min-width: 0; }
.prod-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.prod-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.prod-meta .warn { font-size: .78rem; font-weight: 700; }
.prod-item .form.compact { padding: 4px 12px 14px; border-top: 1px solid var(--line); }

/* ---------- istruzioni iPhone ---------- */
.copy-box { display: grid; gap: 12px; margin-bottom: 18px; }
.copy-row { display: grid; gap: 6px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .copy-row { grid-template-columns: 170px minmax(0, 1fr) auto; } }
.copy-row code, .steps code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.steps code { padding: 1px 6px; }
.steps { display: grid; gap: 10px; padding-left: 22px; margin: 0; max-width: 70ch; }
.steps li::marker { color: var(--gold); font-weight: 800; }

/* ---------- regali già ricevuti ---------- */
.card.received .thumb img, .card.received .thumb-fallback { filter: grayscale(.6) brightness(.8); }
.card.received h3 { color: var(--muted); }
.received-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.received-x {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0; aspect-ratio: 1; pointer-events: none;
  display: grid; place-items: center;
}
.received-x::before, .received-x::after {
  content: ""; position: absolute; width: 78%; height: 9%; border-radius: 999px;
  background: var(--red); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); opacity: .92;
}
.received-x::before { transform: rotate(45deg); }
.received-x::after { transform: rotate(-45deg); }
.received-note {
  position: absolute; z-index: 3; inset: 0; display: grid; align-content: center; justify-items: center; gap: 6px;
  padding: 16px; text-align: center; pointer-events: none;
  background: rgba(11, 22, 18, .93); border-radius: inherit;
  opacity: 0; transform: scale(.97); transition: opacity .2s ease, transform .2s ease;
}
.card.show-giver .received-note { opacity: 1; transform: none; }
.received-who { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.25; color: var(--ink); }
.received-thanks { color: var(--gold); font-weight: 700; }
.go.got { color: var(--red); font-weight: 700; }
.card.received:hover { border-color: var(--red); }
.got-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.received-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 4px; margin: 0; display: grid; gap: 10px; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: auto; accent-color: var(--red); transform: scale(1.2); }
@media (prefers-reduced-motion: reduce) { .received-note { transition: none; } }
.panel.narrow { max-width: 460px; }
.admin-search { display: grid; gap: 10px; margin-bottom: 14px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 5; padding: 10px 0; background: var(--bg); }
.admin-search input { font-size: 1rem; }
.prod-item[hidden] { display: none; }

/* ---------- X dei ricevuti: regalo (oro, bordo rosso) / autoregalo (rossa, bordo nero) ---------- */
.received-x::before, .received-x::after {
  background: var(--gold); box-shadow: 0 0 0 3px var(--red), 0 3px 12px rgba(0, 0, 0, .4); opacity: 1;
}
.card.self-gift .received-x::before, .card.self-gift .received-x::after {
  background: var(--red); box-shadow: 0 0 0 3px #000, 0 3px 12px rgba(0, 0, 0, .4);
}
.card.self-gift .go.got { color: var(--red); }
.card.received:not(.self-gift) .go.got { color: var(--gold); }
.got-badge.self { background: #000; color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.mode-choice { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.mode-choice label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.mode-choice input { width: auto; accent-color: var(--gold); }
.received-detail { display: grid; gap: 10px; }
.received-detail[hidden], .giver-field[hidden] { display: none; }
.legend-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.legend { color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 0; }
.mini-x { position: relative; display: inline-block; width: 14px; height: 14px; margin-left: 8px; }
.mini-x::before, .mini-x::after {
  content: ""; position: absolute; left: -1px; right: -1px; top: 5px; height: 4px; border-radius: 4px;
  background: var(--gold); box-shadow: 0 0 0 1.5px var(--red);
}
.mini-x::before { transform: rotate(45deg); } .mini-x::after { transform: rotate(-45deg); }
.mini-x.self::before, .mini-x.self::after { background: var(--red); box-shadow: 0 0 0 1.5px #000; }
.card-foot { flex-wrap: wrap; row-gap: 2px; }
.go.got { white-space: nowrap; }
