/* Liste nascita Nanù: palette, font e forme del sito nanubaby.it (tema Horizon). */

@font-face {
  font-family: "Newsreader";
  src: url("/assets/newsreader.woff2") format("woff2");
  font-weight: 300 600;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #f7f6f4;
  --paper: #ffffff;
  --line: #eae8e6;
  --line-strong: #dedbd8;
  --ink: #111111;
  --mut: #66625d;
  --mut-2: #8c8781;
  /* Bottone primario del sito ("Aggiungi al carrello") e suo hover. */
  --sage: #9ba998;
  --green: #80927c;
  --warn: #a5642a;
  --danger: #a33a2b;
  --badge: #f1f0ee;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  /* Il sito usa Newsreader anche per il testo: niente sans. */
  --sans: var(--serif);
  --r: 16px;
  --r-btn: 14px;
  --r-input: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 8px; }
.muted { color: var(--mut); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.06em; }
.note { background: var(--badge); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; }
.warn { color: var(--warn); font-weight: 500; }
.gifted { color: var(--green); font-weight: 500; }

/* ---------------------------------------------------------------- testata */

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.logo img { height: 34px; width: auto; }
.top-sub { font-family: var(--serif); font-size: 1.1rem; color: var(--mut); }
#who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; font-size: 0.9rem; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }
body.admin main { max-width: 1100px; }

/* ----------------------------------------------------------------- blocchi */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 520px; margin: 24px auto; }
.card.empty { text-align: center; padding: 40px 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.lists { display: grid; gap: 12px; }
.list-card { display: block; text-decoration: none; margin: 0; transition: border-color .15s; }
.list-card:hover { border-color: var(--line-strong); }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.list-head h1, .list-head h2 { margin-bottom: 4px; }

.badge { flex: none; font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; background: var(--badge); color: var(--mut); white-space: nowrap; }
.badge.open { background: #e4ebdf; color: #4f5c47; }
.badge.closed { background: #ece6e3; color: #7a5a52; }

details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: "＋"; float: right; color: var(--mut); }
details.card[open] > summary::after { content: "−"; }
details.card[open] > summary { margin-bottom: 12px; }

/* ----------------------------------------------------------------- bottoni */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line-strong); }
.btn.primary { background: var(--sage); color: #fff; border-color: var(--sage); }
.btn.primary:hover:not(:disabled) { background: var(--green); border-color: var(--green); }
.btn.danger { color: var(--danger); border-color: #e2c6c0; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--mut); text-decoration: underline; text-underline-offset: 3px; font-weight: 400; }
.btn.link:hover { color: var(--ink); }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.small, .small.btn { font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* -------------------------------------------------------------------- form */

.form { display: grid; gap: 14px; margin: 12px 0; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.lbl { font-size: 0.85rem; font-weight: 500; color: var(--mut); }
.hint { font-size: 0.8rem; color: var(--mut-2); }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
input[type="radio"] { width: 20px; min-height: 20px; margin: 3px 0 0; accent-color: var(--sage); flex: none; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio span { display: grid; }
.radio small { color: var(--mut); }
.addr { display: grid; gap: 12px; padding: 14px; background: var(--surface); border-radius: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 10px; }
.otp { font-size: 2rem; letter-spacing: 0.4em; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.inline { display: flex; gap: 10px; margin-top: 12px; }
.inline input { flex: 1; }

/* ------------------------------------------------------- valore e minimo */

.meter { margin-top: 16px; }
.meter-bar { height: 8px; background: var(--badge); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.meter-bar span { display: block; height: 100%; background: var(--sage); border-radius: 999px; }
.meter.ok .meter-bar span { background: var(--green); }

/* ---------------------------------------------------------------- prodotti */

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item.gone .iimg { opacity: .45; }
.iimg { flex: none; width: 64px; height: 80px; border-radius: 10px; background: var(--surface); overflow: hidden; }
.iimg img { width: 100%; height: 100%; object-fit: cover; }
.imain { flex: 1; min-width: 0; }
.imain p { margin: 0; }
.ititle { font-weight: 500; }
.iside { display: grid; justify-items: end; gap: 6px; }
.qty { display: flex; align-items: center; gap: 8px; }
.step { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.step:disabled { opacity: .35; cursor: default; }
.qty-n { min-width: 22px; text-align: center; font-weight: 500; }

.owners { list-style: none; padding: 0; margin: 0 0 4px; }
.owners li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.owners li:first-child { border-top: 0; }
.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; overflow-wrap: anywhere; }

/* ------------------------------------------------- scelta prodotti (foglio) */

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(28, 26, 23, .35); display: flex; justify-content: center; align-items: flex-end; }
.sheet-panel { position: relative; background: var(--bg); width: 100%; max-width: 960px; height: 92vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet-head h2 { margin: 0; }
.sheet-search { padding: 4px 16px 10px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px 32px; -webkit-overflow-scrolling: touch; }
.cats { margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--sage); color: #fff; border-color: var(--sage); }
.chip.off { color: var(--mut-2); text-decoration: line-through; }
.crumb { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.crumb span { font-family: var(--serif); font-size: 1.15rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-foot { display: flex; justify-content: center; margin-top: 16px; }
.pcard { display: grid; gap: 6px; text-align: left; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink); }
.pcard-wrap { position: relative; }
.pcard-wrap .pcard { width: 100%; }
.quick { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(28, 26, 23, .12); }
.quick:hover { background: var(--sage); color: #fff; border-color: var(--sage); }
.quick:disabled { opacity: .5; cursor: default; }
.qmodal { position: absolute; inset: 0; z-index: 2; background: rgba(28, 26, 23, .35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.qmodal-box { background: var(--bg); border-radius: var(--r); width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto; padding: 16px; }
.qmodal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.qmodal-head img { width: 56px; height: 70px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.qmodal-head h3 { flex: 1; margin: 0; font-size: 1rem; }
.pimg { display: block; width: 100%; padding-top: 125%; position: relative; background: var(--surface); border-radius: 12px; overflow: hidden; }
.pimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ptitle { font-size: 0.9rem; line-height: 1.3; }
.pprice { font-size: 0.9rem; color: var(--mut); }
.pdetail { display: grid; gap: 20px; }
.pdimg { background: var(--surface); border-radius: 14px; overflow: hidden; max-width: 420px; }
.ptitle-l { font-size: 1.5rem; }
.price { font-size: 1.15rem; }
.price s { color: var(--mut-2); font-size: 0.95rem; }
.opts { display: grid; gap: 12px; margin: 12px 0; }
.opt-name { font-size: 0.85rem; font-weight: 500; color: var(--mut); margin: 0 0 6px; }
.pdetail .qty { margin: 8px 0 4px; }
.pdetail .qty .opt-name { margin: 0 8px 0 0; }

/* ---------------------------------------------------------- tabella negozio */

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1 1 260px; }
.filters select { flex: 0 1 200px; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-weight: 500; color: var(--mut); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface); }

/* ------------------------------------------------------------------- toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

@media (min-width: 720px) {
  h1 { font-size: 2.4rem; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pdetail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sheet { align-items: center; }
  .sheet-panel { height: 88vh; border-radius: 20px; }
}
@media (max-width: 480px) {
  .top-sub { display: none; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 .field:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .item { flex-wrap: wrap; }
  .iside { width: 100%; grid-auto-flow: column; justify-content: space-between; align-items: center; padding-left: 78px; }
}

/* Condivisione, regali ricevuti */
.share-link { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 0.9rem; }
.share-row { margin: 10px 0 4px; }
.qr-wrap { margin-top: 12px; }
.qr-wrap summary { cursor: pointer; color: var(--mut); text-decoration: underline; text-underline-offset: 3px; }
.qr { width: 200px; margin-top: 10px; background: #fff; padding: 8px; border-radius: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.giftcard { background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.giftcard p { margin: 4px 0; }
.gifts { list-style: none; margin: 0; padding: 0; }
.gifts li { padding: 12px 0; border-top: 1px solid var(--line); }
.gifts li:first-child { border-top: 0; }
.gifts p { margin: 2px 0; }
.msg { font-family: var(--serif); font-style: italic; }

/* Pagina pubblica di chi regala */
.qmodal.fixed { position: fixed; z-index: 30; }
.qmodal-box.form { display: grid; gap: 12px; }
.qmodal-box textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); resize: vertical; }
.pub-hero { text-align: center; }
.pub-hero p { max-width: 560px; margin-left: auto; margin-right: auto; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--mut); margin: 0; }
.pub-sec { margin: 28px 0 12px; }
.pub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pub-card { display: flex; flex-direction: column; gap: 4px; }
.pub-card p { margin: 0; }
.pub-card .btn, .pub-card .badge { margin-top: auto; }
.pub-card .badge { align-self: flex-start; }
.pub-card.off .pimg { opacity: .55; }
.pub-foot { margin-top: 32px; }
@media (min-width: 720px) {
  .pub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
