/* ===================================================================
   FDT AI — AI-Powered Dummy Ticket Assistant
   Stylesheet — Phase 1 (Premium chat UI)
=================================================================== */

/* ---------- Tokens ----------
   Distinct from the DTP design system on purpose: an "AI lab" surface
   with a two-tone emerald→violet brand gradient (Gemini-style) instead
   of a flat single green. Light is the default; dark is a full
   alternate theme, not an afterthought. */
:root,
html[data-theme="light"] {
  --bg: #F6F6FB;
  --bg-2: #FFFFFF;
  --card: #FFFFFF;
  --text: #16161F;
  --text-muted: #5B5B6B;
  --text-faint: #93939F;
  --border: #E5E5EF;
  --border-soft: #EEEEF5;
  --primary: #0EA57D;
  --primary-strong: #0B8A68;
  --accent: #7C5CFF;
  --user-bubble: linear-gradient(135deg, #0EA57D 0%, #7C5CFF 100%);
  --user-bubble-text: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, .06);
  --shadow-md: 0 8px 24px rgba(20, 20, 40, .08);
  --shadow-lg: 0 16px 48px rgba(20, 20, 40, .12);
  --sidebar-bg: #FFFFFF;
  --hover-bg: #F0F0F7;
  --scrim: rgba(15, 15, 30, .45);
  --glow-1: rgba(14, 165, 125, .14);
  --glow-2: rgba(124, 92, 255, .12);
}

html[data-theme="dark"] {
  --bg: #08080D;
  --bg-2: #0C0C13;
  --card: #131319;
  --text: #F3F3F7;
  --text-muted: #9C9CAA;
  --text-faint: #67677A;
  --border: #232330;
  --border-soft: #1A1A24;
  --primary: #22D3A6;
  --primary-strong: #17B78E;
  --accent: #8B5CF6;
  --user-bubble: linear-gradient(135deg, #1FC79B 0%, #7C5CFF 100%);
  --user-bubble-text: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  --sidebar-bg: #0A0A10;
  --hover-bg: #1B1B24;
  --scrim: rgba(0, 0, 0, .65);
  --glow-1: rgba(34, 211, 166, .22);
  --glow-2: rgba(139, 92, 246, .20);
}

:root {
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --sidebar-w: 272px;
  --topbar-h: 64px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(760px circle at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(620px circle at 102% 6%, var(--glow-2), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
  overflow: hidden;
}

button, textarea, input { font-family: inherit; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--primary); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- App shell ---------- */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 18px;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), transform .3s var(--ease);
  z-index: 40;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-mark svg { width: 15px; height: 15px; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
}
.brand-word em { color: var(--primary); font-style: normal; }

.sidebar-collapse-btn { margin-left: auto; }
.sidebar-collapse-btn svg { transition: transform .2s var(--ease); }

/* Collapsed (icon-rail) sidebar — desktop only; gated behind the same breakpoint
   as the mobile drawer query below. On mobile the same button closes the
   drawer instead (handled in JS), so "collapsed" is never toggled there. */
@media (min-width: 901px) {
  .sidebar.collapsed { width: 68px; padding-left: 10px; padding-right: 10px; }
  .sidebar.collapsed .label-text,
  .sidebar.collapsed .sidebar-section,
  .sidebar.collapsed .sidebar-bottom { display: none; }
  .sidebar.collapsed .sidebar-top { flex-direction: column; gap: 10px; }
  .sidebar.collapsed .sidebar-collapse-btn { margin-left: 0; }
  .sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
  .sidebar.collapsed .new-chat-btn,
  .sidebar.collapsed .sidebar-link { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar.collapsed .new-chat-btn svg,
  .sidebar.collapsed .sidebar-link svg { flex-shrink: 0; }
}

.new-chat-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background-color .15s;
}
.new-chat-btn:hover { border-color: var(--primary); background: var(--hover-bg); }
.new-chat-btn:active { transform: scale(.98); }
.new-chat-btn svg { width: 16px; height: 16px; stroke: var(--primary); }

.sidebar-section { flex: 1; overflow-y: auto; min-height: 0; }

.sidebar-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin: 4px 0 10px 6px;
}

.chat-history-empty {
  font-size: 13px;
  color: var(--text-faint);
  padding: 8px 6px;
  line-height: 1.5;
}

.chat-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color .15s;
}
.chat-history-item.active { font-weight: 600; }

.chat-history-item-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  transition: background-color .15s;
}
.chat-history-item-wrap:hover,
.chat-history-item-wrap:has(.chat-history-item.active) { background: var(--hover-bg); }
.chat-history-item-wrap .chat-history-item { flex: 1; min-width: 0; }

.chat-history-delete {
  opacity: .55;
  flex-shrink: 0;
  width: 26px; height: 26px;
  margin-right: 4px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-faint);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity .15s, background-color .15s, color .15s;
}
.chat-history-delete:hover { opacity: 1; background: color-mix(in srgb, #E24B4A 15%, transparent); color: #E24B4A; }
.chat-history-delete svg { width: 14px; height: 14px; }

.sidebar-links {
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-muted);
  transition: background-color .15s, color .15s;
}
.sidebar-link:hover { background: var(--hover-bg); color: var(--text); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-bottom {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-contact { display: flex; flex-direction: column; gap: 2px; }
.sidebar-contact-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background-color .15s, color .15s;
}
.sidebar-contact-link:hover { background: var(--hover-bg); color: var(--text); }
.sidebar-contact-link svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--primary); }

.sidebar-policy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  padding: 0 6px;
}
.sidebar-policy-links a {
  font-size: 11px;
  color: var(--text-faint);
  transition: color .15s;
}
.sidebar-policy-links a:hover { color: var(--primary); text-decoration: underline; }

.sidebar-tagline {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
  margin: 0;
  padding: 0 6px;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 30;
}

/* ---------- Main column ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.menu-btn { display: none; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover-bg); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.topbar-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
}
.brand-tag {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle { position: relative; }
.theme-toggle svg { position: absolute; transition: opacity .2s var(--ease), transform .3s var(--ease); }
html[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-40deg) scale(.6); }
html[data-theme="light"] .theme-toggle .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }
html[data-theme="dark"]  .theme-toggle .icon-sun   { opacity: 0; transform: rotate(40deg) scale(.6); }
html[data-theme="dark"]  .theme-toggle .icon-moon  { opacity: 1; transform: rotate(0) scale(1); }

/* ---------- Chat viewport ---------- */
.chat-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Hero / empty state */
.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 9vh 24px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 22px;
  animation: fadeUp .5s var(--ease) both;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 16px;
  animation: fadeUp .55s var(--ease) both;
  animation-delay: .05s;
}
.accent-text {
  background: linear-gradient(100deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 0 32px;
  animation: fadeUp .55s var(--ease) both;
  animation-delay: .1s;
}

/* Big centered "ask box" pill — the ChatGPT/Gemini/Grok home-prompt
   pattern, standing in for a real composer until the visitor engages. */
.start-chat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 580px;
  padding: 8px 8px 8px 26px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  color: var(--text-faint);
  font-size: 15.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
  animation: fadeUp .55s var(--ease) both;
  animation-delay: .15s;
}
.start-chat-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.start-chat-btn:active { transform: translateY(0) scale(.99); }
.start-chat-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-chat-icon {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.start-chat-btn svg { width: 17px; height: 17px; transition: transform .2s var(--ease); }
.start-chat-btn:hover svg { transform: translateX(2px); }

.suggested-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  animation: fadeUp .55s var(--ease) both;
  animation-delay: .2s;
}

.chip {
  padding: 9px 15px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.chip:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.chip:active { transform: translateY(0) scale(.97); }

/* ---------- Booking wizard (in-chat) ---------- */
.msg.ai.booking-msg .bubble-col { max-width: 420px; }
@media (max-width: 640px) {
  .msg.ai.booking-msg .bubble-col { max-width: 92%; }
}
@media (max-width: 480px) {
  /* Wrapped flex fields of uneven widths look ragged on narrow phones —
     one full-width field per line reads much cleaner. */
  .booking-row { flex-direction: column; gap: 10px; }
  .booking-field { min-width: 0; width: 100%; }
  .booking-field[style*="max-width"] { max-width: none !important; } /* title/nationality inline width hints don't apply when stacked */
  /* Many-option button rows (currency, passenger count) wrap raggedly —
     a fixed 2-column grid reads as a tidy list instead. */
  .booking-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .booking-btn { width: 100%; text-align: center; }
}

.booking-bubble.frozen .booking-btn,
.booking-bubble.frozen input,
.booking-bubble.frozen select,
.booking-bubble.frozen textarea { opacity: .55; pointer-events: none; }

.booking-q { font-weight: 600; margin: 0 0 10px; font-size: 14.5px; }
.booking-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }

.booking-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.booking-row:last-of-type { margin-bottom: 0; }
.booking-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 110px; position: relative; }
.booking-field label { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.booking-input, .booking-select, .booking-textarea {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
}
.booking-input:focus, .booking-select:focus, .booking-textarea:focus { outline: none; border-color: var(--primary); }
.booking-textarea { resize: vertical; min-height: 44px; }

.booking-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 180px;
  overflow-y: auto;
  z-index: 30;
}
.booking-suggestion-item { padding: 7px 10px; font-size: 12.5px; cursor: pointer; }
.booking-suggestion-item:hover { background: var(--hover-bg); }
.booking-suggestion-code { font-family: var(--font-mono); color: var(--primary); font-weight: 600; margin-right: 5px; }

.booking-btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.booking-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.booking-btn:hover { border-color: var(--primary); }
.booking-btn.primary { background: linear-gradient(100deg, var(--primary), var(--accent)); color: #fff; border: none; }
.booking-btn:disabled { opacity: .5; cursor: not-allowed; }

.booking-checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; margin: 10px 0 0; color: var(--text-muted); }
.booking-checkbox-row input { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.booking-checkbox-row a { color: var(--primary); font-weight: 600; }

.booking-preview .bp-block { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.booking-preview .bp-block:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.booking-preview h4 { font-size: 11.5px; font-weight: 700; margin: 0 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.booking-preview .bp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 2px 0; }
.booking-preview .bp-row span:first-child { color: var(--text-muted); }
.booking-price { font-family: var(--font-mono); font-size: 21px; font-weight: 700; margin: 10px 0 2px; }
.booking-price-note { font-size: 11px; color: var(--text-faint); margin: 0 0 6px; }

.booking-error {
  background: color-mix(in srgb, #E24B4A 10%, transparent);
  border: 1px solid color-mix(in srgb, #E24B4A 30%, transparent);
  color: #C0392B;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-top: 8px;
}
html[data-theme="dark"] .booking-error { color: #FF8A80; }

.passport-scan-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}
.passport-scan-btn:hover { border-color: var(--primary); color: var(--primary); }
.passport-scan-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.passport-scan-status {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  margin: -4px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.passport-scan-status.scanning { background: var(--hover-bg); color: var(--text-muted); }
.passport-scan-status.ok { background: #E1F5EE; color: #0F6E56; }
.passport-scan-status.warn { background: #FDF1D6; color: #92660A; }
html[data-theme="dark"] .passport-scan-status.ok { background: color-mix(in srgb, #0F6E56 30%, transparent); color: #6FDCB8; }
html[data-theme="dark"] .passport-scan-status.warn { background: color-mix(in srgb, #92660A 30%, transparent); color: #F5C568; }

/* ---------- Messages ---------- */
.messages {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.msg {
  display: flex;
  gap: 12px;
  animation: fadeUp .35s var(--ease) both;
}
.msg.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-sm);
}
.avatar svg { width: 15px; height: 15px; }
.avatar-badge {
  position: absolute;
  bottom: -4px; right: -4px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--bg);
  border-radius: 5px;
  padding: 1px 3px;
  line-height: 1.2;
}

.bubble-col { display: flex; flex-direction: column; max-width: 78%; }
.msg.user .bubble-col { align-items: flex-end; }

.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.65;
  word-wrap: break-word;
}
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 600; }
.bubble code {
  font-family: var(--font-mono);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

/* AI bubble: boarding-pass / ticket-stub styling — signature element */
.msg.ai .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  position: relative;
}
.msg.ai .bubble::before,
.msg.ai .bubble::after {
  content: "";
  position: absolute;
  left: -3px;
  width: 8px; height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  transform: translateX(-50%);
}
.msg.ai .bubble::before { top: -4px; }
.msg.ai .bubble::after { bottom: -4px; }

.msg-time {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 5px;
  padding: 0 4px;
}

/* Booking hand-off button — rendered when the AI signals a CTA_BOOK directive */
.cta-book {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, var(--primary), var(--accent));
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.cta-book:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cta-book:active { transform: translateY(0) scale(.99); }
.cta-book-text { display: block; }
.cta-book-text strong { display: block; font-size: 13.5px; font-weight: 700; }
.cta-book-text span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  opacity: .9;
  margin-top: 2px;
}
.cta-book svg { width: 17px; height: 17px; flex-shrink: 0; }

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: bounce 1.2s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -.24s; }
.typing-dots span:nth-child(2) { animation-delay: -.12s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Quick actions ---------- */
.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 20px 0;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}
.quick-actions::-webkit-scrollbar { display: none; }

.qa-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, transform .15s;
}
.qa-chip:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }

/* ---------- Composer ---------- */
.composer {
  max-width: 800px;
  width: 100%;
  margin: 12px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.attach-btn { opacity: .55; cursor: not-allowed; }
.attach-btn:hover { background: transparent; color: var(--text-muted); }

.input-wrap {
  flex: 1;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 6px;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

#chatInput {
  width: 100%;
  max-height: 160px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  padding: 9px 8px;
}
#chatInput::placeholder { color: var(--text-faint); }

.send-btn {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
}
.send-btn:hover { transform: translateY(-1px) scale(1.03); box-shadow: var(--shadow-md); }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.send-btn svg { width: 17px; height: 17px; }

.composer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 8px 0 14px;
  flex-shrink: 0;
}

/* ---------- Focus visibility ---------- */
button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(272px, 84vw);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .menu-btn { display: grid; }
  .brand-tag { display: none; }
}

@media (max-width: 640px) {
  .hero { padding: 6vh 18px 28px; }
  .hero h1 { font-size: 26px; }
  .hero-sub { font-size: 14.5px; }
  .start-chat-btn { padding: 6px 6px 6px 18px; font-size: 14.5px; }
  .start-chat-icon { width: 38px; height: 38px; }
  .bubble-col { max-width: 88%; }
  .composer { padding: 0 12px; }
  .quick-actions { padding: 8px 12px 0; }
  .messages { padding: 20px 12px 16px; }
  .composer-note { font-size: 10.5px; margin: 6px 0 max(10px, env(safe-area-inset-bottom)); }

  .booking-btn { padding: 10px 16px; min-height: 40px; }
  .booking-input, .booking-select, .booking-textarea { padding: 10px 12px; font-size: 15px; } /* 15px+ avoids iOS auto-zoom on focus */
  .passport-scan-btn { padding: 11px 12px; }
}


/* ============================================================
   ATTACHMENTS — file upload chips in the composer
   ============================================================ */
.attach-input { display: none; }

.attach-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 4px 2px;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  padding: 5px 8px 5px 6px;
  border: 1px solid var(--border, #d8dde6);
  border-radius: 10px;
  background: var(--surface-2, #f4f6fa);
  font-size: 12.5px;
  line-height: 1.2;
}

.attach-chip .attach-thumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-3, #e6eaf1);
}

.attach-chip .attach-doticon {
  width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3, #e6eaf1);
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase;
}

.attach-chip .attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-chip .attach-remove {
  border: 0; background: transparent; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px;
  color: var(--text-dim, #6b7280);
  flex: 0 0 auto;
}
.attach-chip .attach-remove:hover { color: var(--danger, #d33); }

.attach-chip.is-loading { opacity: .6; }
.attach-chip.is-error {
  border-color: var(--danger, #d33);
  color: var(--danger, #d33);
}

/* thumbnails shown on the user's own sent message */
.msg-attachments {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.msg-attachments img {
  max-width: 150px; max-height: 150px;
  border-radius: 8px; border: 1px solid var(--border, #d8dde6);
}
.msg-attachments .msg-doc {
  padding: 5px 9px; border-radius: 8px;
  background: var(--surface-2, #f4f6fa);
  border: 1px solid var(--border, #d8dde6);
  font-size: 12.5px;
}

/* ---------- Power UX / mobile polish ---------- */
.topbar-actions{display:flex;align-items:center;gap:6px;margin-left:auto}
.topbar-actions .icon-btn{font-size:20px}
.attach-btn{opacity:1!important;cursor:pointer!important;color:var(--primary)!important;background:color-mix(in srgb,var(--primary) 10%,transparent);border:1px solid color-mix(in srgb,var(--primary) 35%,var(--border));box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 7%,transparent)}
.attach-btn:hover{background:color-mix(in srgb,var(--primary) 16%,transparent)!important;color:var(--primary)!important;transform:translateY(-1px)}
.voice-btn{font-size:17px;flex:0 0 auto}.voice-btn.recording{color:#e24b4a;background:color-mix(in srgb,#e24b4a 12%,transparent);animation:pulse-rec 1s infinite}
@keyframes pulse-rec{50%{box-shadow:0 0 0 5px color-mix(in srgb,#e24b4a 10%,transparent)}}
.composer-tools{font-size:10px;color:var(--text-faint);text-align:right;padding:0 4px 2px;pointer-events:none}
.message-actions{display:flex;gap:6px;margin-top:5px}.message-actions button{border:1px solid var(--border);background:var(--card);color:var(--text-muted);border-radius:7px;padding:4px 8px;font-size:11px;cursor:pointer}.message-actions button:hover{color:var(--text);border-color:var(--primary)}
.bubble a{color:var(--primary);text-decoration:underline;text-underline-offset:2px}.bubble ul{margin:7px 0;padding-left:20px}.bubble h2,.bubble h3,.bubble h4{margin:4px 0 8px}.bubble code{padding:2px 5px;border-radius:5px;background:var(--surface-2);font-family:var(--mono)}.numbered-line{margin:3px 0}.message-reveal{animation:message-in .18s ease-out}@keyframes message-in{from{opacity:.25;transform:translateY(2px)}to{opacity:1;transform:none}}
body.file-dragging:after{content:'Drop files to attach';position:fixed;inset:14px;border:2px dashed var(--primary);border-radius:18px;background:color-mix(in srgb,var(--primary) 7%,transparent);display:grid;place-items:center;z-index:9999;pointer-events:none;font-weight:700;color:var(--primary);font-size:18px}
@media(max-width:640px){.topbar-actions .icon-btn{width:34px;height:34px}.composer{gap:5px}.attach-btn,.voice-btn,.send-btn{width:42px;height:42px;min-width:42px}.input-wrap{min-width:0}.bubble-col{max-width:92%}.message-actions{opacity:1}.quick-actions{overflow-x:auto;flex-wrap:nowrap;justify-content:flex-start}.qa-chip{flex:0 0 auto}.topbar{padding-left:10px;padding-right:10px}.topbar-brand .brand-name{font-size:15px}}
