/* Estela's assistant: the chat panel. */
.chat { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); z-index: 70; width: min(410px, calc(100vw - 40px)); height: min(680px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 40px 90px -30px rgba(1, 22, 119, .55); border: 1px solid var(--line); font: 400 15px/1.5 var(--body); color: var(--ink); }
.chat[hidden] { display: none; }
.chat-head { background: var(--night); color: #fff; padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 10px; }
.chat-head .av { width: 42px; height: 42px; border-radius: 50%; background: #1A2470; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-head .av img { width: 32px; height: auto; }
.chat-head .who { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head .who b { font-size: 15px; }
.chat-head .who span { font-size: 12px; color: var(--on-night); display: flex; align-items: center; gap: 6px; }
.chat-head .who span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3FD08A; }
.chat-head .lang { background: rgba(255, 255, 255, .1); }
.chat-head .lang button { color: #fff; min-height: 32px; padding: 6px 9px; }
.chat-head .lang button[aria-pressed="true"] { background: #fff; color: var(--navy); }
.chat-head .status.closed::before { background: #F5B94A; }
.chat-new { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: .85; }
.chat-new:hover, .chat-x:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
.chat-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-log { flex-grow: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--lilac); overscroll-behavior: contain; }
/* Messages keep their full height; the log scrolls (without this, the estimate card, which has overflow: hidden, was squeezed to 0 in long chats). */
.chat-log > * { flex-shrink: 0; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 18px 18px 18px 6px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--navy); color: #fff; font-weight: 600; }
.msg.estela { border: 1.5px solid var(--pink); }
.msg.estela .from { display: block; font-size: 12px; font-weight: 800; color: var(--pink-ink); margin-bottom: 2px; }
.msg.sys { align-self: center; background: transparent; padding: 2px 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.msg.list ul { margin: 6px 0 0; padding: 0 0 0 18px; }
.msg.list li { margin: 2px 0; }
.qbtns { display: flex; flex-wrap: wrap; gap: 6px; max-width: 94%; }
.qbtns button { min-height: 38px; padding: 0 13px; border-radius: 999px; border: 1.5px solid var(--navy); background: #fff; color: var(--navy); font: 700 13px var(--body); cursor: pointer; }
.qbtns button:hover { background: var(--navy); color: #fff; }
.qbtns button[data-action="ticket"] { border-color: var(--pink); background: var(--petal); color: var(--pink-ink); }
.qbtns.used button { opacity: .55; pointer-events: none; }
.msg-link { align-self: flex-start; }
.est { max-width: 92%; border-radius: 18px 18px 18px 6px; background: #fff; overflow: hidden; }
.est .card-in { margin: 10px; padding: 14px; border-radius: 14px; background: var(--night); color: #fff; display: flex; flex-direction: column; gap: 4px; }
.est .k { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #8FA6FF; }
.est .h { font-family: var(--display); font-size: 26px; line-height: 1.05; }
.est .s { font-size: 13px; color: var(--on-night); font-variant-numeric: tabular-nums; }
.est .est-d { margin: 8px 0 2px; display: grid; gap: 6px; font-size: 13px; }
.est .est-d div { display: grid; grid-template-columns: minmax(84px, 38%) 1fr; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 6px; }
.est .est-d dt { color: #8FA6FF; font-weight: 700; }
.est .est-d dd { margin: 0; color: #fff; font-variant-numeric: tabular-nums; }
.est .fine { font-size: 12px; opacity: .8; margin-top: 4px; }
.est .acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 10px 12px; }
.tform { max-width: 94%; background: #fff; border-radius: 18px; border: 1.5px solid var(--pink); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tform b { color: var(--pink-ink); font-size: 13px; }
.tform label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 800; color: var(--muted); }
.tform input, .tform textarea, .tform select { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; font: 500 15px var(--body); color: var(--ink); background: #fff; }
.tform textarea { min-height: 70px; resize: vertical; }
.tform input:focus, .tform textarea:focus, .tform select:focus { outline: none; border-color: var(--navy); }
.tform .err { color: var(--pink-ink); font-size: 13px; font-weight: 700; }
.chat-form { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; background: #fff; }
.chat-form input { flex-grow: 1; min-width: 0; min-height: 48px; border-radius: 999px; border: 1.5px solid var(--line); padding: 0 16px; font: 500 15px var(--body); color: var(--ink); }
.chat-form input:focus { outline: none; border-color: var(--navy); }
.chat-send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.chat-foot { padding: 0 14px 10px; font-size: 11px; color: var(--muted); text-align: center; background: #fff; }
@media (max-width: 520px) {
  .chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top, 0px); }
}

/* typing… */
.msg.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; width: auto; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .35; animation: chat-dot 1s infinite ease-in-out; }
.msg.typing i:nth-child(2) { animation-delay: .15s; }
.msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .msg.typing i { animation: none; } }

/* "Step 2 of 6" in the estimate */
.step { margin: 4px 0 -2px; display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.step b { flex-grow: 1; max-width: 160px; height: 5px; border-radius: 99px; background: rgba(1, 22, 119, .12); position: relative; overflow: hidden; }
.step b::after { content: ""; position: absolute; inset: 0; width: calc(var(--p) * 100%); border-radius: inherit; background: var(--pink); }

/* the offer of help next to the launcher */
.chat-nudge { position: fixed; z-index: 61; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); max-width: min(300px, calc(100vw - 40px)); display: flex; align-items: flex-start; gap: 4px; padding: 6px 6px 6px 4px; border-radius: 18px 18px 6px 18px; background: #fff; border: 1.5px solid var(--pink); box-shadow: 0 20px 40px -18px rgba(1, 22, 119, .45); animation: nudge-in .35s ease-out; }
.chat-nudge .go { border: 0; background: transparent; text-align: left; padding: 8px 10px; font: 600 14px/1.4 var(--body); color: var(--ink); cursor: pointer; }
.chat-nudge .x { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.chat-nudge .x:hover { background: var(--lilac); }
@keyframes nudge-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .chat-nudge { animation: none; } }
body[data-page="estimate"] .chat-nudge { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
