/* Mount hosts (pages provide [data-chat-entry]) */
[data-chat-entry]{min-height:0;width:100%;}
[data-chat-entry][data-chat-entry-mode="page"],
.chat-entry-mount--page{
  flex:1;display:flex;flex-direction:column;min-height:0;width:100%;
}

/* ===== CHAT SHELL ===== */
.chat-shell{
    flex:1;min-height:0;display:flex;flex-direction:column;
    width:100%;max-width:480px;margin:0 auto;
    height:calc(100dvh - var(--site-header-h));
    max-height:calc(100dvh - var(--site-header-h));
    background:
      radial-gradient(ellipse 90% 40% at 10% 0%, rgba(198,161,91,.14), transparent 55%),
      linear-gradient(180deg, #FFFFFF 0%, var(--page-alt) 100%);
  }

  .chat-brand{
    flex-shrink:0;padding:18px 18px 10px;
    display:flex;align-items:center;gap:12px;
  }
  .chat-brand .mark{
    width:42px;height:42px;border-radius:12px;flex-shrink:0;
    background:linear-gradient(135deg,var(--saffron),var(--sindoor));
    display:flex;align-items:center;justify-content:center;
    font-family:'Yatra One',cursive;font-size:1.25rem;color:#FBF6F3;
  }
  .chat-brand .copy{min-width:0;}
  .chat-brand h1{
    font-family:'Yatra One',cursive;font-size:1.55rem;line-height:1.1;
    color:var(--sindoor);letter-spacing:-.2px;
  }
  .chat-brand p{
    margin-top:2px;font-size:13.5px;color:var(--text-soft);line-height:1.35;
  }

  .chat-messages{
    flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;
    padding:8px 16px 16px;
    display:flex;flex-direction:column;gap:12px;
    scroll-behavior:smooth;
  }

  .chat-empty{
    margin:auto 0;padding:8px 0 20px;
    animation:rise .55s ease both;
  }
  .chat-empty-label{
    font-size:11px;font-weight:700;letter-spacing:1.4px;text-transform:uppercase;
    color:var(--text-soft);margin-bottom:12px;opacity:.85;
  }
  .prompt-chips{display:flex;flex-direction:column;gap:8px;}
  .prompt-chip{
    appearance:none;background:transparent;
    border:1px solid rgba(139,122,116,.32);
    color:var(--text-soft);text-align:left;cursor:pointer;
    font-family:'Poppins',sans-serif;font-size:14px;font-weight:400;line-height:1.4;
    padding:12px 15px;border-radius:14px;
    transition:border-color .15s ease, color .15s ease, transform .15s ease;
  }
  .prompt-chip:hover,.prompt-chip:focus-visible{
    border-color:rgba(114,72,69,.4);color:var(--text);outline:none;
  }
  .prompt-chip:active{transform:scale(.99);}

  .msg{
    display:flex;flex-direction:column;max-width:88%;
    animation:rise .35s ease both;
  }
  .msg--user{align-self:flex-end;}
  .msg--bot{align-self:flex-start;}
  .msg-bubble{
    padding:12px 15px;border-radius:18px;font-size:14.5px;line-height:1.5;
    word-wrap:break-word;overflow-wrap:anywhere;white-space:pre-wrap;
  }
  .chat-cta{
    align-self:stretch;max-width:100%;margin-top:4px;animation:rise .35s ease both;
  }
  .chat-cta-inner{
    background:var(--surface);border:1px solid var(--line);border-radius:16px;
    padding:16px;box-shadow:0 4px 14px rgba(43,33,31,.04);
  }
  .chat-cta-text{
    margin:0 0 12px;font-size:14.5px;line-height:1.5;color:var(--text);
  }
  .chat-cta-link{
    display:inline-flex;align-items:center;justify-content:center;
    text-decoration:none;font-family:'Poppins',sans-serif;font-weight:700;font-size:14px;
    padding:12px 20px;border-radius:999px;width:100%;box-sizing:border-box;
    background:linear-gradient(135deg,var(--saffron),var(--sindoor));color:#FBF6F3;
  }
  .msg--user .msg-bubble{
    background:linear-gradient(135deg,var(--saffron),var(--sindoor));
    color:#FBF6F3;border-bottom-right-radius:6px;
  }
  .msg--bot .msg-bubble{
    background:var(--surface);border:1px solid var(--line);color:var(--text);
    border-bottom-left-radius:6px;
    box-shadow:0 4px 14px rgba(43,33,31,.04);
  }
  .msg-meta{
    font-size:11px;color:var(--text-soft);margin-top:4px;padding:0 4px;
  }
  .msg--user .msg-meta{text-align:right;}

  /* Typing indicator */
  .msg--typing .msg-bubble{padding:14px 18px;min-width:56px;}
  .typing-dots{display:flex;align-items:center;gap:5px;height:14px;}
  .typing-dots span{
    width:7px;height:7px;border-radius:50%;background:var(--text-soft);opacity:.45;
    animation:typing-bounce 1.1s ease-in-out infinite;
  }
  .typing-dots span:nth-child(2){animation-delay:.15s;}
  .typing-dots span:nth-child(3){animation-delay:.3s;}
  @keyframes typing-bounce{
    0%,60%,100%{transform:translateY(0);opacity:.35;}
    30%{transform:translateY(-4px);opacity:.9;}
  }
  .msg--answer-progress .msg-bubble{
    display:flex;flex-direction:column;align-items:flex-start;gap:10px;
    min-width:min(280px,88vw);padding:14px 16px;
  }
  .typing-status{
    margin:0;font-size:13px;line-height:1.4;color:var(--text-soft);
    transition:opacity .25s ease;
  }
  .typing-status.is-fading{opacity:0;}

  /* Sequential birth-detail steps (chat-style, not a form card) */
  .step-ask{align-self:stretch;max-width:100%;margin-top:2px;animation:rise .35s ease both;}
  .step-ask-inner{
    background:var(--surface);border:1px solid var(--line);border-radius:16px;
    padding:12px;box-shadow:0 4px 14px rgba(43,33,31,.04);
  }
  .step-ask input[type="text"],
  .step-ask input[type="email"],
  .step-ask input[type="tel"],
  .step-ask input[type="time"]{
    width:100%;padding:12px 13px;border-radius:12px;font-size:15px;
    font-family:'Poppins',sans-serif;background:var(--page-alt);
    border:1px solid var(--line);color:var(--text);outline:none;margin-bottom:10px;
  }
  .step-ask input:focus{border-color:var(--gold);background:#fff;}
  .step-ask .place-wrap{position:relative;margin-bottom:10px;}
  .step-ask .place-wrap > input{margin-bottom:0;}
  .step-ask .place-dropdown{
    display:none;position:absolute;left:0;right:0;top:100%;margin-top:4px;z-index:40;
    background:var(--surface);border:1px solid var(--line);border-radius:12px;
    overflow:hidden;max-height:220px;overflow-y:auto;
    box-shadow:0 10px 30px rgba(43,33,31,.12);
  }
  .step-ask .place-dropdown.show{display:block;}
  .step-ask-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;}
  .step-ask-actions--split{justify-content:stretch;}
  .step-ask-actions--split .step-next,
  .step-ask-actions--split .step-continue{
    flex:1;min-width:0;text-align:center;justify-content:center;
  }
  .step-next{
    appearance:none;border:none;cursor:pointer;font-family:'Poppins',sans-serif;
    font-size:13.5px;font-weight:600;padding:9px 18px;border-radius:999px;
    background:var(--sindoor);color:#FBF6F3;
  }
  .step-next:disabled{opacity:.4;cursor:not-allowed;}
  .step-next--ghost{
    background:transparent;color:var(--sindoor);
    border:1.5px solid rgba(114,72,69,.35);
  }
  .review-title{
    font-family:'Yatra One',cursive;font-size:1.2rem;color:var(--sindoor);
    margin:0 0 10px;
  }
  .review-list{list-style:none;margin:0 0 14px;padding:0;}
  .review-list li{
    display:flex;gap:10px;justify-content:space-between;align-items:baseline;
    padding:8px 0;border-bottom:1px solid var(--line);
    font-size:13.5px;line-height:1.4;
  }
  .review-list li:last-child{border-bottom:none;}
  .review-label{
    flex-shrink:0;font-size:11px;font-weight:700;letter-spacing:.4px;
    text-transform:uppercase;color:var(--text-soft);
  }
  .review-value{text-align:right;color:var(--text);font-weight:500;word-break:break-word;}
  .review-value--muted{color:var(--text-soft);font-weight:400;}
  .dob-pickers{display:flex;gap:8px;margin-bottom:10px;}
  .dob-col{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;}
  .dob-col label{
    font-size:10px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;
    color:var(--text-soft);text-align:center;
  }
  .dob-col select{
    width:100%;height:132px;padding:4px;border-radius:12px;
    border:1px solid var(--line);background:var(--page-alt);color:var(--text);
    font-family:'Poppins',sans-serif;font-size:14px;outline:none;
  }
  .dob-col select:focus{border-color:var(--gold);background:#fff;}
  .consent-row{display:flex;align-items:flex-start;gap:10px;margin:2px 0 12px;}
  .consent-row input{width:auto;margin-top:3px;flex-shrink:0;accent-color:var(--sindoor);}
  .consent-row label{
    font-size:12.5px;font-weight:400;color:var(--text-soft);margin:0;line-height:1.45;
  }
  .step-continue{
    appearance:none;border:none;cursor:pointer;font-family:'Poppins',sans-serif;
    padding:13px 22px;border-radius:999px;font-weight:700;font-size:14.5px;
    display:inline-flex;align-items:center;justify-content:center;width:100%;
    background:linear-gradient(135deg,var(--saffron),var(--sindoor));color:#FBF6F3;
    transition:opacity .15s ease, transform .15s ease;
  }
  .step-continue:disabled{opacity:.72;cursor:default;}
  .step-continue:not(:disabled):active{transform:scale(.99);}
  .step-error{
    margin-top:10px;font-size:13px;color:var(--sindoor);line-height:1.4;text-align:center;
  }
  .step-status{
    margin-top:10px;font-size:13px;color:var(--text-soft);line-height:1.4;text-align:center;
  }

  /* Real input — sticky bottom, elevated vs outlined chips */
  .chat-composer{
    position:sticky;bottom:0;z-index:5;flex-shrink:0;
    padding:12px 14px calc(12px + env(safe-area-inset-bottom, 0px) + var(--kb-offset));
    background:rgba(255,255,255,.96);
    border-top:1px solid var(--line);
    box-shadow:0 -10px 28px rgba(43,33,31,.08);
    backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  }
  .chat-composer.is-locked{opacity:.55;pointer-events:none;}
  .composer-row{
    display:flex;align-items:flex-end;gap:8px;
    background:#fff;
    border:1.5px solid rgba(114,72,69,.28);
    border-radius:22px;
    padding:6px 6px 6px 14px;
    box-shadow:0 4px 16px rgba(43,33,31,.07);
  }
  .composer-row:focus-within{
    border-color:var(--gold);
    box-shadow:0 6px 20px rgba(114,72,69,.12);
  }
  #chatInput{
    flex:1;min-width:0;border:none;background:transparent;outline:none;
    font-family:'Poppins',sans-serif;font-size:15px;line-height:1.4;
    color:var(--text);padding:10px 0;resize:none;max-height:120px;
  }
  #chatInput::placeholder{color:var(--text-soft);}
  #sendBtn{
    appearance:none;border:none;cursor:pointer;flex-shrink:0;
    width:42px;height:42px;border-radius:50%;
    background:var(--sindoor);
    color:#FBF6F3;display:flex;align-items:center;justify-content:center;
    box-shadow:0 2px 8px rgba(114,72,69,.28);
    transition:transform .15s ease, opacity .15s ease;
  }
  #sendBtn:disabled{opacity:.35;cursor:not-allowed;box-shadow:none;}
  #sendBtn:not(:disabled):active{transform:scale(.96);}
  #sendBtn svg{width:18px;height:18px;display:block;}

  @keyframes rise{
    from{opacity:0;transform:translateY(10px);}
    to{opacity:1;transform:translateY(0);}
  }
  @media(prefers-reduced-motion:reduce){
    .chat-empty,.msg,.step-ask{animation:none;}
    .typing-dots span{animation:none;opacity:.55;}
    .chat-messages{scroll-behavior:auto;}
  }

  /* Desktop secondary — keep the same narrow chat column */
  @media(min-width:720px){
    .chat-shell{border-left:1px solid var(--line);border-right:1px solid var(--line);}
    .chat-brand{padding:22px 22px 12px;}
    .chat-messages{padding:10px 22px 18px;}
    .chat-composer{padding-left:18px;padding-right:18px;}
  }

/* Embedded (column) mode — used by /drishti hero */
.chat-shell--embed{
  max-width:none;width:100%;
  height:min(720px, calc(100dvh - var(--site-header-h) - 40px));
  max-height:min(720px, calc(100dvh - var(--site-header-h) - 40px));
  border:1px solid var(--line);
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 16px 40px rgba(114,72,69,.08);
}
@media(max-width:900px){
  .chat-shell--embed{
    height:min(640px, calc(100dvh - var(--site-header-h) - 24px));
    max-height:min(640px, calc(100dvh - var(--site-header-h) - 24px));
  }
}
