/* app.css — stili estratti fedelmente dai mockup .dc.html (Sistema.dc.html = fonte di verità).
   Mobile-first a 390px; su desktop la colonna è centrata con fondo neutro attorno. */

:root {
  --blu: #0000ff;            /* Blu Adadò: marchio, azioni primarie, icone */
  --blu-tenue: #eef0ff;      /* fondo di selezione e avvisi */
  --blu-tenue-bd: #dfe3ff;
  --ink: #2c3e50;            /* testo principale */
  --grigio: #7f8c8d;         /* testo secondario */
  --grigio-tenue: #95a5a6;   /* etichette e didascalie */
  --grigio-chiaro: #b0b8bb;
  --linea: #ecf0f1;          /* bordi e separatori */
  --linea-soft: #f4f6f6;
  --fondo: #f5f5f5;          /* sfondo delle schermate */
  --superficie: #f8f9fa;     /* riquadri interni alle schede */
  --ok: #27ae60;
  --ok-bg: #eafaf1;
  --ok-bd: #d3f0e0;
  --ok-text: #1e7a45;
  --warn: #f39c12;
  --warn-bg: #fff8ec;
  --warn-bd: #ffe6bd;
  --warn-text: #8a6220;
  --err: #e74c3c;
  --err-bg: #fdeceb;
  --err-bd: #f8d5d2;
  --err-text: #a93226;
  --wa: #25D366;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #e9eaec; /* fondo neutro attorno alla colonna su desktop */
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blu); text-decoration: none; }
a:hover { color: #0000cc; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; padding: 0; }
input, textarea { font-family: inherit; }
svg { display: block; }

/* ---- Shell ---- */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--fondo);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}
@media (min-width: 431px) {
  .app { box-shadow: 0 0 40px rgba(0,0,0,0.12); }
}
.view { flex-grow: 1; overflow-x: hidden; display: flex; flex-direction: column; }

/* ---- Header ---- */
.header {
  position: sticky; top: 0; z-index: 10;
  background: #ffffff; border-bottom: 1px solid var(--linea);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.header:empty { display: none; }
.brand { font-size: 21px; font-weight: 800; color: var(--blu); letter-spacing: -0.8px; line-height: 1; }
.hd-back {
  width: 36px; height: 36px; border-radius: 12px; background: var(--fondo);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hd-title {
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hd-spacer { flex-grow: 1; }
.hd-lang {
  display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px;
  border-radius: 11px; background: var(--fondo);
}
.hd-lang span { font-size: 12px; font-weight: 700; color: var(--ink); letter-spacing: .3px; }
.hd-profile { display: flex; align-items: center; gap: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blu); color: #fff;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  letter-spacing: .2px;
}
.hd-badge {
  font-size: 10px; font-weight: 700; color: var(--grigio); background: var(--fondo);
  padding: 4px 9px; border-radius: 8px; letter-spacing: .5px; white-space: nowrap;
}

/* ---- Cards e superfici ---- */
.card { background: #fff; border-radius: 20px; box-shadow: var(--shadow-card); padding: 18px; }
.card-line { background: #fff; border: 1px solid var(--linea); border-radius: 18px; }
.panel { background: var(--superficie); border-radius: 14px; }

/* ---- Bottoni (44px minimi, raggio 14) ---- */
.btn-primary {
  display: block; width: 100%; padding: 16px; border-radius: 14px;
  background: var(--blu); color: #fff; font-size: 16px; font-weight: 600;
  transition: opacity .15s;
}
.btn-primary:disabled { background: #bdc3c7; cursor: default; }
.btn-secondary {
  display: block; width: 100%; padding: 15px; border-radius: 14px;
  border: 2px solid var(--blu); color: var(--blu); font-size: 15px; font-weight: 700;
}
.btn-neutral {
  display: block; width: 100%; padding: 16px; border-radius: 14px;
  background: var(--fondo); color: var(--ink); font-size: 15px; font-weight: 600;
}
.btn-row { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---- Tile della home (raggio 20, icona in cerchio 46px, ingresso "pop") ---- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.tile {
  background: #fff; border: 1px solid var(--linea); border-radius: 20px;
  padding: 13px 8px 11px; min-height: 102px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  position: relative;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.4), border-color .15s ease, box-shadow .18s ease;
  animation: pop .5s cubic-bezier(.2,.8,.3,1.15) both;
}
.tile:active { transform: scale(0.94); }
.tile:hover { border-color: #c9cdff; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,255,0.10); }
.tile:nth-child(2) { animation-delay: .04s; } .tile:nth-child(3) { animation-delay: .08s; }
.tile:nth-child(4) { animation-delay: .12s; } .tile:nth-child(5) { animation-delay: .16s; }
.tile:nth-child(6) { animation-delay: .20s; } .tile:nth-child(7) { animation-delay: .24s; }
.tile:nth-child(8) { animation-delay: .28s; } .tile:nth-child(9) { animation-delay: .32s; }
.tile:nth-child(10) { animation-delay: .36s; } .tile:nth-child(11) { animation-delay: .40s; }
.tile:nth-child(12) { animation-delay: .44s; }
.tile.tile-danger { border-color: #ffe0dc; }
.tile span { font-size: 11.5px; font-weight: 600; color: var(--ink); text-align: center; line-height: 1.25; }
.tile-ico {
  width: 46px; height: 46px; border-radius: 50%; background: var(--blu-tenue);
  display: flex; align-items: center; justify-content: center;
}
.tile-danger .tile-ico { background: var(--err-bg); }
@keyframes pop { 0% { opacity: 0; transform: translateY(12px) scale(.95); } 100% { opacity: 1; transform: none; } }
@keyframes salita { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }
.rise { animation: salita .45s ease both; }
.rise2 { animation: salita .5s ease both; }
.tile .badge {
  position: absolute; top: 9px; right: 11px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--err); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Stati e avvisi ---- */
.note { display: flex; gap: 10px; padding: 12px 13px; border-radius: 13px; border: 1px solid transparent; }
.note svg { flex-shrink: 0; margin-top: 1px; }
.note div { font-size: 12.5px; line-height: 1.45; }
.note-ok   { background: var(--ok-bg);   border-color: var(--ok-bd);   color: var(--ok-text); }
.note-warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-text); }
.note-err  { background: var(--err-bg);  border-color: var(--err-bd);  color: var(--err-text); }
.note-info { background: var(--blu-tenue); border-color: var(--blu-tenue-bd); color: var(--ink); }

/* ---- Chip / filtri orizzontali ---- */
.chips { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 34px; padding: 0 13px; border-radius: 11px;
  background: #fff; color: var(--grigio); font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--linea);
}
.chip.on { background: var(--blu); color: #fff; border-color: var(--blu); }

/* ---- Opzione selezionabile (bordo 2px) ---- */
.opt {
  display: flex; align-items: center; gap: 14px; padding: 16px; width: 100%;
  border: 2px solid var(--linea); background: #fff; border-radius: 14px; text-align: left;
  min-height: 68px;
  transition: border-color .18s, background .18s, transform .12s;
}
.opt:active { transform: scale(0.98); }
.opt.on { border-color: var(--blu); background: var(--blu-tenue); }
.opt-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.opt-desc { font-size: 12px; color: var(--grigio-tenue); margin-top: 2px; }

/* ---- Row hover ---- */
.row { transition: background .15s; border-radius: 12px; }
.row:hover { background: #fafbff; }

/* ---- Sheet dal basso + drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(20,24,35,0.4); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 430px;
  background: #fff; border-radius: 24px 24px 0 0; padding: 18px 16px 22px; z-index: 21;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
}
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--linea); margin: 0 auto 16px; }
.drawer {
  position: absolute; top: 62px; right: 12px; width: 246px; background: #fff;
  border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,0.2); padding: 8px; z-index: 21;
}
.drawer-item {
  display: flex; width: 100%; align-items: center; gap: 11px; padding: 12px 10px;
  border-radius: 12px; text-align: left; min-height: 46px;
}
.drawer-item span { font-size: 14px; color: var(--ink); font-weight: 500; }
.drawer-sep { height: 1px; background: var(--linea); margin: 6px 10px; }

/* ---- Lingue ---- */
.lang-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 13px 6px;
  border: 2px solid var(--linea); background: #fff; border-radius: 14px; min-height: 66px;
}
.lang-btn.on { border-color: var(--blu); background: var(--blu-tenue); }
.lang-btn .code { font-size: 12.5px; font-weight: 700; color: var(--ink); letter-spacing: .4px; }
.lang-btn .name { font-size: 11px; color: var(--grigio-tenue); text-align: center; line-height: 1.2; }

/* ---- Bottone porta ---- */
.door-btn {
  width: 168px; height: 168px; border-radius: 50%; background: var(--blu);
  margin: 0 auto 16px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; box-shadow: 0 8px 30px rgba(0,0,255,0.24);
  -webkit-user-select: none; user-select: none; touch-action: none; position: relative;
}
.door-btn span { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.door-btn.open { background: var(--ok); box-shadow: 0 8px 30px rgba(39,174,96,0.3); }
.door-btn.holding { transform: scale(0.97); }
.door-ring { position: absolute; inset: -7px; border-radius: 50%; pointer-events: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(39,174,96,.42); }
  70% { box-shadow: 0 0 0 22px rgba(39,174,96,0); }
  100% { box-shadow: 0 0 0 0 rgba(39,174,96,0); }
}
.pulse { animation: pulse 1.6s infinite; }

/* keybox */
.kb-digits { display: flex; gap: 9px; justify-content: center; margin-bottom: 16px; }
.kb-digit {
  width: 54px; height: 66px; border-radius: 14px; background: var(--superficie);
  border: 1.5px solid var(--linea); display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: var(--blu);
}
.chip-status { font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 8px; letter-spacing: .4px; }

/* ---- Chat ---- */
.chat-wrap { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.chat-thread { flex-grow: 1; overflow-y: auto; padding: 14px 14px 8px; }
.chat-day { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.chat-day div:first-child, .chat-day div:last-child { flex-grow: 1; height: 1px; background: #e6e9ea; }
.chat-day span { font-size: 11px; color: var(--grigio-tenue); font-weight: 500; }
.msg-out { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.msg-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--blu-tenue);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bubble-out {
  background: #fff; border: 1px solid var(--linea); border-radius: 18px 18px 18px 5px;
  padding: 11px 13px; max-width: 264px;
}
.bubble-out div { font-size: 14px; color: var(--ink); line-height: 1.5; white-space: pre-line; overflow-wrap: break-word; }
.msg-in { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.bubble-in { background: var(--blu); border-radius: 18px 18px 5px 18px; padding: 11px 13px; max-width: 264px; }
.bubble-in div { font-size: 14px; color: #fff; line-height: 1.5; white-space: pre-line; overflow-wrap: break-word; }
.msg-time { font-size: 10.5px; color: var(--grigio-chiaro); margin-top: 4px; }
@keyframes dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.tdot { width: 6px; height: 6px; border-radius: 50%; background: var(--grigio-tenue); }
.d1 { animation: dot 1.3s infinite; } .d2 { animation: dot 1.3s .18s infinite; } .d3 { animation: dot 1.3s .36s infinite; }
.quick-bar { flex-shrink: 0; display: flex; gap: 7px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.quick-bar::-webkit-scrollbar { display: none; }
.qr {
  flex-shrink: 0; height: 34px; padding: 0 13px; border-radius: 17px; background: #fff;
  border: 1px solid var(--linea); font-size: 12.5px; font-weight: 500; color: var(--ink);
  transition: background .15s, border-color .15s;
}
.qr:hover { background: var(--blu-tenue); border-color: #c9cdff; }
.composer { flex-shrink: 0; background: #fff; border-top: 1px solid var(--linea); padding: 10px 12px 14px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-input {
  flex-grow: 1; display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 14px; background: var(--fondo); border-radius: 14px;
}
.composer-input input {
  flex-grow: 1; border: none; background: none; outline: none;
  font-size: 14.5px; color: var(--ink); min-width: 0; padding: 12px 0;
}
.composer-input input::placeholder { color: var(--grigio-chiaro); }
.composer-send {
  width: 44px; height: 44px; border-radius: 14px; background: var(--blu);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.composer-send:disabled { background: #bdc3c7; }
.chan-switch { display: flex; gap: 4px; margin: 0 14px 12px; padding: 3px; background: var(--fondo); border-radius: 12px; }
.chan-btn {
  flex-grow: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--grigio);
}
.chan-btn.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.09); }

/* ---- Progress check-in ---- */
.ck-bars { display: flex; gap: 5px; padding-bottom: 12px; }
.ck-bar { flex-grow: 1; height: 3px; border-radius: 2px; background: var(--linea); }
.ck-bar.on { background: var(--blu); }
.ck-dark { flex-grow: 1; background: #000; position: relative; display: flex; flex-direction: column; }

/* ---- Toggle ---- */
.toggle {
  width: 48px; height: 29px; border-radius: 15px; background: #dfe4e6; padding: 3px;
  display: flex; justify-content: flex-start; flex-shrink: 0; transition: background .18s;
}
.toggle.on { background: var(--blu); justify-content: flex-end; }
.toggle div { width: 23px; height: 23px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.22); }

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3.5px solid var(--linea);
  border-top-color: var(--blu); animation: spin .9s linear infinite; margin: 0 auto;
}
.spinner.lg { width: 56px; height: 56px; }
.loading-block { padding: 48px 16px; text-align: center; }
.loading-block .msg { font-size: 13px; color: var(--grigio-tenue); margin-top: 14px; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  max-width: 360px; width: calc(100% - 40px);
  background: #1b1f2e; color: #fff; font-size: 13px; line-height: 1.45;
  padding: 13px 16px; border-radius: 14px; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---- Cart bar ---- */
.cart-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 28px); max-width: 402px;
  display: flex; align-items: center; gap: 12px; background: var(--blu);
  border-radius: 16px; padding: 13px 15px; box-shadow: 0 10px 30px rgba(0,0,255,0.3); z-index: 15;
}
.cart-bar .count { font-size: 11.5px; color: rgba(255,255,255,0.78); }
.cart-bar .total { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -0.4px; }
.cart-bar button {
  height: 42px; padding: 0 18px; border-radius: 12px; background: #fff; color: var(--blu);
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}

/* ---- Sezioni / etichette ---- */
.kicker {
  font-size: 10.5px; font-weight: 700; color: var(--grigio-tenue);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 11px;
}

/* ---- Quantità room service ---- */
.qty-btn { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.qty-btn.minus { background: var(--fondo); }
.qty-btn.plus { background: var(--blu); }
.add-btn {
  width: 34px; height: 34px; border-radius: 11px; background: var(--blu-tenue);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---- Stripe element container ---- */
.stripe-box { background: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow-card); margin-bottom: 14px; min-height: 120px; }

/* ---- Schermata errore token ---- */
.gate { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 26px; text-align: center; }

/* ---- Util ---- */
.hidden { display: none !important; }
.p16 { padding: 16px; }
.mb14 { margin-bottom: 14px; }
