/* =========================================================
   emcp.css - SkyMonde AI Travel Assistant styles
   ========================================================= */

/* =========================================================
   Theme tokens (SkyMonde brand)
   ========================================================= */
:root{
  /* Brand palette */
  --brand: #1876dc;
  --brand-hover: #2c86e8;
  --brand-active: #1568c1;
  --brand-dark: #1771d4;
  --accent: #df4477;
  --accent-hover: #c03060;

  /* Shell (header/footer areas) */
  --header-bg: #1876dc;
  --footer-bg: #1a232b;
  --bg: #f0f3f5;
  --text: #1a232b;
  --text-secondary: #3a424a;
  --text-tertiary: #555f6d;
  --muted: #8a96a3;
  --line: #e9ecef;

  /* Buttons */
  --btn: #1876dc;
  --btn-hover: #2c86e8;
  --ok: #23955c;
  --err: #dc5338;

  /* Surfaces */
  --shadow: 0 0 2px 0 #1a232b0a, 0 1px 3px 0 #1a232b1f;
  --shadow-lg: 0 0 2px 0 #1a232b0a, 0 8px 16px 0 #1a232b1f;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 1000px;
  --focus-ring: 2px solid rgba(24,118,220,.5);
  --surface-1: rgba(5,54,87,.06);
  --surface-2: rgba(11,43,76,.09);
  --surface-3: rgba(1,40,70,.13);
  --menu-bg: #fff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Light/card areas */
  --lt-bg: #fff;
  --lt-bg-subtle: #f5f7f9;
  --lt-bg-code: #f0f3f5;
  --lt-text: #1a232b;
  --lt-text-heading: #1a232b;
  --lt-text-muted: #555f6d;
  --lt-line: #e9ecef;
  --lt-line-dark: #dee3e7;
  --lt-link: #1771d4;
  --lt-link-hover: #1568c1;
}

/* =========================================================
   Base
   ========================================================= */
*{ box-sizing:border-box; }
.hidden{ display:none !important; }

body{
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color:var(--text);
  background: var(--bg);
  min-height:100vh;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:flex-start;
  padding:0;
}

.wrap{
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

#appBlurWrap{
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
}

#appBlurWrap > main{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* =========================================================
   Locked / blur
   ========================================================= */
body.auth-locked #appBlurWrap,
body.modal-open #appBlurWrap{
  filter: blur(5px);
  opacity: 0.70;
  transform: translateZ(0);
  pointer-events: none;
  user-select: none;
}

#topChrome{
  position: relative;
  z-index: 120;
  pointer-events: auto;
  filter: none;
  opacity: 1;
}
#topChrome #acctMenu{ position: absolute; z-index: 130; }

/* SkyMonde logo mark (CSS-only) */
.app-topbar .title::before{
  content: "";
  display: inline-block;
  width: 28px; height: 28px;
  margin-right: 10px;
  vertical-align: middle;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.5);
  flex-shrink: 0;
}

/* =========================================================
   Typography
   ========================================================= */
.title{
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
}
.subtitle{
  margin: 2px 0 0;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 400;
}

/* =========================================================
   Topbar (SkyMonde blue header)
   ========================================================= */
.app-topbar{
  position: sticky;
  top: 0;
  z-index: 120;
  margin: 0;
  padding: 0;
  background: var(--header-bg);
  border: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.app-topbar .topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 20px;
}
.app-topbar .title{
  color: #fff;
  text-shadow: none;
  overflow-wrap:anywhere;
}
.app-topbar .subtitle{
  text-shadow: none;
  overflow-wrap:anywhere;
}
.app-topbar #appChrome{ flex: 1 1 auto; min-width: 0; }
.app-topbar #topChrome{ flex: 0 0 auto; }
.topbar{ display:flex; justify-content:flex-end; position:relative; }

/* =========================================================
   Card
   ========================================================= */
.card{
  background: var(--lt-bg);
  border:1px solid var(--lt-line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card-inner{
  padding: 24px;
  color: var(--lt-text);
}
.card .title{
  color: var(--lt-text-heading);
  font-size: 24px;
  font-weight: 700;
}
.card .title::before{ display: none; }
.card .subtitle{ color: var(--lt-text-muted); font-size: 14px; line-height: 1.5; }
.card a:not(.btn){ color: var(--lt-link); }
.card a:not(.btn):hover{ color: var(--lt-link-hover); }

/* =========================================================
   Buttons + spinner
   ========================================================= */
.btn{
  border:0;
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor:pointer;
  color:white;
  background: var(--btn);
  min-width: 140px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  box-shadow: none;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover{
  background: var(--btn-hover);
}
.btn:active{ background: var(--brand-active); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn.secondary{
  background: #fff;
  border:1px solid var(--lt-line-dark);
  color: var(--lt-text);
  box-shadow:none;
  min-width:auto;
  padding:10px 20px;
  border-radius: var(--radius-pill);
}
.btn.secondary:hover{
  background: var(--lt-bg-subtle);
  border-color: var(--muted);
}
.btn.secondary:disabled{ opacity:.45; cursor:not-allowed; }

.spinner{
  width:16px; height:16px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.3);
  border-top-color: rgba(255,255,255,.9);
  animation: spin .8s linear infinite;
  display:none;
}
.btn.loading .spinner{ display:inline-block; }
.btn.secondary .spinner{
  border-color: rgba(0,0,0,.15);
  border-top-color: rgba(0,0,0,.6);
}
@keyframes spin{ to{ transform:rotate(360deg);} }

.link-btn{
  background: transparent;
  border: none;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  min-width: auto;
  box-shadow: none;
}
.link-btn:hover{ text-decoration: underline; color: var(--brand-active); }
.link-btn:disabled{ color: var(--muted); cursor: not-allowed; opacity: 0.6; }

/* =========================================================
   Account button + menu
   ========================================================= */
.acctBtn{
  border:1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 999px;
  padding: 6px 8px;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  box-shadow:none;
  transition: background .15s;
}
.acctBtn:hover{ background: rgba(255,255,255,.22); }
.acctBtn:focus-visible{ outline: 2px solid rgba(255,255,255,.6); outline-offset:2px; }

.acctAvatar{
  width:32px; height:32px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.15);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  font-weight: 700;
  letter-spacing: .2px;
  color: #fff;
}
.acctAvatar--icon{ font-size: 16px; line-height: 1; }
.acctAvatar--initial{ background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.3); color: #fff; font-size: 13px; }
.acctAvatar img{ width:100%; height:100%; object-fit:cover; display:block; }

.acctBurger{
  width:16px; height:12px;
  display:inline-block;
  position:relative;
  opacity:.9;
}
.acctBurger::before{
  content:"";
  position:absolute;
  left:0; right:0; top:1px;
  height:2px;
  background: rgba(255,255,255,.85);
  border-radius:999px;
  box-shadow: 0 5px 0 rgba(255,255,255,.85), 0 10px 0 rgba(255,255,255,.85);
}

.menu{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width:180px;
  border:1px solid var(--lt-line);
  border-radius: var(--radius-sm);
  background: var(--menu-bg);
  box-shadow: var(--shadow-lg);
  overflow:hidden;
  z-index: 60;
}
.menu-item, a.menu-item, button.menu-item{
  display:flex;
  width:100%;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lt-text);
  text-decoration:none;
  background:transparent;
  border:0;
  cursor:pointer;
  outline: none;
}
a.menu-item:visited{ color: var(--lt-text); }
.menu-item:hover{ background: var(--surface-1); }
.menu-item:focus-visible{ outline: var(--focus-ring); outline-offset:-2px; }
.menu-sep{ height:1px; background: var(--lt-line); margin: 4px 0; }
.authed-only.hidden,
.unauthed-only.hidden{ display:none !important; }

/* =========================================================
   Modal / sign-in
   ========================================================= */
.modal-overlay{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 220;
}
.modal-overlay.hidden{ display:none !important; }

#modalRoot{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 300;
}
#modalRoot.hidden{ display:none !important; }

.signin-modal{
  width: min(520px, 100%);
  position: relative;
  border: 1px solid var(--lt-line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 22px;
  transform: translateY(-48px);
}

.signin-x, .signin-back{
  position: absolute;
  top: 12px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: var(--surface-1);
  color: var(--text-tertiary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
}
.signin-x{ right: 12px; }
.signin-back{ left: 12px; }
.signin-x:hover, .signin-back:hover{
  background: var(--surface-2);
  color: var(--lt-text);
}

.signin-title{ margin: 6px 0 14px; text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 0; color: var(--lt-text); }
.signin-brand{ color: var(--brand); }
.signin-subtitle{ margin: 0 0 16px; text-align: center; color: var(--text-tertiary); font-size: 14px; line-height: 1.4; }
.signin-subtitle strong{ color: var(--lt-text); font-weight: 600; }

.signin-input{
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--lt-line-dark);
  background: #fff;
  color: var(--lt-text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.signin-input:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24,118,220,.15);
}
.signin-input::placeholder{ color: var(--muted); }
.signin-primary{ width: 100%; margin-top: 12px; min-width: auto; }

.signin-modal input[type="text"],
.signin-modal select,
.signin-modal textarea{
  background: #fff;
  border: 1px solid var(--lt-line-dark);
  color: var(--lt-text);
  font-family: inherit;
}
.signin-modal input::placeholder,
.signin-modal textarea::placeholder{
  color: var(--muted);
}
.signin-modal input:focus,
.signin-modal textarea:focus,
.signin-modal select:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24,118,220,.15);
}
.signin-modal .link-btn{ color: var(--brand); }
.signin-modal .link-btn:hover{ color: var(--brand-active); }

.signin-or{
  display:flex;
  align-items:center;
  gap: 14px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .12em;
  font-size: 11px;
  justify-content:center;
}
.signin-or::before, .signin-or::after{ content:""; flex:1; height: 1px; background: var(--lt-line); }
.signin-or span{ padding: 0 6px; }

.oauth-btn{
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 12px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--lt-line-dark);
  background: #fff;
  color: var(--lt-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.oauth-btn:hover{ background: var(--lt-bg-subtle); }
.oauth-btn:disabled{ opacity: .55; cursor: not-allowed; }
.oauth-ico{
  width: 28px; height: 28px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--lt-line);
}

.signin-err{ margin-top: 12px; font-size: 13px; color: var(--err); display: none; text-align: center; }
.signin-err.show{ display:block; }
.signin-step.hidden{ display:none; }

/* OTP */
#signinStepOtp .signin-title { margin-bottom: 10px; }
#signinStepOtp .signin-subtitle { margin-bottom: 14px; }

.otp-boxes{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 8px auto 10px;
}
.otp-box{
  flex: 0 0 auto;
  width: 54px; height: 58px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--lt-line-dark);
  background: #fff;
  color: var(--lt-text);
  font-size: 26px;
  font-weight: 700;
  font-family: var(--mono);
  text-align: center;
  line-height: 1;
  padding-top: 1px;
  appearance: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.otp-box:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24,118,220,.18);
}
.otp-error{ min-height: 18px; margin: 0 0 6px; font-size: 13px; color: var(--err); text-align: center; }
.otp-boxes.error .otp-box{
  border-color: rgba(251,113,133,.90);
  box-shadow: 0 0 0 3px rgba(251,113,133,.14);
  animation: otp-shake 0.4s ease-in-out;
}
@keyframes otp-shake{
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.otp-resend-row{ display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.otp-countdown{ font-size: 13px; color: var(--lt-text-muted); font-family: var(--mono); }
.name-input-last{ margin-top: 12px; }
.name-skip{ margin-top: 12px; display: block; width: 100%; text-align: center; }

/* =========================================================
   Footer buildbar (SkyMonde dark footer)
   ========================================================= */
.buildbar{
  position: static;
  z-index: 50;
  margin: auto 0 0;
  width: 100%;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  font-size: 11px;
  color: rgba(255,255,255,.45);
  padding: 14px 20px;
  background: var(--footer-bg);
}
.buildbar span{ font-family: var(--mono); }
.buildbar a{ color: rgba(255,255,255,.6); text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); }
.buildbar a:hover{ color: rgba(255,255,255,.85); text-decoration-color: rgba(255,255,255,.5); }
.buildbar > *{ display:inline-flex; align-items:center; }
.buildbar > * + *::before{ content:"•"; opacity:.5; margin: 0 10px; }

.dev-only{ display:none; }
.prod-only{ display:none; }
body.env-dev .dev-only{ display: initial; }
body.env-prod .prod-only{ display: initial; }

.home-link{ color: var(--brand-dark); font-weight: 700; text-decoration: none; padding: 2px 6px; }
.home-link:hover{ text-decoration: underline; }

/* =========================================================
   Accessibility
   ========================================================= */
.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}

/* =========================================================
   Chat page
   ========================================================= */
.chat-wrap{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  border-left: 1px solid var(--lt-line);
  border-right: 1px solid var(--lt-line);
}

.chat-messages{
  --chat-bubble-w: 80%;
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--lt-bg-subtle);
}

.chat-msg{
  max-width: var(--chat-bubble-w);
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 14px;
}
.chat-msg.user{
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  box-shadow: var(--shadow);
}
.chat-msg.assistant{
  align-self: flex-start;
  background: #fff;
  color: var(--lt-text);
  border: 1px solid var(--lt-line);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
  box-shadow: var(--shadow);
}
.chat-msg.tool-info{
  align-self: flex-start;
  background: var(--lt-bg-code);
  color: var(--text-tertiary);
  font-size: 13px;
  border: 1px solid var(--lt-line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
}
.chat-msg.error{
  align-self: center;
  background: #fee6e6;
  color: #cc4319;
  font-size: 13px;
  border: 1px solid #fbbeb7;
  border-radius: var(--radius-sm);
}
.chat-msg.thinking{
  align-self: flex-start;
  background: transparent;
  color: var(--lt-text-muted);
  font-style: italic;
  font-size: 13px;
  padding: 6px 14px;
}
.chat-msg.filler{
  font-style: italic;
  color: var(--lt-text-muted);
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6px 14px;
}

.chat-input-area{
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--lt-line);
  background: #fff;
}
.chat-input-area textarea{
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--lt-line-dark);
  border-radius: var(--radius-pill);
  background: var(--lt-bg-subtle);
  color: var(--lt-text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input-area textarea::placeholder{ color: var(--muted); }
.chat-input-area textarea:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24,118,220,.12);
}
.chat-input-area .btn{
  min-width: auto;
  padding: 10px 22px;
  white-space: nowrap;
  align-self: flex-end;
  font-size: 14px;
}

/* debug wrench menu */
.dbg-menu{
  position: relative;
  align-self: flex-end;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.dbg-btn{
  background: none;
  border: 1px solid var(--lt-line);
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--lt-text-muted);
  transition: color .15s, border-color .15s;
}
.dbg-btn:hover{ color: var(--lt-text); border-color: var(--lt-text-muted); }
.dbg-btn.active{ color: var(--brand); border-color: var(--brand); }
.dbg-panel{
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--lt-bg);
  border: 1px solid var(--lt-line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 170px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  z-index: 10;
}
.dbg-title{
  font-size: 11px;
  font-weight: 600;
  color: var(--lt-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.dbg-flag{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--lt-text);
}
.dbg-flag input{ margin: 0; }
.dbg-flag:hover{ color: var(--brand); }

/* debug timeline panel */
.chat-debug{
  align-self: flex-start;
  max-width: var(--chat-bubble-w);
  width: 100%;
  font-size: 12px;
  margin-top: -4px;
}
.chat-debug-hdr{
  cursor: pointer;
  color: var(--lt-text);
  padding: 4px 10px;
  user-select: none;
}
.chat-debug-hdr:hover{ color: var(--lt-text); }
.chat-debug-body{ padding: 6px 10px; }
.chat-debug-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-family: var(--mono);
}
.chat-debug-label{ width: 140px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lt-text); }
.chat-debug-track{ flex: 1; height: 14px; background: var(--lt-bg-code); border-radius: 3px; position: relative; min-width: 100px; }
.chat-debug-bar{
  position: absolute; top: 2px; bottom: 2px; border-radius: 2px;
  background: var(--brand);
}
.chat-debug-bar.tool{ background: #10b981; }
.chat-debug-time{ width: 60px; flex-shrink: 0; text-align: right; color: var(--lt-text); }
.chat-debug-reason{ width: 70px; flex-shrink: 0; color: var(--lt-text-muted); }

/* =========================================================
   Typing indicator (three bouncing dots)
   ========================================================= */
.typing-indicator{
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--lt-line);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
  max-width: 60px;
}
.typing-indicator .dot{
  width: 8px; height: 8px;
  background: #90949c;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-indicator .dot:nth-child(2){ animation-delay: 0.16s; }
.typing-indicator .dot:nth-child(3){ animation-delay: 0.32s; }

@keyframes typing-bounce{
  0%, 80%, 100%{ transform: scale(0.6); opacity: 0.4; }
  40%{ transform: scale(1); opacity: 1; }
}

/* =========================================================
   Flight cards (Skymonde-inspired)
   ========================================================= */
.fc-wrap{
  align-self: flex-start;
  max-width: var(--chat-bubble-w);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
.fc{
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 2px rgba(26,35,43,.04), 0 1px 3px rgba(26,35,43,.12);
  min-width: 420px;
}
.fc-legs{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.fc-leg{
  display: flex;
  align-items: center;
  gap: 12px;
}
.fc-airline{
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
}
.fc-overflow.hidden{ display: none; }
.fc-expand{
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-dark);
  cursor: pointer;
  user-select: none;
}
.fc-expand:hover{ text-decoration: underline; }
.fc-route{
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.fc-point{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  position: relative;
}
.fc-time{
  font-size: 16px;
  font-weight: 700;
  color: #1a232b;
  line-height: 1.2;
}
.fc-code{
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.fc-next-day{
  position: absolute;
  top: -2px;
  right: -16px;
  font-size: 10px;
  color: #e65100;
  font-weight: 700;
}
.fc-mid{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
}
.fc-dur{
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}
.fc-line{
  width: 100%;
  height: 2px;
  background: #d1d5db;
  border-radius: 1px;
  position: relative;
}
.fc-line::before,
.fc-line::after{
  content: "";
  position: absolute;
  top: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d1d5db;
}
.fc-line::before{ left: 0; }
.fc-line::after{ right: 0; }
.fc-stops{
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}
.fc-price-area{
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-left: 16px;
  border-left: 1px solid #e9ecef;
}
.fc-price{
  font-size: 20px;
  font-weight: 800;
  color: #1a232b;
  line-height: 1;
}
.fc-book{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border-radius: 1000px;
  background: #1771d4;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.fc-book:hover{ background: #1260b8; }
.fc-badges{
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.fc-badge{
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 8px;
  border-radius: 1000px;
}
.fc-badge.cheapest{ background: #ecfdf5; color: #059669; }
.fc-badge.fastest{ background: #eff6ff; color: #2563eb; }
.fc-badge.best{ background: #fef3c7; color: #d97706; }

/* =========================================================
   Price prediction card
   ========================================================= */
.pp{
  align-self: flex-start;
  max-width: var(--chat-bubble-w);
  width: 100%;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 0 2px rgba(26,35,43,.04), 0 1px 3px rgba(26,35,43,.12);
}
.pp-hdr{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pp-dot{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pp-hdr.buy .pp-dot{ background: #1771d4; }
.pp-hdr.wait .pp-dot{ background: #059669; }
.pp-advice{
  font-size: 17px;
  font-weight: 800;
  color: #1a232b;
}
.pp-desc{
  font-size: 13px;
  color: #3a424a;
  line-height: 1.5;
  margin-bottom: 12px;
}
.pp-chart{
  margin-bottom: 12px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 8px 4px 4px;
  background: #fafbfc;
}
.pp-svg{
  width: 100%;
  height: auto;
  display: block;
}
.pp-axis{
  font-size: 9px;
  fill: #9ca3af;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.pp-prices{
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pp-price-item{
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pp-price-label{
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}
.pp-price-val{
  font-size: 15px;
  font-weight: 700;
  color: #1a232b;
}
.pp-band{
  font-size: 11px;
  color: #9ca3af;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 520px){
  .otp-boxes{ gap: 10px; max-width: 280px; }
  .otp-box{ width: 48px; height: 54px; font-size: 24px; }
}

@media (max-width: 720px){
  body{
    align-items:stretch;
    padding: 0;
  }
  .wrap{ min-height: 100vh; min-height: 100dvh; }

  .app-topbar{
    z-index: 140;
  }
  .app-topbar .topbar-inner{ padding: 10px 14px; }

  .buildbar{
    margin: 0;
  }

  /* Chat full-screen on mobile */
  .wrap:has(.chat-wrap){
    min-height: 100vh;
    min-height: 100dvh;
  }
  .wrap:has(.chat-wrap) ~ .buildbar{
    display: none;
  }
  .chat-wrap{
    border-left: none;
    border-right: none;
  }
  .chat-messages{
    padding: 14px 12px;
  }
  .chat-input-area{
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .chat-messages{ --chat-bubble-w: 90%; }
  .fc{ min-width: 0; flex-direction: column; align-items: stretch; }
  .fc-price-area{ flex-direction: row; justify-content: space-between; padding-left: 0; padding-top: 10px; border-left: 0; border-top: 1px solid #e9ecef; }
  .cp-grid{ grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .cp-cell{ min-width: 0; padding: 4px 2px; }
  .cp-price{ font-size: 9px; }
}

/* =========================================================
   Calendar pricing card
   ========================================================= */
.cp{
  align-self: flex-start;
  background: #fff; border-radius: 12px; padding: 16px; margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); max-width: var(--chat-bubble-w); width: 100%; color: #1a1a2e;
}
.cp-hdr{
  font-weight: 700; font-size: 15px; margin-bottom: 12px; color: #0f172a;
}
.cp-grid{
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
}
.cp-dow{
  text-align: center; font-size: 11px; font-weight: 600; color: #64748b;
  padding: 4px 0;
}
.cp-cell{
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 2px; border-radius: 6px; min-height: 48px; background: #f8f9fc;
  transition: background .15s;
}
.cp-empty{ background: transparent; }
.cp-day{ font-size: 12px; font-weight: 600; color: #334155; }
.cp-price{ font-size: 10px; margin-top: 2px; font-weight: 500; }
.cp-low{ background: #ecfdf5; }
.cp-low .cp-price{ color: #059669; font-weight: 700; }
.cp-middle{ background: #fffbeb; }
.cp-middle .cp-price{ color: #d97706; }
.cp-high{ background: #fef2f2; }
.cp-high .cp-price{ color: #dc2626; }
.cp-legend{
  display: flex; gap: 16px; margin-top: 10px; justify-content: center;
}
.cp-leg-item{
  display: flex; align-items: center; gap: 4px; font-size: 11px; color: #64748b;
}
.cp-dot{
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.cp-dot.cp-low{ background: #059669; }
.cp-dot.cp-middle{ background: #d97706; }
.cp-dot.cp-high{ background: #dc2626; }

/* =========================================================
   Price matrix heatmap card
   ========================================================= */
.pm{
  align-self: flex-start;
  background: #fff; border-radius: 12px; padding: 16px; margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); max-width: var(--chat-bubble-w); width: 100%; color: #1a1a2e;
  overflow-x: auto;
}
.pm-hdr{
  font-weight: 700; font-size: 15px; margin-bottom: 4px; color: #0f172a;
}
.pm-sub{
  font-size: 12px; color: #64748b; margin-bottom: 10px;
}
.pm-table{
  display: grid;
  grid-template-columns: 28px repeat(23, 1fr);
  gap: 1px;
}
.pm-corner{
  position: relative; font-size: 8px; color: #94a3b8; overflow: hidden;
}
.pm-corner-dep{
  position: absolute; top: 1px; right: 1px; font-size: 7px;
}
.pm-corner-ret{
  position: absolute; bottom: 1px; left: 1px; font-size: 7px;
}
.pm-ch{
  text-align: center; font-size: 8px; font-weight: 600; color: #64748b;
  padding: 2px 0; line-height: 1;
}
.pm-rh{
  text-align: right; font-size: 8px; font-weight: 600; color: #64748b;
  padding: 2px 2px 2px 0; line-height: 1;
  display: flex; align-items: center; justify-content: flex-end;
}
.pm-cell{
  aspect-ratio: 1;
  border-radius: 2px;
  background: #f1f5f9;
  cursor: default;
  min-width: 0;
}
.pm-cell[title]{ cursor: crosshair; }
.pm-cell:hover{ opacity: .8; outline: 1px solid #334155; z-index: 1; }
.pm-axes{
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 10px; color: #94a3b8;
}
.pm-legend{
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  justify-content: center;
}
.pm-leg-lo, .pm-leg-hi{
  font-size: 11px; font-weight: 600;
}
.pm-leg-lo{ color: #059669; }
.pm-leg-hi{ color: #dc2626; }
.pm-leg-bar{
  width: 120px; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, #05966a, #d9a706, #dc2626);
}

/* =========================================================
   Schedule card
   ========================================================= */
.sc{
  align-self: flex-start;
  background: #fff; border-radius: 12px; padding: 16px; margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); max-width: var(--chat-bubble-w); width: 100%; color: #1a1a2e;
}
.sc-hdr{
  font-weight: 700; font-size: 15px; margin-bottom: 4px; color: #0f172a;
}
.sc-sub{
  font-size: 12px; color: #64748b; margin-bottom: 10px;
}
.sc-table{
  width: 100%; border-collapse: collapse;
}
.sc-table th{
  text-align: left; font-size: 10px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px;
  border-bottom: 2px solid #e9ecef;
}
.sc-table td{
  padding: 7px 8px; font-size: 13px; border-bottom: 1px solid #f1f5f9;
}
.sc-table tbody tr:last-child td{ border-bottom: none; }
.sc-logo{
  width: 20px; height: 20px; object-fit: contain; border-radius: 3px;
  vertical-align: middle; margin-right: 6px;
}
.sc-flight, .sc-carrier{ font-weight: 700; color: #0f172a; white-space: nowrap; }
.sc-time, .sc-otp, .sc-deps{ font-variant-numeric: tabular-nums; }
.sc-dur, .sc-days{ color: #64748b; }
.sc-fare{ font-variant-numeric: tabular-nums; }
.sc-fare-note{
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #e9ecef;
  font-size: 12px; color: #64748b;
}
