/* Matèn: stesso sistema grafico del sito (sito/app/brand.css).
   Font self-hosted dal sito (/fonts), nero del logo, oro per azioni e prezzi.
   Gli stati dell'ordine hanno colori propri (verde, ambra, corallo): l'oro resta il marchio. */
@font-face { font-family: 'Jost'; font-weight: 400 700; font-display: swap; src: url(/fonts/jost.woff2) format('woff2'); }
@font-face { font-family: 'Jost'; font-style: italic; font-weight: 400 500; font-display: swap; src: url(/fonts/jost-italic.woff2) format('woff2'); }
@font-face { font-family: 'Marcellus'; font-weight: 400; font-display: swap; src: url(/fonts/marcellus.woff2) format('woff2'); }

:root {
  --lacca: #151515;
  --lacca-2: #1c1b1a;
  --lacca-3: #252321;
  --filo: #35312c;
  --filo-2: #4a443d;
  --carta: #f2ebdf;
  --nebbia: #aaa196;
  --oro: #e3c79c;
  --oro-chiaro: #f0dab4;
  --oro-2: #b58a5c;
  --oro-soft: rgba(227, 199, 156, .09);
  --glicine: #b4a5ce;
  --ok: #8fcf9f;
  --ok-soft: rgba(143, 207, 159, .13);
  --alert: #ec8f78;
  --alert-soft: rgba(236, 143, 120, .13);
  --warn: #e9c46a;
  --warn-soft: rgba(233, 196, 106, .13);
  --display: 'Marcellus', Georgia, serif;
  --sans: 'Jost', Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--lacca); color: var(--carta); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.15; }
em { font-style: normal; color: var(--oro); }
a { color: var(--oro); }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
::selection { background: var(--oro); color: var(--lacca); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--nebbia); }
.small { font-size: .88rem; }
.hidden { display: none !important; }
.kicker { font: 500 .9rem/1.5 var(--sans); color: var(--nebbia); }
/* Le cifre di Marcellus somigliano a lettere (1 come I, 0 come O): numeri sempre in Jost */
.digits { font-family: var(--sans); font-size: .94em; font-variant-numeric: lining-nums; }
hr, .rule { border: 0; border-top: 1px solid var(--filo); margin: 0; }

/* Striscia e testata, come sul sito */
.top-strip {
  background: #0f0f0f; color: var(--nebbia); padding: 6px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font: 400 .84rem/1.4 var(--sans); border-bottom: 1px solid var(--filo);
}
.top-strip a { color: var(--oro); text-decoration: none; }
.masthead {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; min-height: 68px;
  border-bottom: 1px solid var(--filo); background: var(--lacca); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--carta); text-decoration: none; flex-shrink: 0; }
.brand-logo { display: block; width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0; box-shadow: 0 0 0 1px var(--oro-2); }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { display: grid; gap: 1px; }
.brand-name img { height: 22px; width: auto; }
.brand-name small { font-size: .82rem; color: var(--nebbia); }
.masthead .spacer { flex: 1; }
@media (max-width: 420px) { .brand-logo { width: 36px; height: 36px; } .brand-name img { height: 18px; } }

/* Pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--oro); background: var(--oro); color: var(--lacca);
  padding: 11px 18px; border-radius: 5px; font-weight: 500; font-size: .98rem; line-height: 1.3; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s, color .15s; min-height: 46px;
}
.btn:hover { background: var(--oro-chiaro); border-color: var(--oro-chiaro); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--carta); border-color: var(--filo-2); }
.btn.ghost:hover { border-color: var(--oro); color: var(--oro); }
.btn.basil { background: var(--ok); border-color: var(--ok); color: #102016; }
.btn.basil:hover { background: #a9dcb5; border-color: #a9dcb5; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--oro); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.icon { width: 18px; height: 18px; flex: none; }

/* Chip e selettori */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--filo-2); background: transparent; border-radius: 5px; color: var(--carta);
  padding: 7px 13px; font-size: .95rem; cursor: pointer; min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--oro-soft); color: var(--oro); border-color: var(--oro); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg button { border: 1px solid var(--filo-2); background: transparent; border-radius: 5px; padding: 11px; cursor: pointer; font-weight: 500; min-height: 48px; }
.seg button[aria-pressed="true"] { background: var(--oro-soft); color: var(--oro); border-color: var(--oro); }

/* Moduli */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--carta); background: var(--lacca);
  border: 1px solid var(--filo-2); border-radius: 5px; padding: 11px 13px; min-height: 46px;
}
input::placeholder, textarea::placeholder { color: #7d756b; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--oro); box-shadow: 0 0 0 3px rgba(227, 199, 156, .15); }
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
textarea { min-height: 70px; resize: none; }

/* Stati dell'ordine */
.tag {
  display: inline-block; font: 500 .78rem/1 var(--sans); letter-spacing: .02em;
  padding: 5px 8px; border-radius: 4px; background: var(--lacca-3); color: var(--carta); white-space: nowrap;
}
.tag.RICEVUTO { background: var(--oro-soft); color: var(--oro); }
.tag.IN_PREPARAZIONE, .tag.ACCETTATO { background: var(--warn-soft); color: var(--warn); }
.tag.PRONTO { background: var(--oro); color: var(--lacca); }
.tag.PRESO, .tag.IN_CONSEGNA { background: var(--ok-soft); color: var(--ok); }
.tag.CONSEGNATO, .tag.RITIRATO, .tag.SERVITO { background: var(--ok); color: #102016; }
.tag.RIFIUTATO, .tag.ANNULLATO, .tag.NON_CONSEGNATO { background: transparent; color: var(--alert); border: 1px solid var(--alert); }

/* Foglio dal basso (telefono) / finestra (computer) */
.sheet-back {
  position: fixed; inset: 0; background: rgba(8, 8, 8, .72); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--lacca-2); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 14px 14px 0 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--filo); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); animation: up .2s ease-out;
}
@media (min-width: 700px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 12px; }
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-back.closing { pointer-events: none; animation: fade-out .14s ease-in forwards; }
.sheet-back.closing .sheet { animation: down .14s ease-in forwards; }
@keyframes down { to { transform: translateY(24px); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .toast, .sheet-back.closing, .sheet-back.closing .sheet { animation: none; } }
.sheet .close {
  float: right; background: var(--lacca); border: 1px solid var(--filo-2); border-radius: 50%; width: 40px; height: 40px;
  display: grid; place-items: center; cursor: pointer; margin: -4px -4px 0 0; color: var(--carta);
}

/* Conferme (MT.ask in common.js): una finestra al centro con icona, titolo, spiegazione e due tasti grandi. Corallo se toglie o cancella,
   oro altrimenti. Sta sopra i fogli (z-index 50) e sotto gli avvisi in alto (90). Il pannello admin le muove con le sue molle (motion.css). */
.ask-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(8, 8, 8, .66); animation: ask-fade .18s ease-out both; }
.ask-back.leaving { pointer-events: none; animation: fade-out .14s ease-in forwards; }
.ask { --c: var(--oro); width: min(500px, 100%); padding: 28px 24px 24px; border-radius: 28px; border: 1px solid var(--filo-2); background: var(--lacca-2); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .9); text-align: center; }
.ask.danger { --c: var(--alert); }
.ask-ic { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 32px; background: rgba(227, 199, 156, .14); color: var(--oro); }
.ask.danger .ask-ic { background: rgba(236, 143, 120, .18); color: var(--alert); }
.ask-t { margin: 0 0 10px; font: 400 28px/1.15 var(--display); color: var(--carta); }
.ask-x { margin: 0; font-size: 17px; line-height: 1.5; color: var(--nebbia); white-space: pre-line; }
.ask-ac { display: flex; gap: 12px; margin-top: 24px; }
.ask-b { flex: 1; min-height: 56px; padding: 0 18px; border: 1px solid var(--filo-2); border-radius: 28px; background: none; color: var(--carta); font: 500 17px/1.15 var(--sans); cursor: pointer; }
.ask-b:hover { border-color: var(--oro); color: var(--oro); }
.ask-b.main { border-color: var(--c); background: var(--c); color: #151515; font-weight: 700; }
.ask-b.main:hover { filter: brightness(1.08); color: #151515; }
.ask.danger .ask-b.main { color: #1f0e08; }
.ask-b:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; }
@media (max-width: 440px) { .ask-ac { flex-direction: column-reverse; } }
/* senza il motore di movimento del pannello: una curva con un filo di rimbalzo */
.ask-css .ask { animation: ask-in .26s cubic-bezier(.34, 1.56, .64, 1) both; }
.ask-css.leaving .ask { animation: ask-out .14s ease-in forwards; }
@keyframes ask-fade { from { opacity: 0; } }
@keyframes ask-in { from { transform: translateY(16px) scale(.88); opacity: 0; } }
@keyframes ask-out { to { transform: translateY(8px) scale(.92); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ask-back, .ask-back.leaving, .ask-css .ask, .ask-css.leaving .ask { animation: none; } }

/* Avvisi */
#toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 440px); }
.toast {
  background: var(--lacca-3); color: var(--carta); padding: 13px 15px; border-radius: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--filo); display: flex; gap: 10px; align-items: flex-start; animation: up .2s ease-out; font-size: .98rem;
}
.toast.good { border-left: 3px solid var(--oro); }
.toast.bad { border-left: 3px solid var(--alert); }

.empty { padding: 28px 18px; text-align: center; color: var(--nebbia); font-family: var(--display); font-size: 1.1rem; }
.map { height: 240px; border-radius: var(--radius); border: 1px solid var(--filo); background: var(--lacca-2); z-index: 1; }
.leaflet-container { font: inherit; background: var(--lacca-2); }
/* Mappa scura: le tile OpenStreetMap invertite, i segnaposto restano a colori */
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.95) saturate(.5); }
.leaflet-container .leaflet-control-attribution { background: rgba(21, 21, 21, .8); color: var(--nebbia); }
.leaflet-container .leaflet-control-attribution a { color: var(--oro); }
.leaflet-tooltip { background: var(--lacca-3); color: var(--carta); border-color: var(--filo); }

/* PIN */
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-pad button {
  height: 62px; border: 1px solid var(--filo-2); background: var(--lacca-2); border-radius: 8px;
  font: 500 1.45rem/1 var(--sans); font-variant-numeric: lining-nums; cursor: pointer; transition: border-color .15s, background .15s;
}
.pin-pad button:active { background: var(--oro-soft); border-color: var(--oro); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 20px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--nebbia); }
.pin-dots i.on { background: var(--oro); border-color: var(--oro); }
.center-card { max-width: 380px; margin: 7vh auto; padding: 0 18px; text-align: center; }
.center-card .brand-logo { width: 84px; height: 84px; margin: 0 auto 14px; }

/* Accesso con account (admin) e collegamento del telefono (rider) */
.login-form { text-align: left; margin-top: 18px; }
.login-form .switch { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin: 2px 0 16px; cursor: pointer; }
.login-form .switch input { width: 18px; height: 18px; min-height: 0; accent-color: var(--oro); }
.code-input { text-align: center; font: 500 1.5rem/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; }
.code-big { font: 500 1.7rem/1 var(--sans); letter-spacing: .14em; text-align: center; margin: 14px 0 4px; color: var(--oro); font-variant-numeric: lining-nums; }
.qr-box { width: 240px; margin: 16px auto 0; padding: 10px; background: #fff; border: 1px solid var(--filo); border-radius: 8px; }
.qr-box img, .qr-box canvas { display: block; width: 100% !important; height: auto !important; }

/* Solo anteprima locale: pulsanti rotondi, nessuna animazione. */
/* pill ai pulsanti veri; le righe e le tessere che sono <button> (piatti, tavoli) restano rettangolari */
button:where(:not(.dish, .c-dish, .c-lname, .stile)), .btn { border-radius: 999px; }
button, .btn { transition: none !important; animation: none !important; }
.icon-btn, .close, .qty button { border-radius: 50%; }
.icon[data-icon-library] { display: inline-block; overflow: visible; flex-shrink: 0; stroke: none; }
@media(max-width:760px) {
 .btn, .btn.sm, .chip, .sheet .close { min-height: 44px; }
 .sheet .close { width: 44px; height: 44px; }
 .qty button { width: 44px; height: 44px; }
 input, select, textarea { font-size: 16px; }
 .link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
 .brand { min-height: 44px; }
}
input[aria-invalid=true] { border-color: var(--alert); }
