/* ── Reset & variables ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #4A9FCB;
  --blue-light:  #EBF5FB;
  --blue-mid:    #D6EAF8;
  --blue-dark:   #2471A3;
  --white:       #FFFFFF;
  --bg:          #F4F8FB;
  --gray:        #E8ECF0;
  --text:        #1A2B3C;
  --text-muted:  #6B7C8D;
  --success:     #27AE60;
  --warning:     #E67E22;
  --danger:      #E74C3C;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 2px 16px rgba(74,159,203,0.10);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.07);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Typography ────────────────────────────────────────────────── */
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ── Header ────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray);
  padding: 0 1rem;
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}
.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.5px;
}
.header-right { display: flex; align-items: center; gap: 0.5rem; }

/* ── Bottom nav ────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}
.nav-btn .nav-icon { font-size: 1.3rem; }
.nav-btn.active { color: var(--blue); }

/* ── Main content area ─────────────────────────────────────────── */
.main-content {
  padding: 1.25rem 1rem 5.5rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Auth view ─────────────────────────────────────────────────── */
.view-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(160deg, var(--blue-light) 0%, var(--white) 60%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2rem 1.75rem;
}
.auth-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--blue);
  text-align: center;
  letter-spacing: -1px;
  margin-bottom: 0.25rem;
}
.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}
.lang-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 1.5rem;
}
.tab-btn {
  flex: 1;
  padding: 0.55rem;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active {
  background: var(--white);
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.form-row { display: flex; gap: 0.75rem; }
.form-row .form-group { flex: 1; }

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1.5px solid var(--gray);
  border-radius: var(--radius-sm);
  font-size: 1rem;            /* prevents iOS zoom */
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
}
textarea { min-height: 80px; resize: vertical; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7C8D' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.5rem; }

/* ── Budget selector ───────────────────────────────────────────── */
.budget-row { display: flex; gap: 0.5rem; }
.budget-btn {
  flex: 1;
  padding: 0.7rem 0;
  border: 1.5px solid var(--gray);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.budget-btn.active {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue-dark);
}

/* ── Toggles ───────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.95rem; font-weight: 500; }

/* iOS-style switch */
.switch { position: relative; display: inline-block; width: 48px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray);
  border-radius: 34px;
  transition: 0.2s;
}
.slider:before {
  content: '';
  position: absolute;
  height: 22px; width: 22px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background: var(--blue); }
input:checked + .slider:before { transform: translateX(20px); }

/* Kids ages input */
.kids-ages {
  margin-top: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.5rem;
}
.btn-primary:active { background: var(--blue-dark); }
.btn-secondary {
  background: var(--blue-light);
  color: var(--blue-dark);
}
.btn-ghost {
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* ── Trip cards ────────────────────────────────────────────────── */
.trip-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: transform 0.1s;
  border-left: 4px solid var(--blue);
}
.trip-card:active { transform: scale(0.98); }
.trip-dest { font-size: 1.05rem; font-weight: 700; }
.trip-dates { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.trip-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }

/* ── Status badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-searching { background: #FEF9E7; color: #B7770D; }
.badge-waiting   { background: #EBF5FB; color: #2471A3; }
.badge-done      { background: #EAFAF1; color: #1E8449; }
.badge-error     { background: #FDEDEC; color: #C0392B; }

/* ── Hotel result cards ────────────────────────────────────────── */
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  position: relative;
}
.result-card.best {
  border: 2px solid var(--blue);
}

/* ── New offer mini banner (dopo hotel confermato) ─────── */
.new-offer-mini {
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  margin-top: .5rem;
  font-size: .85rem;
  font-weight: 500;
}
.new-offer-label { color: var(--blue-dark); font-weight: 600; margin-bottom: .15rem; }
.new-offer-meta  { color: var(--text); }

/* ── Hotel non disponibile ─────────────────────────────── */
.unavailable-card { opacity: .6; }
.best-label {
  position: absolute;
  top: -10px; right: 12px;
  background: var(--blue);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.result-name { font-size: 1rem; font-weight: 700; margin-bottom: 0.15rem; }
.option-label-badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--blue-dark);
  background: #EBF4FF;
  border: 1px solid #C3DDF9;
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: .3rem;
}
.multi-option-card .result-name { margin-bottom: .6rem; }
.multi-option-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}
.option-col {
  flex: 1;
  min-width: 130px;
  padding: .65rem .7rem;
  background: #F8FAFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.option-col .btn-accept {
  margin-top: auto;
}
.option-col-best {
  border-color: var(--blue);
  background: #EFF6FF;
}
.option-price-row {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  margin: .25rem 0 .1rem;
}
.result-price { font-size: 1.5rem; font-weight: 800; color: var(--blue-dark); }
.result-price-sub { font-size: 0.82rem; color: var(--text-muted); }
.result-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0.5rem; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--blue-light);
  color: var(--blue-dark);
}
.tag.green  { background: #EAFAF1; color: #1E8449; }
.tag.yellow { background: #FEF9E7; color: #B7770D; }
.result-notes {
  margin-top: 0.6rem;
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Status page ───────────────────────────────────────────────── */
.status-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  min-height: 60vh;
}
.status-icon { font-size: 3.5rem; margin-bottom: 1rem; }

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--blue-mid);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dividers & section titles ─────────────────────────────────── */
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.6rem;
}
.divider {
  border: none;
  border-top: 1px solid var(--gray);
  margin: 1.25rem 0;
}

/* ── Lang switcher ─────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border-radius: 6px;
  padding: 2px;
}
.lang-opt {
  padding: 4px 9px;
  border: none;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  transition: all 0.15s;
}
.lang-opt.active {
  background: var(--white);
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Logout btn ────────────────────────────────────────────────── */
.logout-btn {
  padding: 6px 10px;
  border: none;
  background: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ── Offer acceptance ──────────────────────────────────────────── */
.result-action { margin-top: 0.75rem; }

.btn-accept {
  background: var(--success);
  color: white;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-block;
}
.btn-accept:active { background: #1E8449; }

.btn-offer {
  background: var(--blue-light);
  color: var(--blue-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.accepted-banner {
  background: #EAFAF1;
  color: #1E8449;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Hotels contacted list ─────────────────────────────────────── */
.hotels-list {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.hotel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--gray);
  font-size: 0.86rem;
}
.hotel-row:last-child { border-bottom: none; }
.hotel-row-name {
  font-weight: 500;
  flex: 1;
  margin-right: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hotel-row-status {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-sent  { background: #EAFAF1; color: #1E8449; }
.status-found { background: #FEF9E7; color: #B7770D; }
.status-none  { background: var(--bg); color: var(--text-muted); }

/* ── Action Required (Type D smart batching) ──────────────────── */
.action-required-section {
  background: #FEF9E7;
  border-left: 4px solid #F39C12;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.action-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-top: 0.6rem;
  cursor: pointer;
  border: 1px solid var(--gray);
}
.action-card:active { transform: scale(0.99); }
.action-question { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.4rem; }
.action-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  font-size: 0.82rem; color: var(--text-muted);
}
.action-badge {
  background: #F39C12; color: white;
  padding: 2px 9px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 700;
}
.action-hotels { color: var(--text-muted); font-size: 0.78rem; }

/* ── Stats card ────────────────────────────────────────────────── */
.stats-card {
  background: linear-gradient(135deg, var(--blue-light) 0%, var(--white) 100%);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin: 1rem 0;
  text-align: center;
}
.stats-title { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.stats-big {
  font-size: 2.2rem; font-weight: 800; color: var(--success);
  margin: 0.2rem 0;
}
.stats-sub { font-size: 0.85rem; color: var(--text-muted); }
.stats-detail { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-top: 0.4rem; }

/* ── Payment widget ─────────────────────────────────────────────── */
.payment-widget {
  background: #EAFAF1;
  border: 1px solid #ABEBC6;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.payment-header {
  font-weight: 700; color: #1E8449; font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.pay-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0; border-bottom: 1px solid #D5F5E3;
  font-size: 0.88rem;
}
.pay-row:last-child { border-bottom: none; }
.pay-label { color: var(--text-muted); flex-shrink: 0; min-width: 80px; }
.pay-val { flex: 1; font-weight: 600; word-break: break-all; }
.pay-val.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.85rem; }
.pay-copy {
  background: var(--white); border: 1px solid #ABEBC6;
  color: #1E8449; padding: 2px 8px; border-radius: 5px;
  font-size: 0.74rem; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}

/* ── Booked hotel card (post-confirmation) ─────────────────────── */
.booked-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin: 1rem 0;
  border: 2px solid var(--success);
}
.booked-banner {
  background: linear-gradient(135deg, #27AE60 0%, #1E8449 100%);
  color: white;
  padding: 1rem 1.2rem;
  text-align: center;
}
.booked-title { font-size: 1.1rem; font-weight: 700; }
.booked-sub   { font-size: 0.85rem; opacity: 0.92; margin-top: 0.2rem; }
.booked-body { padding: 1.1rem 1.2rem; }
.booked-hotel-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.6rem; }
.booked-row {
  display: flex; justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--gray);
  font-size: 0.9rem;
}
.booked-row:last-child { border-bottom: none; }
.b-label { color: var(--text-muted); }
.b-val { font-weight: 600; text-align: right; }
.booked-price { color: var(--blue-dark); font-size: 1.1rem; }

/* ── Option buttons (Type D answer with options) ────────────────── */
.option-buttons {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-top: 0.5rem;
}
.option-btn {
  width: 100%; padding: 0.85rem 1rem;
  background: var(--white);
  border: 2px solid var(--blue-mid);
  border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 600;
  color: var(--blue-dark);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.option-btn:hover, .option-btn:active {
  background: var(--blue-light);
  border-color: var(--blue);
}

/* ── "Ho pagato" button + countdown ─────────────────────────────── */
.btn-paid {
  background: var(--success);
  color: white;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
}
.btn-paid:active { background: #1E8449; }
.paid-timer {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--white);
  border: 1px dashed var(--success);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.btn-cancel-paid {
  background: var(--white);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Modal (conversation) ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 30, 45, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 300; padding: 0;
}
.modal-card {
  background: var(--white);
  width: 100%; max-width: 560px;
  max-height: 92vh; display: flex; flex-direction: column;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.15);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--gray);
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none; border: none; font-size: 1.2rem;
  color: var(--text-muted); cursor: pointer; padding: 4px 8px;
}
.modal-body {
  flex: 1; overflow-y: auto;
  padding: 1rem 1.1rem;
  background: #FAFBFC;
}
.modal-footer {
  padding: 0.9rem 1.1rem;
  padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--gray);
  background: var(--white);
}
.modal-footer textarea {
  width: 100%; min-height: 60px; max-height: 120px;
  font-size: 0.95rem; padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm); border: 1.5px solid var(--gray);
  margin-bottom: 0.5rem; resize: vertical;
}
.modal-footer .btn-primary { margin-top: 0; padding: 0.7rem; }

/* Message bubbles */
.msg {
  margin-bottom: 0.75rem;
  display: flex; flex-direction: column;
}
.msg-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  max-width: 85%;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.msg.in  { align-items: flex-start; }
.msg.out { align-items: flex-end; }
.msg.in  .msg-bubble  { background: var(--white); border: 1px solid var(--gray); color: var(--text); border-bottom-left-radius: 4px; }
.msg.out .msg-bubble  { background: var(--blue); color: var(--white); border-bottom-right-radius: 4px; }
.msg-meta {
  font-size: 0.7rem; color: var(--text-muted);
  margin-top: 0.2rem; padding: 0 0.4rem;
}
.msg-empty {
  text-align: center; color: var(--text-muted);
  padding: 2rem 1rem; font-size: 0.9rem;
}

/* Conversation button on result cards */
.btn-conv {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--gray);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-conv:active { background: var(--gray); }
.btn-conv .conv-badge {
  display: inline-block;
  background: var(--blue);
  color: white;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-left: 4px;
}

/* ── Utils ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* ── Desktop adjustments ───────────────────────────────────────── */
@media (min-width: 600px) {
  .auth-card { padding: 2.5rem; }
  .main-content { padding: 2rem 1.5rem 6rem; }
}

/* ── Flatpickr overrides ───────────────────────────────────────── */
.flatpickr-calendar { border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.15); border: none; font-family: inherit; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--blue); border-color: var(--blue); }
.flatpickr-day.inRange { background: #DBEAFE; border-color: #DBEAFE; color: var(--blue-dark); }
.flatpickr-day:hover { background: #EFF6FF; }
.flatpickr-months .flatpickr-month { background: var(--blue); color: white; border-radius: 12px 12px 0 0; }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { color: white; }
.flatpickr-weekday { color: var(--blue-dark); font-weight: 600; }

/* ── Link inviati dall'hotel (chip cliccabili) ─────────────────── */
.email-links { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.email-link-chip {
  display: inline-block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--blue-dark);
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: 16px;
  padding: 4px 11px;
  text-decoration: none;
  transition: background .15s;
}
.email-link-chip:hover { background: var(--blue-mid); }

/* ── Destination autocomplete ──────────────────────────── */
.dest-suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--blue);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}
.dest-sug-item {
  padding: .65rem .9rem;
  font-size: .95rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray);
  transition: background .1s;
}
.dest-sug-item:last-child { border-bottom: none; }
.dest-sug-item:hover, .dest-sug-item.active {
  background: var(--blue-light);
  color: var(--blue-dark);
}
