/* TravelBot chat — mobile first.
   Base rules are the phone layout. Wider screens add to them:
     ≥ 761px  sidebar docked on the left (the ☰ menu goes away)
     ≥ 1101px option panel docked on the right (below that it slides over the chat)
   Form controls stay at 16px on phones — anything smaller makes iOS zoom in on focus. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --side: #efefec;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #0b4f9c;
  --accent-soft: #e8f0fb;
  --green: #2e7d32;
  --green-soft: #e8f5e9;
  --red: #c62828;
  --red-soft: #fdecea;
  --amber: #b45309;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --radius: 10px;
  --tap: 44px;                                   /* smallest comfortable touch target */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e; --surface: #262629; --surface-2: #2f2f33; --side: #19191b;
    --text: #ececee; --muted: #a1a1aa; --line: #3a3a3f;
    --accent: #6ea8ff; --accent-soft: #1e2a3d;
    --green: #6fcf7a; --green-soft: #1d2e20; --red: #ff7a70; --red-soft: #3a2220; --amber: #f0b35a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
       -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.4em; margin: 8px 0 0; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 15px; }
.brand-lg { font-size: 22px; justify-content: center; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px; min-height: var(--tap); cursor: pointer; touch-action: manipulation; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 4px 0; min-height: 0; }
.ico { width: 1.2em; height: 1.2em; flex: 0 0 auto; vertical-align: -0.2em; }
.icon-btn .ico, .send .ico { width: 20px; height: 20px; vertical-align: middle; }
.msg-actions .icon-btn .ico { width: 16px; height: 16px; }
.chip.more { color: var(--muted); }
.icon-btn { display: inline-grid; place-items: center; color: inherit; border: 0; background: none; width: var(--tap); height: var(--tap); border-radius: 10px; cursor: pointer; font-size: 18px; touch-action: manipulation; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; min-height: 38px; cursor: pointer; font-size: 14px; white-space: nowrap; touch-action: manipulation; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (hover: hover) {
  .btn:hover { background: var(--surface-2); }
  .btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
  .btn.link:hover { color: var(--text); background: none; }
  .icon-btn:hover { background: var(--surface-2); }
  .chip:hover { border-color: var(--accent); color: var(--accent); }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Sign-in ---- */
.login { min-height: 100%; display: grid; place-items: center; padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px 20px; box-shadow: var(--shadow); text-align: center; }
.stack { display: grid; gap: 10px; text-align: left; margin-top: 18px; }
.stack input { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.stack input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---- Layout (phone) ---- */
.app { display: flex; height: 100%; height: 100dvh; overflow: hidden; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); z-index: 25; }

/* The sidebar is a drawer on phones. */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: min(300px, 86vw);
           transform: translateX(-100%); transition: transform .2s ease;
           background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column;
           padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom)); }
.sidebar.open { transform: none; box-shadow: 8px 0 24px rgba(0, 0, 0, .2); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.new-chat { text-align: left; font-weight: 600; }
.side-label { font-size: 12px; color: var(--muted); margin: 16px 6px 6px; }
/* Grid rows do not shrink below their content by default — long titles pushed ✕ off-screen and gave the
   sidebar a sideways scrollbar. min-width: 0 lets the title ellipsis instead. */
.conv-list { flex: 1; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 2px; }
.conv { display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 10px; min-height: var(--tap); border-radius: 9px; cursor: pointer; font-size: 15px; min-width: 0; }
.conv.active { background: var(--surface); }
.conv .t { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Touch screens have no hover, so the delete button is always shown there. */
.conv .del { flex: 0 0 auto; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.sidebar-bottom .saved { flex: 1 0 100%; }
.me { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 4px; padding: calc(4px + var(--safe-top)) 8px 4px; border-bottom: 1px solid var(--line); background: var(--bg); }
.conv-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.top-actions select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px; max-width: 110px; }
.only-mobile { display: inline-grid; place-items: center; }

.scroller { flex: 1; overflow-y: auto; position: relative; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.messages { max-width: 820px; margin: 0 auto; padding: 16px 12px 8px; display: grid; gap: 18px; }
.empty { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 24px 16px; }
.empty h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.hello-sub { margin: 0 0 18px; color: var(--muted); }
#hotelExamples { margin-top: 8px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.empty .suggestions .chip { white-space: normal; text-align: center; }

/* ---- Messages ---- */
.msg.user { justify-self: end; max-width: 88%; background: var(--surface-2); border-radius: 12px 12px 3px 12px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.msg.bot .avatar { display: none; }           /* every pixel of width goes to the cards on a phone */
.avatar { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.bot-body { min-width: 0; }
.bot-text { overflow-wrap: anywhere; }
.bot-text p { margin: 0 0 8px; }
.bot-text table { display: block; overflow-x: auto; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.bot-text th, .bot-text td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.note { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.note-flag { margin: 6px 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); font-weight: 600; }
.bot-text th { background: var(--surface-2); font-weight: 600; }
.bot-text th, .bot-text td { min-width: 96px; }
.bot-text td:nth-child(2) { white-space: nowrap; }
.msg-actions { display: flex; gap: 2px; margin-top: 6px; }
.msg-actions .icon-btn { width: 38px; height: 38px; font-size: 15px; color: var(--muted); }
.msg-actions .icon-btn.on { color: var(--accent); background: var(--accent-soft); }

/* Chip rows swipe sideways on a phone instead of stacking into many lines. */
.quick, .suggest-bar { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none;
                       -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding-bottom: 2px; }
.quick::-webkit-scrollbar, .suggest-bar::-webkit-scrollbar { display: none; }
.quick { margin-top: 12px; }
.quick .chip, .suggest-bar .chip { flex: 0 0 auto; }
.suggest-bar { margin: 0 auto 6px; max-width: 760px; }
/* The three shortcuts above the message box: Search flights, My upcoming trips, My past trips. */
.trip-bar { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 auto 8px; max-width: 760px; }
.trip-bar::-webkit-scrollbar { display: none; }
.trip-bar .chip.trip { flex: 0 0 auto; border-color: var(--accent); color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 14px; min-height: 36px; }
.trip-bar .chip.trip:hover { background: var(--accent); color: #fff; }
.suggest-bar .chip { font-size: 14px; padding: 6px 12px; min-height: 36px; }
.suggest-bar .chip.first { border-color: var(--accent); color: var(--accent); }
.suggest-bar .hint { display: none; font-size: 11px; color: var(--muted); align-self: center; white-space: nowrap; }

.approve-form { display: grid; gap: 6px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
.approve-form input { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface); color: var(--text); }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
.hotels-head { margin-top: 14px; }
.card.hotel .hotel-row { display: flex; gap: 10px; align-items: flex-start; }
.card.hotel .hotel-img { width: 80px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.card.hotel .hotel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card.hotel .hotel-main b { font-size: 15px; }
.card.hotel .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.hotel .stars { color: #d4a017; font-size: 12px; }
.card.hotel .price { text-align: right; white-space: nowrap; }
.panel-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.my-routes { margin-bottom: 18px; }
.my-routes .side-label { text-align: center; margin-bottom: 8px; }
.chip.mine { border-color: var(--accent); }
.preview { margin: 0 auto 6px; max-width: 760px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.watch-box { margin-top: 10px; }
.watch-list { display: flex; flex-direction: column; gap: 4px; max-height: 32vh; overflow-y: auto; }
.watch { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.watch .w-main { flex: 1; min-width: 0; }
.watch .w-route { font-weight: 600; }
.watch .w-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch .w-price .down { color: #1a7f37; font-weight: 600; }
.watch .w-price .up { color: #b42318; }
.watch.ended { opacity: .6; }
.watch .del { border: 0; background: none; cursor: pointer; color: var(--muted); min-width: 32px; min-height: 32px; }
.saved { font-size: 12px; color: var(--muted); margin-bottom: 6px; line-height: 1.4; }
.watch-note { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.watch-note.bad { color: #b42318; }
.ask { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--accent); font-size: 14px; }
.chip.copy { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.copy-box { width: 100%; min-height: 160px; margin-top: 8px; font: 12px/1.5 Consolas, "Courier New", monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); color: var(--text); }

.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---- Option cards ---- */
.cards { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: border-color .15s; touch-action: manipulation; }
.card:active { border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; background: #fff; flex: 0 0 30px; }
.badge-code { width: 30px; height: 30px; border-radius: 15px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: 0 0 30px; }
.card-air { flex: 1; min-width: 0; }
.card-air b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.label { font-size: 12px; color: var(--accent); }
.price { text-align: right; white-space: nowrap; }
.price b { font-size: 18px; }
.price small { display: block; color: var(--muted); font-size: 11px; }
.legs { display: grid; gap: 8px; margin: 10px 0 8px; }
.leg { display: grid; grid-template-columns: 1fr 72px 1fr; align-items: center; gap: 6px; font-size: 13px; }
.leg .dir { display: none; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.leg .t { font-size: 16px; font-weight: 700; }
.leg .t span { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.leg .mid { text-align: center; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 3px; }
.leg .end { text-align: right; }
.leg .mid .lay { color: var(--amber); font-weight: 600; }
.leg .d { font-size: 11px; color: var(--muted); }
.leg .end .d { text-align: right; }
.plus { color: var(--amber); font-size: 10px; font-weight: 700; margin-left: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; border-radius: 5px; padding: 2px 8px; background: var(--surface-2); color: var(--muted); }
.tag.good { background: var(--green-soft); color: var(--green); font-weight: 600; }
.tag.bad { background: var(--red-soft); color: var(--red); font-weight: 600; }
.tag.warn { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); font-weight: 600; }
.warn { color: var(--amber); font-weight: 700; }
.tag.source { background: var(--accent-soft); color: var(--accent); }
.trip { font-weight: 600; margin-bottom: 4px; }

/* ---- Composer ---- */
.composer { padding: 6px 8px calc(8px + var(--safe-bottom)); background: var(--bg); }
.composer-box { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px 8px 6px 12px; }
.composer-box:focus-within { border-color: var(--accent); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; max-height: 140px; padding: 4px 0; }
.composer-row { display: flex; align-items: center; gap: 4px; }
.spacer { flex: 1; }
.listening { color: var(--red); font-size: 13px; font-weight: 600; }
.mic.on { background: var(--red-soft); color: var(--red); }
.send { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 10px; border: 0; background: var(--accent); color: #fff; cursor: pointer; font-size: 16px; touch-action: manipulation; }
.send:disabled { opacity: .45; cursor: default; }
/* Attachments: chips above the text while composing, and under the user's message once sent */
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 10px; border-radius: 8px;
             background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.file-chip .fn { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 180px; }
.file-chip button { border: 0; background: none; color: inherit; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.file-chip.sent { padding: 3px 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; white-space: normal; }
.composer.drop .composer-box { border-color: var(--accent); border-style: dashed; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); z-index: 60; max-width: 90vw;
         background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }
.fineprint { display: none; max-width: 820px; margin: 6px auto 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---- Option panel: a full-screen sheet on a phone ---- */
.panel { position: fixed; inset: 0; z-index: 40; background: var(--surface); display: flex; flex-direction: column;
         padding-top: var(--safe-top); animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.panel-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
              padding: 14px 14px 0; display: grid; gap: 14px; align-content: start; }
.p-price { font-size: 24px; font-weight: 700; }
.p-sec { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.seg { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.seg-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.seg-top .sub { color: var(--muted); font-size: 12px; }
.seg-times { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.seg-times .b { font-size: 18px; font-weight: 700; }
.seg-times .s { font-size: 12px; color: var(--muted); }
.seg-times .dur { text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; }
.seg-times .end { text-align: right; }
.layover { font-size: 12px; color: var(--amber); padding-left: 4px; }
.kv { display: grid; grid-template-columns: 108px minmax(0, 1fr); border-top: 1px solid var(--line); }
.kv > div { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); padding-right: 8px; }
.alert { color: var(--red); font-weight: 700; }
.ok { color: var(--green); font-weight: 700; }
.fares { width: 100%; border-collapse: collapse; font-size: 12px; }
.fares th, .fares td { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: left; vertical-align: top; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-body::after { content: ""; display: block; height: 4px; }      /* air above the footer */
/* The panel's action row lives in a footer under the details (dockActions in chat.js): always one thumb away,
   main action (Select / Book) first, the rest swiped sideways on a phone. */
.panel-foot { flex: 0 0 auto; max-height: 45vh; overflow-y: auto; background: var(--surface); border-top: 1px solid var(--line);
              padding: 10px 14px calc(10px + var(--safe-bottom)); }
.panel-foot > .panel-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.panel-foot > .panel-actions::-webkit-scrollbar { display: none; }
.panel-foot > .panel-actions .btn { flex: 0 0 auto; }
.panel-foot > .panel-actions .btn.primary { order: -1; }

/* Fare families */
.fam-list { display: grid; gap: 8px; }
.fam { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 13px; }
.fam.current { border-color: var(--green); background: var(--green-soft); }
.fam-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fam-price { white-space: nowrap; font-weight: 700; }
.fam-price small { font-weight: 600; margin-left: 4px; }
.fam-price small.up { color: var(--amber); }
.fam-price small.down { color: var(--green); }
.fam-choose { justify-self: start; margin-top: 4px; padding: 8px 14px; font-size: 14px; }

/* Booking form (phase 2) */
.notice { border-radius: 10px; padding: 9px 12px; font-size: 13px; background: var(--accent-soft); color: var(--accent); }
.notice.bad { background: var(--red-soft); color: var(--red); font-weight: 600; }
.notice.good { background: var(--green-soft); color: var(--green); font-weight: 600; }
.book-form { display: grid; gap: 12px; }
.trav { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; }
.trav legend { font-size: 12px; font-weight: 700; color: var(--accent); padding: 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 8px 10px; }
.grid2 label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.grid2 .span2 { grid-column: 1 / -1; }
.grid2 input, .grid2 select { padding: 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.review { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }

@media (hover: hover) {
  .card:hover { border-color: var(--accent); }
  .conv:hover { background: var(--surface); }
  .conv .del { opacity: .35; }
  .conv:hover .del, .conv .del:focus-visible { opacity: 1; }
  .conv .del:hover { color: #b42318; background: var(--surface-2); }
  .watch:hover { background: var(--surface-2); }
  .suggest-bar .hint { display: inline; }      /* "Tab to accept" only means something with a keyboard */
}
@media (prefers-reduced-motion: reduce) {
  .panel, .sidebar { animation: none; transition: none; }
}

/* ---- Tablet and up: sidebar docked ---- */
@media (min-width: 761px) {
  body { overscroll-behavior: auto; }
  .only-mobile { display: none; }
  .sidebar { position: static; transform: none; transition: none; width: 264px; flex: 0 0 264px; padding: 14px 12px; }
  .sidebar.open { box-shadow: none; }
  .conv { font-size: 14px; min-height: 0; padding: 8px 10px; }
  .conv .del { width: auto; height: auto; padding: 2px 4px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .top-actions select { font-size: 13px; padding: 4px 6px; max-width: none; }
  .icon-btn { width: 36px; height: 36px; font-size: 17px; }
  .btn { min-height: 0; padding: 9px 14px; }
  .chip { padding: 6px 12px; min-height: 0; font-size: 13px; }
  .quick, .suggest-bar { flex-wrap: wrap; overflow: visible; }
  .suggest-bar .chip { font-size: 12.5px; padding: 4px 10px; min-height: 0; }
  .messages { padding: 24px 16px 8px; gap: 22px; }
  .empty h1 { font-size: 28px; margin-bottom: 18px; }
  .msg.user { max-width: 80%; }
  .msg.bot { grid-template-columns: 30px minmax(0, 1fr); }
  .msg.bot .avatar { display: grid; }
  .card { padding: 12px 14px; }
  .leg { grid-template-columns: 64px 1fr 110px 1fr; gap: 8px; }
  .leg .dir { display: block; }
  .composer { padding: 8px 16px 12px; }
  .composer-box { padding: 10px 12px 8px; }
  .composer textarea { font-size: 15px; max-height: 180px; }
  .send { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
  .fineprint { display: block; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid2 input, .grid2 select { font-size: 13px; padding: 7px 8px; }
  .approve-form input { font-size: 14px; padding: 8px 10px; }
  .kv { grid-template-columns: 130px minmax(0, 1fr); }

  /* Between tablet and desktop the panel slides over the chat from the right. */
  .panel { inset: 0 0 0 auto; width: min(440px, 100%); border-left: 1px solid var(--line);
           box-shadow: -8px 0 24px rgba(0, 0, 0, .18); padding-top: 0; animation: none; }
  .panel-head { padding: 12px 14px; }
  .panel-foot { padding: 12px 14px; }
  .panel-foot > .panel-actions { flex-wrap: wrap; overflow: visible; }
}

/* ---- Desktop: panel docked beside the chat ---- */
@media (min-width: 1101px) {
  .panel { position: static; width: 440px; flex: 0 0 440px; box-shadow: none; }
  .backdrop { display: none; }
}

/* Fare per traveller type (adult / child / infant) in the option panel */
.pax { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12px; }
.pax td { padding: 3px 8px 3px 0; vertical-align: top; }
.pax td.num { text-align: right; padding-right: 0; white-space: nowrap; }
.pax .pax-total td { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 600; }

/* Choose options to copy: toggles per option, then Copy selected */
.copy-pick { box-sizing: border-box; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.copy-pick .pick { min-width: 44px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit; font-size: 14px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.copy-pick .pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-pick .btn[disabled] { opacity: .5; cursor: default; }
.copy-pick .icon-btn { margin-left: auto; }

/* Travel notes in the option panel: change of airport, long layover, mixed cabin, coach, separate tickets */
.notes { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius); background: #fff4e5; color: #9a3412; font-size: 13px; line-height: 1.45; }
.notes > div + div { margin-top: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notes { background: #3b2410; color: #fdba74; } }
:root[data-theme="dark"] .notes { background: #3b2410; color: #fdba74; }

/* Test mode: suppliers' UAT / sandbox systems (TripProcessor.TestMode). */
.test-banner { background: #fef3c7; border-bottom: 1px solid #f59e0b; color: #92400e; padding: 8px 16px; font-size: 13px; line-height: 1.4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .test-banner { background: #3b2410; color: #fdba74; border-color: #b45309; } }
:root[data-theme="dark"] .test-banner { background: #3b2410; color: #fdba74; border-color: #b45309; }

/* Sign-in over the chat (guest → code only when booking / selecting / approval / watch). */
.login.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.45); }

/* Booking form: section labels inside a traveller (Passport, Frequent flyer). */
.book-form .sub-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); margin-top: 6px; }

/* Sign-in box: ✕ in the corner, resend / other email side by side, a clear Cancel. */
.login-card { position: relative; }
.login-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.login-x:hover, .login-x:focus-visible { background: var(--line); color: var(--text); }
.code-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.code-links .btn.link:disabled { opacity: .6; cursor: default; }
.login-info { min-height: 0; margin: 4px 0 0; font-size: 13px; }
#loginClose { width: 100%; margin-top: 8px; }

/* Pay before booking: the payment link box under the review. */
.pay-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.pay-box .panel-actions a.btn { text-decoration: none; }
/* Seats and meals (Flamingo; branch feature/seats-meals): one block per flight, a compact seat map that scrolls sideways on a phone */
.extras { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.xleg { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.xleg-h { font-weight: 600; }
.xrow { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13.5px; }
.xrow select { flex: 1 1 200px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; font-size: 16px; }
.xwho { display: inline-flex; gap: 4px; align-items: center; }
.seatmap { display: grid; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.srow { display: flex; gap: 4px; align-items: center; }
.srow .rn { width: 22px; flex: none; color: var(--muted); font-size: 11px; text-align: right; }
.seat { flex: none; width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: inherit; font-size: 11px; cursor: pointer; padding: 0; touch-action: manipulation; }
.seat.paid { border-color: #c98a00; }
.seat.taken { background: var(--line); color: var(--muted); cursor: not-allowed; text-decoration: line-through; }
.seat.mine { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.xkey .seat { display: inline-block; width: 14px; height: 12px; vertical-align: middle; cursor: default; }
.xsum { font-size: 14px; }
.pay-mail { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-mail input { flex: 1 1 200px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }

/* My bookings (Services\BookingStore) */
.my-bookings { margin-top: 6px; }
.booking-list { display: flex; flex-direction: column; gap: 8px; }
.booking-item { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: inherit;
  border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; }
.booking-item:hover { border-color: var(--accent); }
.b-ref { font-weight: 700; letter-spacing: .03em; }
.b-status, .b-status-big { font-weight: 600; color: var(--muted); }
.b-status-big { font-size: 1.05rem; margin: 6px 0; }
.s-ticketed, .s-confirmed { color: #127a4b; }
.s-failed, .s-refunded, .s-cancelled { color: #b3261e; }
.s-desk, .s-awaiting-payment, .s-paid, .s-held { color: #8a5a00; }
table.bk-table { display: table; width: 100%; table-layout: fixed; border-collapse: collapse; margin: 4px 0 10px; font-size: .93rem; }
table.bk-table td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.bk-table td:first-child { color: var(--muted); width: 38%; padding-right: 12px; overflow-wrap: normal; }
table.bk-timeline td:first-child { width: 112px; white-space: nowrap; }
pre.log { white-space: pre-wrap; font-size: .78rem; max-height: 260px; overflow: auto; }

.chip.cross-sell { border-color: #127a4b; color: #127a4b; font-weight: 600; }

/* Traveller profiles (Services\ProfileStore) */
.use-profile { display: grid; gap: 3px; font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.use-profile select { font-weight: 400; }
.scan-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 2px 0 10px; }
.scan-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; background: none; }
.scan-note { font-size: 12px; }
.profile-item { cursor: default; }
.profile-item .panel-actions { margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
/* Account menu (the email at the bottom of the sidebar) */
.account { position: relative; flex: 1; min-width: 0; }
.account-btn { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); background: var(--surface); color: inherit;
  border-radius: 12px; padding: 8px 10px; cursor: pointer; font: inherit; min-height: var(--tap); text-align: left; }
.account-btn:hover { border-color: var(--accent); }
.account-btn .me { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-avatar { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.caret { color: var(--muted); font-size: 11px; }
.account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 6px; display: grid; gap: 2px; z-index: 40; }
.account-menu button, .account-menu a { display: block; width: 100%; text-align: left; border: 0; background: none; color: inherit; font: inherit;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 40px; }
.account-menu button:hover, .account-menu a:hover { background: var(--accent-soft); }
.account-menu .danger { color: #d93025; }
.account-menu .hidden { display: none; }

/* My bookings tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.tab { border: 0; background: none; color: var(--muted); font: inherit; padding: 10px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.empty-box { border: 1px solid var(--line); border-radius: 12px; padding: 22px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; }
/* Answers to questions asked from the details panel (the panel stays open) */
.panel-answers { margin-top: 14px; display: grid; gap: 10px; }
.panel-qa { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--accent-soft); }
.panel-qa .q { font-weight: 600; margin-bottom: 4px; }
/* Hotel booking: room choice */
.room-list { display: grid; gap: 8px; margin-bottom: 12px; }
.room-opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: 13px; }
.room-opt:has(input:checked), .room-opt.on { border-color: var(--accent); background: var(--accent-soft); }
/* Rooms listed in the chat under the hotel card (chat.js showRooms) */
.rooms-inline { border-left: 2px solid var(--accent); padding: 2px 0 2px 12px; display: grid; gap: 8px; }
/* The flight the request named ("As requested") against alternatives at other times. */
.card.asked { border-color: var(--green); border-left-width: 4px; }
.card.asked .card-air .label { color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.card.alt { border-style: dashed; }
.card.alt .card-air .label { color: var(--amber); font-weight: 600; }
/* A flight's details under its card (the side panel is for booking). */
.opt-inline { border-left: 2px solid var(--accent); padding: 2px 0 6px 12px; display: grid; gap: 10px; min-width: 0; }
.opt-inline .p-price { font-size: 20px; }
.opt-inline .rooms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card.open { border-color: var(--accent); }
.fam-row.lay { color: var(--amber); font-weight: 600; }
.rooms-inline .rooms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rooms-inline .room-list { margin-bottom: 0; }
.rooms-inline .room-opt { grid-template-columns: 1fr auto; width: 100%; text-align: left; background: var(--surface); color: inherit; font: inherit; font-size: 13px; border-radius: var(--radius); }
.book-form label.special { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.book-form label.special textarea { width: 100%; padding: 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
.btn.danger { color: var(--red); border-color: var(--red); }
.room-pick { display: inline-block; margin-top: 4px; color: var(--accent); font-weight: 600; }
.room-price { text-align: right; white-space: nowrap; }.fam { cursor: pointer; }
@media (hover: hover) { .fam:hover { border-color: var(--accent); } }

/* CA-3 (2026-10-06) — automated-assistant notice on the chat start screen.
   Quiet by design: it must be readable without competing with the prompt. */
.ai-notice {
  max-width: 44rem;
  margin: 0 auto 1.1rem;
  padding: .6rem .85rem;
  font-size: .78rem;
  line-height: 1.5;
  color: #5b6472;
  background: #f6f8fa;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  text-align: left;
}
@media (prefers-color-scheme: dark) {
  .ai-notice { color: #a9b2c0; background: #111823; border-color: #1e2634; }
}

/* Wave 1: fares side by side (fareGrid) */
.fare-grid { overflow-x: auto; margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 12px; }
.fare-grid table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: 13px; }
.fare-grid th, .fare-grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.fare-grid th { text-align: left; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--panel, transparent); }
.fare-grid td.cur { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.fare-grid .fg-head td b { display: block; font-size: 13px; }
.fare-grid .fg-price { font-weight: 700; font-size: 15px; margin: 2px 0; }
.fare-grid .y { color: #127a4b; } .fare-grid .w { color: #8a5a00; } .fare-grid .x { color: #b3261e; }
.fare-grid .fg-act td { border-bottom: 0; }
.fare-grid .fg-act .btn { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.fam-details { margin: 4px 0 10px; } .fam-details summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 6px; }

/* Wave 1: where you are in booking (stepper) */
.stepper { display: flex; gap: 4px; margin: 0 0 12px; font-size: 11.5px; }
.stepper span { flex: 1; text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--line); color: var(--muted); font-weight: 600; }
.stepper span.on { background: var(--accent); color: #fff; } .stepper span.done { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); }

/* Wave 1: Refine sheet */
.refine .rf-group { margin: 0 0 14px; }
.refine .rf-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.refine .rf-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.refine .rf-opts label { cursor: pointer; }
.refine .rf-opts input { position: absolute; opacity: 0; pointer-events: none; }
.refine .rf-opts span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 18px; font-size: 13px; }
.refine .rf-opts input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.refine .rf-opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Wave 1: Arabic — right-to-left (i18n.js sets <html dir="rtl">) */
.lang-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 10px; padding: 6px 10px; font: inherit; font-weight: 700; cursor: pointer; min-height: 36px; }
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, sans-serif; }
[dir="rtl"] .stack, [dir="rtl"] .new-chat, [dir="rtl"] .booking-item, [dir="rtl"] .account-menu button, [dir="rtl"] .account-menu a,
[dir="rtl"] .bot-text th, [dir="rtl"] .bot-text td, [dir="rtl"] .fares th, [dir="rtl"] .fares td, [dir="rtl"] .fare-grid th,
[dir="rtl"] .rooms-inline .room-opt { text-align: right; }
[dir="rtl"] .price, [dir="rtl"] .card.hotel .price, [dir="rtl"] .leg .end, [dir="rtl"] .leg .end .d, [dir="rtl"] .seg-times .end,
[dir="rtl"] .room-price, [dir="rtl"] .pax td.num { text-align: left; }
@media (max-width: 760px) { [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); border-right: 0; border-left: 1px solid var(--line); } [dir="rtl"] .sidebar.open { transform: none; } }
@media (min-width: 761px) { [dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); } [dir="rtl"] .panel { inset: 0 auto 0 0; border-left: 0; border-right: 1px solid var(--line); box-shadow: 8px 0 24px rgba(0, 0, 0, .18); } }
[dir="rtl"] .login-x { right: auto; left: 10px; }
[dir="rtl"] .copy-pick .icon-btn { margin-left: 0; margin-right: auto; }
[dir="rtl"] .rooms-inline, [dir="rtl"] .opt-inline { border-left: 0; border-right: 2px solid var(--accent); padding: 2px 12px 6px 0; }
[dir="rtl"] .card.asked { border-left-width: 1px; border-right-width: 4px; }
[dir="rtl"] .kv > div:nth-child(odd) { padding-right: 0; padding-left: 8px; }
[dir="rtl"] table.bk-table td:first-child { padding-right: 0; padding-left: 12px; }
[dir="rtl"] .layover { padding-left: 0; padding-right: 4px; }
/* flight numbers, times, codes and prices read left to right inside Arabic text */
[dir="rtl"] .leg .t, [dir="rtl"] .p-price, [dir="rtl"] .fg-price, [dir="rtl"] .fam-price, [dir="rtl"] input[type="tel"], [dir="rtl"] input[type="email"] { direction: ltr; unicode-bidi: isolate; }
